@@ -11,12 +11,18 @@ resource "aws_subnet" "subnet_a" {
1111 vpc_id = aws_vpc. vpc . id
1212 cidr_block = " 10.0.1.0/24"
1313 availability_zone = " ${ var . region } a"
14+ tags = {
15+ Private = true
16+ }
1417}
1518
1619resource "aws_subnet" "subnet_b" {
1720 vpc_id = aws_vpc. vpc . id
1821 cidr_block = " 10.0.2.0/24"
1922 availability_zone = " ${ var . region } b"
23+ tags = {
24+ Private = true
25+ }
2026}
2127
2228resource "aws_route_table" "private" {
@@ -36,45 +42,43 @@ resource "aws_subnet" "public_subnet" {
3642 vpc_id = aws_vpc. vpc . id
3743 cidr_block = " 10.0.3.0/24"
3844 availability_zone = " ${ var . region } a"
45+ tags = {
46+ Private = false
47+ }
3948}
4049
41- resource "aws_internet_gateway" "internet_gateway" {
42- count = local. shared_egress_infrastructure_count
50+ resource "aws_internet_gateway" "this" {
4351 vpc_id = aws_vpc. vpc . id
4452 tags = {
4553 Name = " data-replication-igw-${ var . environment } "
4654 }
4755}
4856
49- resource "aws_eip" "nat_ip" {
50- count = local. shared_egress_infrastructure_count
57+ resource "aws_eip" "this" {
5158 domain = " vpc"
52- depends_on = [aws_internet_gateway . internet_gateway ]
59+ depends_on = [aws_internet_gateway . this ]
5360}
5461
55- resource "aws_nat_gateway" "nat_gateway" {
56- count = local. shared_egress_infrastructure_count
62+ resource "aws_nat_gateway" "this" {
5763 subnet_id = aws_subnet. public_subnet . id
58- allocation_id = aws_eip. nat_ip [ 0 ] . id
64+ allocation_id = aws_eip. this . id
5965 connectivity_type = " public"
60- depends_on = [aws_internet_gateway . internet_gateway ]
66+ depends_on = [aws_internet_gateway . this ]
6167 tags = {
6268 Name = " data-replication-nat-gateway-${ var . environment } "
6369 }
6470}
6571
6672resource "aws_route" "private_to_public" {
67- count = length (var. allowed_egress_cidr_blocks )
6873 route_table_id = aws_route_table. private . id
69- destination_cidr_block = var . allowed_egress_cidr_blocks [ count . index ]
70- nat_gateway_id = aws_nat_gateway . nat_gateway [ 0 ] . id
74+ nat_gateway_id = aws_nat_gateway . this . id
75+ destination_cidr_block = " 0.0.0.0/0 "
7176}
7277
7378resource "aws_route" "public_to_igw" {
74- count = length (var. allowed_egress_cidr_blocks )
7579 route_table_id = aws_route_table. public . id
76- destination_cidr_block = var . allowed_egress_cidr_blocks [ count . index ]
77- gateway_id = aws_internet_gateway . internet_gateway [ 0 ] . id
80+ gateway_id = aws_internet_gateway . this . id
81+ destination_cidr_block = " 0.0.0.0/0 "
7882}
7983
8084resource "aws_route_table" "public" {
0 commit comments