Difference between revisions of "Each."

From wikieduonline
Jump to navigation Jump to search
Line 6: Line 6:
 
     values = [var.vpc_id]
 
     values = [var.vpc_id]
 
   }
 
   }
 
+
 
   tags = {
 
   tags = {
 
     Tier = "DB"
 
     Tier = "DB"
Line 22: Line 22:
 
     values = [var.vpc_id]
 
     values = [var.vpc_id]
 
   }
 
   }
 
+
   tags = {
+
   [[tags]] = {
 
     Tier = "WebApp"
 
     Tier = "WebApp"
 
   }
 
   }
Line 33: Line 33:
 
  }
 
  }
  
 
+
== See also ==
 
 
 
 
 
* {{data.}}
 
* {{data.}}

Revision as of 07:25, 3 April 2023

data "aws_subnets" "all_db" {
 filter {
   name   = "vpc-id"
   values = [var.vpc_id]
 }

 tags = {
   Tier = "DB"
 }
} 
data "aws_subnet" "all_db" {
 for_each = toset(data.aws_subnets.all_db.ids)
 id       = each.value
}
data "aws_subnets" "all_app" {
 filter {
   name   = "vpc-id"
   values = [var.vpc_id]
 }

 tags = {
   Tier = "WebApp"
 }
}
data "aws_subnet" "all_app" {
 for_each = toset(data.aws_subnets.all_app.ids)
 id       = each.value
}

See also

Advertising: