Reputation: 2052
I am in the process of upgrading from tf 11 to tf 12 and I just ran into this issue. This used to work in tf 11 and is now broken in tf 12. Can someone help me figure out the issue?
data "aws_subnet_ids" "private" {
vpc_id = data.aws_ssm_parameter.vpc_id.value
tags = {
tier = "private"
}
}
data "aws_subnet" "private" {
count = length(data.aws_subnet_ids.private.ids)
id = data.aws_subnet_ids.private.ids[count.index]
}
27: id = data.aws_subnet_ids.private.ids[count.index]
|----------------
| count.index is 0
| data.aws_subnet_ids.private.ids is set of string with 3 elements
This value does not have any indices.
Upvotes: 4
Views: 14126
Reputation: 2052
This fixed it
data "aws_subnet" "private" {
for_each = data.aws_subnet_ids.private.ids
id = each.value
}
Upvotes: 7