Skip to content

Commit d3be117

Browse files
committed
VED-26: Add HTTPS outbound rule to SG.
1 parent f5291f8 commit d3be117

File tree

2 files changed

+35
-12
lines changed

2 files changed

+35
-12
lines changed

infra/endpoints.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@ resource "aws_security_group" "lambda_redis_sg" {
3737
protocol = "-1"
3838
self = true
3939
}
40+
41+
egress {
42+
description = "HTTPS outbound for PDS callout"
43+
cidr_blocks = ["0.0.0.0/0"]
44+
from_port = 443
45+
to_port = 443
46+
protocol = "tcp"
47+
self = false
48+
}
4049
}
4150

4251
resource "aws_vpc_endpoint" "sqs_endpoint" {

infra/networking.tf

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ resource "aws_vpc" "default" {
4040
}
4141

4242
resource "aws_subnet" "public" {
43-
for_each = { for idx, subnet in local.public_subnet_config : idx => subnet }
43+
for_each = { for idx, subnet in local.public_subnet_config : idx => subnet }
4444

4545
vpc_id = aws_vpc.default.id
4646
cidr_block = each.value.cidr_block
@@ -63,7 +63,7 @@ resource "aws_route_table" "public" {
6363
}
6464

6565
resource "aws_route_table_association" "public_subnets" {
66-
for_each = aws_subnet.public
66+
for_each = aws_subnet.public
6767

6868
subnet_id = each.value.id
6969
route_table_id = aws_route_table.public.id
@@ -76,22 +76,22 @@ resource "aws_route" "igw" {
7676
}
7777

7878
resource "aws_subnet" "private" {
79-
for_each = { for idx, subnet in local.private_subnet_config : idx => subnet }
79+
for_each = { for idx, subnet in local.private_subnet_config : idx => subnet }
8080

81-
vpc_id = aws_vpc.default.id
82-
cidr_block = each.value.cidr_block
83-
availability_zone = each.value.availability_zone
81+
vpc_id = aws_vpc.default.id
82+
cidr_block = each.value.cidr_block
83+
availability_zone = each.value.availability_zone
8484
}
8585

8686
resource "aws_eip" "nat" {
87-
domain = "vpc"
87+
domain = "vpc"
8888

89-
depends_on = [aws_internet_gateway.default]
89+
depends_on = [aws_internet_gateway.default]
9090
}
9191

9292
resource "aws_nat_gateway" "default" {
93-
allocation_id = aws_eip.nat.id
94-
subnet_id = aws_subnet.public[0].id
93+
allocation_id = aws_eip.nat.id
94+
subnet_id = aws_subnet.public[0].id
9595
}
9696

9797
resource "aws_route_table" "private" {
@@ -102,7 +102,7 @@ resource "aws_route_table" "private" {
102102
}
103103

104104
resource "aws_route_table_association" "private_subnets" {
105-
for_each = aws_subnet.private
105+
for_each = aws_subnet.private
106106

107107
subnet_id = each.value.id
108108
route_table_id = aws_route_table.private.id
@@ -111,7 +111,7 @@ resource "aws_route_table_association" "private_subnets" {
111111
resource "aws_route" "nat" {
112112
route_table_id = aws_route_table.private.id
113113
destination_cidr_block = "0.0.0.0/0"
114-
nat_gateway_id = aws_nat_gateway.default.id
114+
nat_gateway_id = aws_nat_gateway.default.id
115115
}
116116

117117
resource "aws_route53_zone" "parent_hosted_zone" {
@@ -129,3 +129,17 @@ resource "aws_route53_record" "imms_ns" {
129129
ttl = 172800
130130
records = [for ns in aws_route53_zone.child_hosted_zone.name_servers : "${ns}."]
131131
}
132+
133+
# TODO - remove once state has been updated
134+
moved {
135+
from = aws_subnet.default_subnets
136+
to = aws_subnet.public
137+
}
138+
moved {
139+
from = aws_route_table.default
140+
to = aws_route_table.public
141+
}
142+
moved {
143+
from = aws_route.igw_route
144+
to = aws_route.igw
145+
}

0 commit comments

Comments
 (0)