gpt4 book ai didi

Terraform:无法安装提供程序,与依赖锁定文件中的校验和不匹配

转载 作者:行者123 更新时间:2023-12-04 12:09:36 25 4
gpt4 key购买 nike

我使用 CI 系统编译 terraform 提供程序并将它们捆绑到一个图像中,但是每次运行 terraform init 时,我都会收到以下错误/失败。

│ Error: Failed to install provider

│ Error while installing rancher/rancher2 v1.13.0: the current package for
│ registry.terraform.io/rancher/rancher2 1.13.0 doesn't match any of the
│ checksums previously recorded in the dependency lock file
对于我的提供程序文件中列出的所有提供程序,此消息重复出现,如下所示:
terraform {
required_version = ">= 0.13"

required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "2.55.0"
}
github = {
source = "integrations/github"
version = "4.8.0"
}
}
...snip...
}
terraform hcl 锁定文件存储在 repo 中,只有当 repo 中存在锁定文件时才会出现这些错误并且 terraform init 失败。可能是什么原因?

最佳答案

问题是我的本地工作站是使用 darwin 平台的 Mac,因此所有提供程序都为 darwin 下载,哈希值存储在该平台的锁定文件中。当在 Linux 上运行的 CI 系统运行时,它会尝试检索锁文件中列出的提供程序,但校验和不匹配,因为它们使用不同的平台。
解决方法是在本地使用以下命令生成一个新的terraform依赖锁文件,其中包含所有平台的terraform,然后运行在不同平台上的其他系统将能够服从该依赖锁文件。

terraform providers lock -platform=windows_amd64 -platform=darwin_amd64 -platform=linux_amd64

关于Terraform:无法安装提供程序,与依赖锁定文件中的校验和不匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67204811/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com