Terraform - 嵌入式引号

标签 terraform

在 Terraform 中我可以使用:

name = "${var.names["apple"])"

var.names 中查找字符串“apple”。

但是,这种语法在大多数编程语言中都会出错,因为它会尝试解析 "${var.names[" 然后 apple 然后 "]) ".

我已经查阅了这方面的文档,但没有找到任何内容。有详细的吗?

我读过:

https://www.terraform.io/docs/configuration/syntax.htmlhttps://www.terraform.io/docs/configuration/interpolation.html

最后一个链接简单举了个例子

  template = "${file("templates/web_init.tpl")}"

但不解释。

最佳答案

Upgrade guide到 v0.7 明确引入了嵌套引用上下文。显然,从早期版本之一开始就允许这样做,但我无法准确指出是哪一个。

关于Terraform - 嵌入式引号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46319192/

相关文章:

macos - terraform手动安装的插件失败

azure - 使用 terraform 创建 Data Lake Storage 表示 datalakestore.Client#GetProperties 即使它具有完全权限

amazon-web-services - 将 AWS S3 地形化为 Lambda 通知触发器

amazon-web-services - 使用 Terraform 的 CloudWatch 指标警报

azure - 传入Shell脚本中分配的变量

terraform:如何使资源具有幂等性-即,如果不存在则创建,但如果存在则不执行任何操作

amazon-web-services - 更新注册表镜像并再次应用服务时,Terraform 不会更新 aws_ecs_service

google-cloud-platform - 使用 terraform 配置 bigquery 数据集

amazon-web-services - 如何使用Terraform在现有VPC中启动EC

yaml - 如何使用 Terraform 访问 yaml 文件中的 map