Home > Back-end >  AWS subnet’s using terraform
AWS subnet’s using terraform

Time:08-08

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?

CodePudding user response:

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
  • Related