Closed7
AtlantisでError: Failed to install provider from shared cache
terraform 1.12
hashicorp/aws 3.63.0
atlantis 0.17.6 (Fatgete上で稼働)
atlantis plan
が高確率でError: Failed to install provider from shared cache
のエラーになる。
running "/home/atlantis/.atlantis/bin/terraform1.1.2 init -input=false -no-color" in "/home/atlantis/.atlantis/repos/shonansurvivors/infra/24/default/envs/main/aws/network/main": exit status 1
Initializing modules...
Downloading registry.terraform.io/int128/nat-instance/aws 2.0.0 for nat...
- nat in .terraform/modules/nat
Downloading registry.terraform.io/terraform-aws-modules/vpc/aws 3.11.0 for vpc...
- vpc in .terraform/modules/vpc
Initializing the backend...
Successfully configured the backend "s3"! Terraform will automatically
use this backend unless the backend configuration changes.
Initializing provider plugins...
- Reusing previous version of hashicorp/aws from the dependency lock file
- Using hashicorp/aws v3.63.0 from the shared cache directory
Error: Failed to install provider from shared cache
Error while importing hashicorp/aws v3.63.0 from the shared cache directory:
the provider cache at .terraform/providers has a copy of
registry.terraform.io/hashicorp/aws 3.63.0 that doesn't match any of the
checksums recorded in the dependency lock file.
- Atlantisが動くFargeteのタスク起動
- コミットをpush
- plan正常
- 追加コミットをpush
- planエラー
といった感じ。タスクを入れ替えるとplanは通る。
上を見ると、ワークフローをカスタマイズしてinit
に-upgrade-false
を追加すると良いっぽいが、それでもやはりエラーになる。
多分.terraform.lock.hcl
が影響していると思うので、init
前に削除するようにしたらエラーは起こらなくなったぽい。が、こんな解決策で良いんだろうか?
workflows:
custom:
plan:
steps:
- run: rm -f .terraform.lock.hcl
- init
- plan
これも関係していそう。
ローカルのIntel Mac上でinit
して作られた.terraform.lock.hcl
を、Fargate上で使おうとするからエラーになっている?
こちらの資料でだいぶ理解が進んだ
terraform providers lock -platform=linux_amd64
これを実行することで以下が追記され、atlantisでのplanで事前にrm -f .terraform.lock.hcl
をしなくても、エラーにならなくなった。
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/hashicorp/aws" {
version = "3.71.0"
constraints = ">= 3.63.0, 3.71.0"
hashes = [
"h1:5+M8SPZlb3FxcmAX4RykKzNrTHkpjoP1UpHcenOXcxo=",
+ "h1:wnTd0krep3mqRz650U7TSv/tCkA0LoXKe0QFlnsg/7Q=",
"zh:173134d8861a33ed60a48942ad2b96b9d06e85c506d7f927bead47a28f4ebdd2",
"zh:2996c8e96930f526f1761e99d14c0b18d83e287b1362aa2fa1444cf848ece613",
"zh:43903da1e0a809a1fb5832e957dbe2321b86630d6bfdd8b47728647a72fd912d",
"zh:43e71fd8924e7f7b56a0b2a82e29edf07c53c2b41ee7bb442a2f1c27e03e86ae",
"zh:4f4c73711f64a3ff85f88bf6b2594e5431d996b7a59041ff6cbc352f069fc122",
"zh:5045241b8695ffbd0730bdcd91393b10ffd0cfbeaad6254036e42ead6687d8fd",
"zh:6a8811a0fb1035c09aebf1f9b15295523a9a7a2627fd783f50c6168a82e192dd",
"zh:8d273c04d7a8c36d4366329adf041c480a0f1be10a7269269c88413300aebdb8",
"zh:b90505897ae4943a74de2b88b6a9e7d97bf6dc325a0222235996580edff28656",
"zh:ea5e422942ac6fc958229d27d4381c89d21d70c5c2c67a6c06ff357bcded76f6",
"zh:f1536d7ff2d3bfd668e3ac33d8956b4f988f87fdfdcc371c7d94b98d5dba53e2",
]
}
このスクラップは2022/01/09にクローズされました