0

I have a set of subnet’s how do i assign the subnets which are available automatically using terraform? Ex : [“subnet-a”,”subnet-b”,”subnet-c”, “subnet-d”]

I want to pick the two available subnets from given set for module A and module B?

Rocky
  • 29
  • 6

1 Answers1

0

Use random_shuffle:

resource "random_shuffle" "az" {
  input        = [“subnet-a”,”subnet-b”,”subnet-c”]
  result_count = 2
}

then to get the actual result:

random_shuffle.az.result
Marcin
  • 215,873
  • 14
  • 235
  • 294