【发布时间】:2021-06-03 06:16:03
【问题描述】:
我在资源块中有以下 sn-p,
...
condition {
dynamic "http_header" {
for_each = var.http_headers
content {
http_header_name = http_header.value.header_name[0]
values = [http_header.value.values[0]]
}
}
}
...
变量当前设置为:
variable "http_headers" {
type = map
default = {}
}
我想提供一个地图并让 Terraform 在内容块内为它们设置值,例如
http_headers = {
header_name = "foo"
values = "bar"
}
我认为这可以根据我到目前为止所做的阅读工作,但我收到类似于以下内容的错误。
Error: Unsupported attribute
on .terraform/main.tf line 138, in resource "aws_alb_listener_rule" "listener_rule":
138: values = [http_header.value.values[0]]
|----------------
| http_header.value is "foo"
This value does not have any attributes.
FWIW 如果我将http_headers 变量包装在一个列表中并对其进行迭代,我已经能够使其工作,但我想简化配置以仅使用单个映射。这可能吗?
【问题讨论】:
标签: terraform terraform-provider-aws terraform0.12+