From c2a226bca5d6e880a9ede2ce24867f3af7dadb6e Mon Sep 17 00:00:00 2001 From: Colin Adler Date: Thu, 22 Jun 2023 16:44:07 +0000 Subject: [PATCH 1/7] chore: upgrade terraform --- .github/workflows/ci.yaml | 2 +- provisioner/terraform/install.go | 2 +- scripts/Dockerfile.base | 9 +++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6ad6f4e27d82b..56bae468a1646 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -231,7 +231,7 @@ jobs: - uses: hashicorp/setup-terraform@v2 with: - terraform_version: 1.1.9 + terraform_version: 1.5.1 terraform_wrapper: false - name: Test with Mock Database diff --git a/provisioner/terraform/install.go b/provisioner/terraform/install.go index c1ba27fc0f2b4..a1391fc679729 100644 --- a/provisioner/terraform/install.go +++ b/provisioner/terraform/install.go @@ -22,7 +22,7 @@ var ( TerraformVersion = version.Must(version.NewVersion("1.4.6")) minTerraformVersion = version.Must(version.NewVersion("1.1.0")) - maxTerraformVersion = version.Must(version.NewVersion("1.4.9")) + maxTerraformVersion = version.Must(version.NewVersion("1.5.1")) terraformMinorVersionMismatch = xerrors.New("Terraform binary minor version mismatch.") ) diff --git a/scripts/Dockerfile.base b/scripts/Dockerfile.base index 5dbbdb386696b..ca938ef891323 100644 --- a/scripts/Dockerfile.base +++ b/scripts/Dockerfile.base @@ -11,9 +11,10 @@ RUN apk add --no-cache \ wget \ bash \ git \ - openssl>=3.1.1-r1 \ - openssh-client \ - terraform=1.4.6-r1 && \ + openssh-client && \ + # Use the edge repo, since Terraform doesn't seem to be backported. + apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community \ + terraform=1.5.1-r0 && \ addgroup \ -g 1000 \ coder && \ @@ -25,7 +26,7 @@ RUN apk add --no-cache \ -G coder \ coder -USER 1000:1000 +# USER 1000:1000 ENV HOME=/home/coder ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt WORKDIR /home/coder From 88d9391e757564ca38bac872a7a898897c97e3c6 Mon Sep 17 00:00:00 2001 From: Colin Adler Date: Thu, 22 Jun 2023 16:53:00 +0000 Subject: [PATCH 2/7] fixup! chore: upgrade terraform --- provisioner/terraform/provision_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/provisioner/terraform/provision_test.go b/provisioner/terraform/provision_test.go index b274b547406e3..866783a5509f2 100644 --- a/provisioner/terraform/provision_test.go +++ b/provisioner/terraform/provision_test.go @@ -284,7 +284,7 @@ func TestProvision(t *testing.T) { Files: map[string]string{ "main.tf": `a`, }, - ErrorContains: "initialize terraform", + ErrorContains: "plan terraform", ExpectLogContains: "Argument or block definition required", }, { @@ -292,7 +292,7 @@ func TestProvision(t *testing.T) { Files: map[string]string{ "main.tf": `;asdf;`, }, - ErrorContains: "initialize terraform", + ErrorContains: "plan terraform", ExpectLogContains: `The ";" character is not valid.`, }, { From 0f5fdbd2ca9a7d9f9ed7c9ef061e9105b06d294b Mon Sep 17 00:00:00 2001 From: Colin Adler Date: Thu, 22 Jun 2023 17:12:57 +0000 Subject: [PATCH 3/7] fixup! chore: upgrade terraform --- .github/workflows/ci.yaml | 4 ++-- provisioner/terraform/provision_test.go | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 56bae468a1646..5115af11af59a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -296,7 +296,7 @@ jobs: - uses: hashicorp/setup-terraform@v2 with: - terraform_version: 1.1.9 + terraform_version: 1.5.1 terraform_wrapper: false - name: Test with PostgreSQL Database @@ -474,7 +474,7 @@ jobs: - uses: hashicorp/setup-terraform@v2 with: - terraform_version: 1.1.9 + terraform_version: 1.5.1 terraform_wrapper: false - name: Build diff --git a/provisioner/terraform/provision_test.go b/provisioner/terraform/provision_test.go index 866783a5509f2..7879d30fc76ed 100644 --- a/provisioner/terraform/provision_test.go +++ b/provisioner/terraform/provision_test.go @@ -20,7 +20,6 @@ import ( "cdr.dev/slog" "cdr.dev/slog/sloggers/slogtest" - "github.com/coder/coder/provisioner/terraform" "github.com/coder/coder/provisionersdk" "github.com/coder/coder/provisionersdk/proto" From 1685d3d0e03386a6105ded11934c0d28ba87c7b6 Mon Sep 17 00:00:00 2001 From: Colin Adler Date: Thu, 22 Jun 2023 17:23:48 +0000 Subject: [PATCH 4/7] fix for arm --- scripts/Dockerfile.base | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/Dockerfile.base b/scripts/Dockerfile.base index ca938ef891323..eca51d706ef28 100644 --- a/scripts/Dockerfile.base +++ b/scripts/Dockerfile.base @@ -12,9 +12,12 @@ RUN apk add --no-cache \ bash \ git \ openssh-client && \ - # Use the edge repo, since Terraform doesn't seem to be backported. + # Use the edge repo, since Terraform doesn't seem to be backported to 3.18. + # TODO: remove =~ + # For some reason alpine's ARM builders are offline, so ARM builds will have + # to fall back to 1.5.0. apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community \ - terraform=1.5.1-r0 && \ + terraform=~1.5.1-r0 && \ addgroup \ -g 1000 \ coder && \ From f40cfddb16f17f94bad5e5a04bda488af1db7789 Mon Sep 17 00:00:00 2001 From: Colin Adler Date: Thu, 22 Jun 2023 17:30:47 +0000 Subject: [PATCH 5/7] fixup! fix for arm --- .github/workflows/ci.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5115af11af59a..f443ebf2b4473 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -338,6 +338,11 @@ jobs: - uses: ./.github/actions/setup-go + - uses: hashicorp/setup-terraform@v2 + with: + terraform_version: 1.5.1 + terraform_wrapper: false + - name: Run Tests run: | gotestsum --junitfile="gotests.xml" -- -race ./... From f0c0258033a4d21b879399da94761b206e725dd3 Mon Sep 17 00:00:00 2001 From: Colin Adler Date: Thu, 22 Jun 2023 18:31:16 +0000 Subject: [PATCH 6/7] fixup! fix for arm --- scripts/Dockerfile.base | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/Dockerfile.base b/scripts/Dockerfile.base index eca51d706ef28..d71d7f1de89b2 100644 --- a/scripts/Dockerfile.base +++ b/scripts/Dockerfile.base @@ -29,7 +29,7 @@ RUN apk add --no-cache \ -G coder \ coder -# USER 1000:1000 +USER 1000:1000 ENV HOME=/home/coder ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt WORKDIR /home/coder From 577916227f430271f2afa5ee6e3b75d41806dd7f Mon Sep 17 00:00:00 2001 From: Colin Adler Date: Thu, 22 Jun 2023 18:36:41 +0000 Subject: [PATCH 7/7] fixup! fix for arm --- provisioner/terraform/install.go | 2 +- scripts/Dockerfile.base | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/provisioner/terraform/install.go b/provisioner/terraform/install.go index a1391fc679729..c0be0ee6a67bb 100644 --- a/provisioner/terraform/install.go +++ b/provisioner/terraform/install.go @@ -22,7 +22,7 @@ var ( TerraformVersion = version.Must(version.NewVersion("1.4.6")) minTerraformVersion = version.Must(version.NewVersion("1.1.0")) - maxTerraformVersion = version.Must(version.NewVersion("1.5.1")) + maxTerraformVersion = version.Must(version.NewVersion("1.5.9")) // use .9 to automatically allow patch releases terraformMinorVersionMismatch = xerrors.New("Terraform binary minor version mismatch.") ) diff --git a/scripts/Dockerfile.base b/scripts/Dockerfile.base index d71d7f1de89b2..c24970ef2cac3 100644 --- a/scripts/Dockerfile.base +++ b/scripts/Dockerfile.base @@ -1,7 +1,7 @@ # This is the base image used for Coder images. It's a multi-arch image that is # built in depot.dev for all supported architectures. Since it's built on real # hardware and not cross-compiled, it can have "RUN" commands. -FROM alpine:3.18 +FROM alpine:3.18.2 # We use a single RUN command to reduce the number of layers in the image. # NOTE: Keep the Terraform version in sync with minTerraformVersion and @@ -17,7 +17,7 @@ RUN apk add --no-cache \ # For some reason alpine's ARM builders are offline, so ARM builds will have # to fall back to 1.5.0. apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community \ - terraform=~1.5.1-r0 && \ + terraform=~1.5-r0 && \ addgroup \ -g 1000 \ coder && \