我已升级到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.
这些消息有数百种。有没有一种自动的方法来修复它们?
最佳答案
您是否先升级了代码?
Terraform 0.11与0.12不兼容,因此您必须先对其进行升级。
terraform init
terraform 0.12upgrade
如果您的Terraform代码正在调用其他terraform模块,请确保也将这些terraform模块也升级到0.12。
关于terraform - 修复Terraform中的 “Interpolation-only expressions are deprecated”警告,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/59038537/