I have the following snippet inside of a resource block,
...
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 is currently set to:
variable "http_headers" {
type = map
default = {}
}
I'd like to provide a single map and have Terraform set the values for them inside the content block, e.g.
http_headers = {
header_name = "foo"
values = "bar"
}
I thought this would work based on reading I've done so far, but I am getting errors similar to the following.
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 I have been able to get this working if I wrap the http_headers
variable in a list and iterate over that instead but I would like to simplify the configuration to only use a single map. Is this possible?