Skip to content

Commit 41e7216

Browse files
authored
chore: upgrade terraform to 1.5.1 (coder#8160)
1 parent 8e2422d commit 41e7216

File tree

4 files changed

+19
-11
lines changed

4 files changed

+19
-11
lines changed

.github/workflows/ci.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ jobs:
231231

232232
- uses: hashicorp/setup-terraform@v2
233233
with:
234-
terraform_version: 1.1.9
234+
terraform_version: 1.5.1
235235
terraform_wrapper: false
236236

237237
- name: Test with Mock Database
@@ -296,7 +296,7 @@ jobs:
296296

297297
- uses: hashicorp/setup-terraform@v2
298298
with:
299-
terraform_version: 1.1.9
299+
terraform_version: 1.5.1
300300
terraform_wrapper: false
301301

302302
- name: Test with PostgreSQL Database
@@ -338,6 +338,11 @@ jobs:
338338

339339
- uses: ./.github/actions/setup-go
340340

341+
- uses: hashicorp/setup-terraform@v2
342+
with:
343+
terraform_version: 1.5.1
344+
terraform_wrapper: false
345+
341346
- name: Run Tests
342347
run: |
343348
gotestsum --junitfile="gotests.xml" -- -race ./...
@@ -474,7 +479,7 @@ jobs:
474479

475480
- uses: hashicorp/setup-terraform@v2
476481
with:
477-
terraform_version: 1.1.9
482+
terraform_version: 1.5.1
478483
terraform_wrapper: false
479484

480485
- name: Build

provisioner/terraform/install.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ var (
2222
TerraformVersion = version.Must(version.NewVersion("1.4.6"))
2323

2424
minTerraformVersion = version.Must(version.NewVersion("1.1.0"))
25-
maxTerraformVersion = version.Must(version.NewVersion("1.4.9"))
25+
maxTerraformVersion = version.Must(version.NewVersion("1.5.9")) // use .9 to automatically allow patch releases
2626

2727
terraformMinorVersionMismatch = xerrors.New("Terraform binary minor version mismatch.")
2828
)

provisioner/terraform/provision_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020

2121
"cdr.dev/slog"
2222
"cdr.dev/slog/sloggers/slogtest"
23-
2423
"github.com/coder/coder/provisioner/terraform"
2524
"github.com/coder/coder/provisionersdk"
2625
"github.com/coder/coder/provisionersdk/proto"
@@ -284,15 +283,15 @@ func TestProvision(t *testing.T) {
284283
Files: map[string]string{
285284
"main.tf": `a`,
286285
},
287-
ErrorContains: "initialize terraform",
286+
ErrorContains: "plan terraform",
288287
ExpectLogContains: "Argument or block definition required",
289288
},
290289
{
291290
Name: "bad-syntax-2",
292291
Files: map[string]string{
293292
"main.tf": `;asdf;`,
294293
},
295-
ErrorContains: "initialize terraform",
294+
ErrorContains: "plan terraform",
296295
ExpectLogContains: `The ";" character is not valid.`,
297296
},
298297
{

scripts/Dockerfile.base

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This is the base image used for Coder images. It's a multi-arch image that is
22
# built in depot.dev for all supported architectures. Since it's built on real
33
# hardware and not cross-compiled, it can have "RUN" commands.
4-
FROM alpine:3.18
4+
FROM alpine:3.18.2
55

66
# We use a single RUN command to reduce the number of layers in the image.
77
# NOTE: Keep the Terraform version in sync with minTerraformVersion and
@@ -11,9 +11,13 @@ RUN apk add --no-cache \
1111
wget \
1212
bash \
1313
git \
14-
openssl>=3.1.1-r1 \
15-
openssh-client \
16-
terraform=1.4.6-r1 && \
14+
openssh-client && \
15+
# Use the edge repo, since Terraform doesn't seem to be backported to 3.18.
16+
# TODO: remove =~
17+
# For some reason alpine's ARM builders are offline, so ARM builds will have
18+
# to fall back to 1.5.0.
19+
apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community \
20+
terraform=~1.5-r0 && \
1721
addgroup \
1822
-g 1000 \
1923
coder && \

0 commit comments

Comments
 (0)