Skip to content

chore: upgrade terraform to 1.5.1 #8160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 ./...
Expand Down Expand Up @@ -474,7 +479,7 @@ jobs:

- uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.1.9
terraform_version: 1.5.1
terraform_wrapper: false

- name: Build
Expand Down
2 changes: 1 addition & 1 deletion provisioner/terraform/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.9")) // use .9 to automatically allow patch releases

terraformMinorVersionMismatch = xerrors.New("Terraform binary minor version mismatch.")
)
Expand Down
5 changes: 2 additions & 3 deletions provisioner/terraform/provision_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -284,15 +283,15 @@ func TestProvision(t *testing.T) {
Files: map[string]string{
"main.tf": `a`,
},
ErrorContains: "initialize terraform",
ErrorContains: "plan terraform",
ExpectLogContains: "Argument or block definition required",
},
{
Name: "bad-syntax-2",
Files: map[string]string{
"main.tf": `;asdf;`,
},
ErrorContains: "initialize terraform",
ErrorContains: "plan terraform",
ExpectLogContains: `The ";" character is not valid.`,
},
{
Expand Down
12 changes: 8 additions & 4 deletions scripts/Dockerfile.base
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -11,9 +11,13 @@ 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 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-r0 && \
addgroup \
-g 1000 \
coder && \
Expand Down