choisungwook / terraform-aws-transitgateway

transit gateway 연습
1 stars 0 forks source link

NAT gateay 생성 #1

Open choisungwook opened 2 years ago

choisungwook commented 2 years ago
choisungwook commented 2 years ago

resource "aws_nat_gateway" "main" { for_each = var.create_natgw ? var.private_subnets: {}

allocation_id = aws_eip.nat_eip[each.key].id subnet_id = aws_subnet.private[each.key].id

tags = { Name = "${var.name}-${each.key}-natgw" }

depends_on = [aws_internet_gateway.igw] }



# 참고자료
* https://www.reddit.com/r/Terraform/comments/fh7ma1/terraform_conditional_if_in_for_each/