我有一个用例,我设置了变量 instance_count = 3,我有 2 个 Private_subnets,这是一个列表 ["subnet-id-A", "subnet-id-B"],我希望我的 terraform 代码动态生成可以是这样的本地地图或列表
subnets = {
01 = subnet-id-A
02 = subnet-id-B
03 = subnet-id-A
}
OR
subnets = ["subnet-id-A","subnet-id-B","subnet-id-A"]
如果实例数变为 4,则可能是这样的
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"]
如果实例数变为 2,则可能是这样的
subnets = {
01 = subnet-id-A
02 = subnet-id-B
}
OR
subnets = ["subnet-id-A","subnet-id-B"]