Difference between revisions of "Each."

From wikieduonline
Jump to navigation Jump to search
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{lc}}
 
{{lc}}
  
  data "aws_subnets" "all_db" {
+
  [[data]] "aws_subnets" "all_db" {
 
   filter {
 
   filter {
 
     name  = "vpc-id"
 
     name  = "vpc-id"
 
     values = [var.vpc_id]
 
     values = [var.vpc_id]
 
   }
 
   }
 
+
 
   tags = {
 
   tags = {
 
     Tier = "DB"
 
     Tier = "DB"
 
   }
 
   }
 
  }  
 
  }  
 
+
 
  data "aws_subnet" "all_db" {
 
  data "aws_subnet" "all_db" {
   for_each = toset(data.aws_subnets.all_db.ids)
+
   [[for_each]] = toset(data.aws_subnets.all_db.ids)
 
   id      = each.value
 
   id      = each.value
 
  }
 
  }
 +
  
 
  data "aws_subnets" "all_app" {
 
  data "aws_subnets" "all_app" {
Line 22: Line 23:
 
     values = [var.vpc_id]
 
     values = [var.vpc_id]
 
   }
 
   }
 
+
   tags = {
+
   [[tags]] = {
 
     Tier = "WebApp"
 
     Tier = "WebApp"
 
   }
 
   }
 
  }
 
  }
 
+
 
  data "aws_subnet" "all_app" {
 
  data "aws_subnet" "all_app" {
 
   for_each = toset(data.aws_subnets.all_app.ids)
 
   for_each = toset(data.aws_subnets.all_app.ids)
Line 33: Line 34:
 
  }
 
  }
  
 +
== See also ==
 +
* {{data.}}
 +
* {{for_each}}
  
 
+
[[Category:Data]]
 
 
* {{data.}}
 

Latest revision as of 14:15, 18 July 2024

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[edit]

Advertising: