【发布时间】:2021-06-12 09:43:21
【问题描述】:
我正在运行带有非默认 terraform 工作区的 terraform v0.14.8。
我有一个处理我的计划和申请的亚特兰蒂斯服务器。
当我在本地克隆我的 repo 并运行我的计划时,我收到关于我的数据源的错误。我不太明白为什么在我相信执行相同操作的亚特兰蒂斯服务器上没有收到这些错误。 Atlantis 服务器也使用 tf v0.14.8。
我的地形:
data "terraform_remote_state" "route53" {
backend = "s3"
config = {
key = "web/terraform.tfstate"
region = "us-west-2"
bucket = "prod-terraform"
role_arn = "arn:aws:iam::xxxxxxxxxx:role/atlantis"
}
在我运行本地计划之前,我会切换工作区
terraform workspace select web
# in addition I also tried
export TF_WORKSPACE=web
我的计划
teraform plan
...
Error: Unable to find remote state
on provider.tf line 46, in data "terraform_remote_state" "route53":
46: data "terraform_remote_state" "route53" {
No stored state was found for the given workspace in the given backend.
我可以使用 env: 轻松编辑我的“密钥”,并且一切正常,但我正试图弄清楚如何在不进行调整的情况下执行此操作,因为我的亚特兰蒂斯服务器正常工作。
data "terraform_remote_state" "route53" {
backend = "s3"
config = {
key = "env:/web/web/terraform.tfstate"
region = "us-west-2"
bucket = "prod-terraform"
role_arn = "arn:aws:iam::xxxxxxxxxx:role/atlantis"
}
【问题讨论】:
-
该错误消息暗示您在该服务器上的用户没有您的后端的访问/身份验证/授权等。
-
我相信这是因为它正在查找的位置没有状态文件。它不在 env:/web/web/terraform.tfstate 中查找。
标签: terraform