-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Closed
Labels
enhancementnewnew issue not yet triagednew issue not yet triagedunknown-valuesIssues related to Terraform's treatment of unknown valuesIssues related to Terraform's treatment of unknown values
Description
Current Terraform Version
Terraform v1.1.9
on darwin_amd64
Use-cases
Given a list of items, e.g. subnet IDs, I want to create a corresponding list of resources, e.g. route tables. Since the subnet IDs will not be known at plan time, this will not work:
resource "aws_route_table_association" "public" {
for_each = var.subnet_ids
OK, I understand, the key values are unknown, so then I switch to
resource "aws_route_table_association" "public" {
count = length(var.subnet_ids)
which works, but now every time the order of the list of subnets changes (which may be generated by an API beyond my control), all the route table associations change. I want to keep the associations consistent as long as the set of subnet IDs remains the same (which is what I was attempting with for_each
), so I try sorting the list:
resource "aws_route_table_association" "public" {
count = length(sort(var.subnet_ids))
Unfortunately, this breaks, too.
Proposal
It appears that at present, sort
returns a list of unknown length. It should return a list of known length of unknown values.
References
Metadata
Metadata
Assignees
Labels
enhancementnewnew issue not yet triagednew issue not yet triagedunknown-valuesIssues related to Terraform's treatment of unknown valuesIssues related to Terraform's treatment of unknown values