Skip to content

Commit 10456c2

Browse files
committed
ci: Add caching for terraform initialization.
1 parent 7ac014a commit 10456c2

File tree

4 files changed

+31
-18
lines changed

4 files changed

+31
-18
lines changed

.github/actions/setup-opentofu/action.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ inputs:
88
runs:
99
using: composite
1010
steps:
11+
- name: Cache OpenTofu
12+
uses: actions/cache@v4
13+
with:
14+
path: ./tofu/config/${{ inputs.config }}/.terraform
15+
key: ${{ runner.os }}-tofu-${{ hashFiles('./tofu/config/${{ inputs.config }}/.terraform.lock.hcl') }}
16+
restore-keys: |
17+
${{ runner.os }}-tofu-
1118
- name: Setup OpenTofu
1219
uses: opentofu/setup-opentofu@v1
1320
with:

tofu/config/service/.terraform.lock.hcl

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tofu/modules/ephemeral_service/docker.tf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ resource "docker_image" "container" {
99
"${local.prefix}:${var.image_tag}",
1010
"${module.ecr.repository_url}:${var.image_tag}"
1111
]
12+
13+
auth_config {
14+
host_name = data.aws_ecr_authorization_token.token.proxy_endpoint
15+
password = data.aws_ecr_authorization_token.token.password
16+
user_name = data.aws_ecr_authorization_token.token.user_name
17+
}
1218
}
1319

1420
triggers = {
@@ -28,8 +34,8 @@ resource "docker_registry_image" "container" {
2834

2935
auth_config {
3036
address = data.aws_ecr_authorization_token.token.proxy_endpoint
31-
username = data.aws_ecr_authorization_token.token.user_name
3237
password = data.aws_ecr_authorization_token.token.password
38+
username = data.aws_ecr_authorization_token.token.user_name
3339
}
3440

3541
triggers = {

tofu/modules/ephemeral_service/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ terraform {
99

1010
docker = {
1111
source = "kreuzwerker/docker"
12-
version = "~> 3.6"
12+
version = "~> 3.7"
1313
}
1414
}
1515
}

0 commit comments

Comments
 (0)