I want to concatenate two arrays in Terraform 0.12. In my example there are public and private subnets. I want to assign them both to the same network access lists. Following code shortened:
data "aws_subnet_ids" "private" {
vpc_id = aws_vpc.main.id
tags = {
subnet-type = "private"
}
}
data "aws_subnet_ids" "public" {
vpc_id = aws_vpc.main.id
tags = {
subnet-type = "public"
}
}
resource "aws_network_acl" "networks" {
vpc_id = aws_vpc.main.id
subnet_ids = concat(data.aws_subnet_ids.private.ids, data.aws_subnet_ids.public.ids)
[...]
}
If I use the following outputs:
output "private_subnets" {
value = data.aws_subnet_ids.private.ids
}
output "public_subnets" {
value = data.aws_subnet_ids.public.ids
}
The following output is generated:
private_subnets = [
"subnet-243zr427rhhfjseb9",
"subnet-we789rh2438fchb6e",
"subnet-092rz7g82fhhkui74",
]
public_subnets = [
"subnet-12230qegvg764e9d",
"subnet-123465svgvgf0d7e",
]
So everything should work. But the following error is given:
iptizer@machine:~/src/infra$ terraform12 apply
[...]
Error: Invalid function argument
on nacls.tf line 19, in resource "aws_network_acl" "networks":
19: subnet_ids = concat(data.aws_subnet_ids.private.ids, data.aws_subnet_ids.public.ids)
|----------------
| data.aws_subnet_ids.private.ids is set of string with 3 elements
Invalid value for "seqs" parameter: all arguments must be lists or tuples; got
set of string.
Bug.. or what am I missing?