terraform - 修复 Terraform 中的 "Interpolation-only expressions are deprecated"警告

标签 terraform

我升级到 Terraform v0.12.16,现在我收到了很多如下所示的消息:

Warning: Interpolation-only expressions are deprecated

  on ../modules/test-notifier/test_notifier.tf line 27, in resource "aws_sns_topic_policy" "default":
  27:   arn    = "${aws_sns_topic.default.arn}"

Terraform 0.11 and earlier required all non-constant expressions to be
provided via interpolation syntax, but this pattern is now deprecated. To
silence this warning, remove the "${ sequence from the start and the }"
sequence from the end of this expression, leaving just the inner expression.

Template interpolation syntax is still used to construct strings from
expressions when the template includes multiple interpolation sequences or a
mixture of literal strings and interpolations. This deprecation applies only
to templates that consist entirely of a single interpolation sequence.

有数百条这样的消息。有没有一种自动化的方法来修复它们?

最佳答案

更新插值如下:

subscription_id = "${var.subscription_id}"
subscription_id = var.subscription_id

关于terraform - 修复 Terraform 中的 "Interpolation-only expressions are deprecated"警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59038537/

相关文章:

amazon-web-services - Terraform没有将Lambda代码zip文件上传到AWS

terraform_remote_state 数据 block 语法

Terraform 自定义提供程序 - 请求用户输入时出错

amazon-web-services - 安全组定义中不允许自引用

azure - 使用访问策略从多个不同的主体/用户获取对 Azure Key Vault 的访问权限

azure - 如何恢复 Terraform 状态文件

terraform - 如果我使用 Terraform 导入 AWS IAM 用户,附加到用户的策略和访问 key 是否也会被导入?

azure - 使用 terraform 创建新的 azure 资源组时出错

amazon-web-services - 为什么terraform不断更新rds集群的参数组?

amazon-web-services - 使用 Terraform 将 EC2 实例的 IP 引用到入站规则