Terraform 输出被标记为敏感

Sta*_*zer 3 terraform terraform-enterprise terraform-cloud

我们为不同的领域创建了一些 terraform 堆栈,例如用于 vpc 的网络堆栈、用于 rds 内容的 rds 堆栈等。

\n

例如,rds 堆栈依赖于网络堆栈从输出中获取值:

\n

网络堆栈的输出:

\n
output "public_subnets" {\n  value = aws_subnet.public.*.id\n}\n\noutput "private_subnets" {\n  value = aws_subnet.private.*.id\n}\n\noutput "data_subnets" {\n  value = aws_subnet.data.*.id\n}\n\n... an so on\n
Run Code Online (Sandbox Code Playgroud)\n

rds 堆栈将点击输出

\n
data "tfe_outputs" "networking" {\n  organization = "my-tf-cloud-org"\n  workspace    = "network-production-eucentral1"\n}\n
Run Code Online (Sandbox Code Playgroud)\n

但是当我尝试使用输出时:

\n
\xe2\x94\x82\n\xe2\x94\x82   on main.tf line 20, in module "db":\n\xe2\x94\x82   20:   base_domain = data.tfe_outputs.dns.values.fqdn\n\xe2\x94\x82     \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\n\xe2\x94\x82     \xe2\x94\x82 data.tfe_outputs.dns.values has a sensitive value\n\xe2\x94\x82\n\xe2\x94\x82 This object does not have an attribute named "fqdn".\n\xe2\x95\xb5\n\xe2\x95\xb7\n\xe2\x94\x82 Error: Unsupported attribute\n\xe2\x94\x82\n\xe2\x94\x82   on main.tf line 22, in module "db":\n\xe2\x94\x82   22:   subnets     = data.tfe_outputs.networking.values.data_subnets\n\xe2\x94\x82     \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\n\xe2\x94\x82     \xe2\x94\x82 data.tfe_outputs.networking.values has a sensitive value\n\xe2\x94\x82\n\xe2\x94\x82 This object does not have an attribute named "data_subnets".\n\xe2\x95\xb5\n\xe2\x95\xb7\n\xe2\x94\x82 Error: Unsupported attribute\n\xe2\x94\x82\n\xe2\x94\x82   on main.tf line 23, in module "db":\n\xe2\x94\x82   23:   vpc_id      = data.tfe_outputs.networking.values.vpc_id\n\xe2\x94\x82     \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\n\xe2\x94\x82     \xe2\x94\x82 data.tfe_outputs.networking.values has a sensitive value\n\xe2\x94\x82\n\xe2\x94\x82 This object does not have an attribute named "vpc_id".\n
Run Code Online (Sandbox Code Playgroud)\n

这之前是有效的;它突然开始了。

\n

我尝试添加nonsensitive演员阵容,但不起作用。

\n

任何想法?

\n

Rod*_*mpo 5

更新:

我设法解决这个问题。我正在使用具有远程状态的 Terraform Cloud。如果您转到 tf cloud 中的workspace_with_the_output常规设置,您将找到一个名为“远程状态共享”的选项。

我在该列表中添加了我的workspace_which_consume_state,现在它正在工作。希望这有帮助