I have a use case where I have set variable instance_count = 3 and I have 2 Private_subnets which is a list ["subnet-id-A", "subnet-id-B"], what I want my terraform code to dynamically generate a local map or list which can be like this
subnets = {
01 = subnet-id-A
02 = subnet-id-B
03 = subnet-id-A
}
OR
subnets = ["subnet-id-A","subnet-id-B","subnet-id-A"]
If the instance count goes to 4 it can be like this
subnets = {
01 = subnet-id-A
02 = subnet-id-B
03 = subnet-id-A
04 = subnet-id-B
}
OR
subnets = ["subnet-id-A","subnet-id-B","subnet-id-A","subnet-id-B"]
If the instance count goes to 2 it can be like this
subnets = {
01 = subnet-id-A
02 = subnet-id-B
}
OR
subnets = ["subnet-id-A","subnet-id-B"]