Created
August 28, 2023 14:19
-
-
Save pmatsinopoulos/e3c6607b8dabbec05f0fa7a95027345e to your computer and use it in GitHub Desktop.
AWS Private and Public Subnets - nat_gateway.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_eip" "nat_gateway" { | |
depends_on = [aws_internet_gateway.private_and_public_subnets] | |
} | |
resource "aws_nat_gateway" "private_and_public_subnets" { | |
connectivity_type = "public" | |
allocation_id = aws_eip.nat_gateway.id | |
subnet_id = aws_subnet.subnet_2.id # public subnet | |
tags = { | |
Name = local.project | |
} | |
# To ensure proper ordering, it is recommended to add an explicit dependency | |
# on the Internet Gateway for the VPC. | |
depends_on = [aws_internet_gateway.private_and_public_subnets] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment