Skip to content

Commit

Permalink
Merge pull request #124 from minamijoyo/tf-1.4
Browse files Browse the repository at this point in the history
Add support for Terraform v1.4
  • Loading branch information
minamijoyo authored Mar 9, 2023
2 parents e070b20 + e34b939 commit bd115e2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@ jobs:
fail-fast: false
matrix:
terraform:
- 1.3.8
- 1.4.0
- 1.3.9
- 1.2.9
- 1.1.9
- 1.0.11
- 0.12.31
env:
TERRAFORM_VERSION: ${{ matrix.terraform }}
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ services:
# Use the same filesystem to avoid a checksum mismatch error
# or a file busy error caused by asynchronous IO.
TF_PLUGIN_CACHE_DIR: "/tmp/plugin-cache"
TF_PLUGIN_CACHE_MAY_BREAK_DEPENDENCY_LOCK_FILE: "true"
# From observation, although we don’t have complete confidence in the root cause,
# it appears that localstack sometimes misses API requests when run in parallel.
TF_CLI_ARGS_apply: "--parallelism=1"
Expand Down
21 changes: 21 additions & 0 deletions scripts/testacc/generate_plugin_cache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,27 @@ terraform {
}
EOF

# Starting with Terraform v1.4, the global plugin cache is ignored on the first
# terraform init. This makes caching in CI meaningless. To utilize the cache,
# we use a local filesystem mirror. Strictly speaking, the mirror is only
# available in Terraform v0.13+, but it is hard to compare versions in bash,
# so we use the mirror unless v0.x.
# https://developer.hashicorp.com/terraform/cli/config/config-file#implied-local-mirror-directories
if terraform -v | grep 'Terraform v0\.'; then
echo "skip creating an implied local mirror"
else
FS_MIRROR="/tmp/plugin-mirror"
terraform providers mirror "${FS_MIRROR}"

cat << EOF > "$HOME/.terraformrc"
provider_installation {
filesystem_mirror {
path = "/tmp/plugin-mirror"
}
}
EOF
fi

terraform init -input=false -no-color

popd
Expand Down

0 comments on commit bd115e2

Please sign in to comment.