11. Meta-Arguments
depends_on
count
for_each
locals {
subnet_ids = toset([
"subnet-123",
"subnet-456",
])
}
resource "aws_instance" "server" {
for_each = local.subnet_ids
ami = "aaa1"
instance_type = "t2.micro"
subnet_id = each.key
tags = {
Name = "Server ${each.key}"
}
}lifecycle
Last updated