Skip to content

Commit

Permalink
added route for DHL OCSP endpoint (#311)
Browse files Browse the repository at this point in the history
  • Loading branch information
juddin927 authored Aug 29, 2024
1 parent 0423267 commit 1483240
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ env:
TF_VAR_enable_rds_servers_bastion: "/moj-network-access-control/$ENV/enable_rds_servers_bastion"
TF_VAR_ocsp_dep_ip: "/moj-network-access-control/$ENV/ocsp_dep_ip"
TF_VAR_ocsp_prs_ip: "/moj-network-access-control/$ENV/ocsp_prs_ip"
TF_VAR_ocsp_dhl_ip: "/moj-network-access-control/$ENV/ocsp_dhl_ip"

phases:
install:
Expand Down
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ module "radius_vpc" {
ssm_session_manager_endpoints = var.enable_rds_servers_bastion
ocsp_dep_ip = var.ocsp_dep_ip
ocsp_prs_ip = var.ocsp_prs_ip
ocsp_dhl_ip = var.ocsp_dhl_ip

providers = {
aws = aws.env
Expand Down
12 changes: 12 additions & 0 deletions modules/vpc/routes.tf
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,18 @@ resource "aws_route" "nat-gateway-public-ocsp-endpoint-2" {
]
}

resource "aws_route" "nat-gateway-public-ocsp-endpoint-3" {
count = length(module.vpc.public_route_table_ids)

route_table_id = split("_", local.public_table_id)[count.index]
destination_cidr_block = "${var.ocsp_dhl_ip}/32"
nat_gateway_id = aws_nat_gateway.eu_west_2c.id

depends_on = [
module.vpc
]
}

resource "aws_nat_gateway" "eu_west_2c" {
allocation_id = aws_eip.nat_eu_west_2c.id
subnet_id = element(module.vpc.private_subnets, 2)
Expand Down
4 changes: 4 additions & 0 deletions modules/vpc/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,7 @@ variable "ocsp_dep_ip" {
variable "ocsp_prs_ip" {
type = string
}

variable "ocsp_dhl_ip" {
type = string
}
2 changes: 2 additions & 0 deletions scripts/aws_ssm_get_parameters.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export PARAM4=$(aws ssm get-parameters --region eu-west-2 --with-decryption --na
"/moj-network-access-control/$ENV/enable_rds_servers_bastion" \
"/moj-network-access-control/$ENV/ocsp_dep_ip" \
"/moj-network-access-control/$ENV/ocsp_prs_ip" \
"/moj-network-access-control/$ENV/ocsp_dhl_ip" \
--query Parameters)

declare -A parameters
Expand Down Expand Up @@ -84,3 +85,4 @@ parameters["enable_rds_servers_bastion"]="$(echo $PARAM4 | jq '.[] | select(.Nam
parameters["enable_rds_admin_bastion"]="$(echo $PARAM4 | jq '.[] | select(.Name | test("enable_rds_admin_bastion")) | .Value' --raw-output)"
parameters["ocsp_dep_ip"]="$(echo $PARAM4 | jq '.[] | select(.Name | test("ocsp_dep_ip")) | .Value' --raw-output)"
parameters["ocsp_prs_ip"]="$(echo $PARAM4 | jq '.[] | select(.Name | test("ocsp_prs_ip")) | .Value' --raw-output)"
parameters["ocsp_dhl_ip"]="$(echo $PARAM4 | jq '.[] | select(.Name | test("ocsp_dhl_ip")) | .Value' --raw-output)"
4 changes: 4 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,7 @@ variable "allowed_ips" {
variable "ocsp_prs_ip" {
type = string
}

variable "ocsp_dhl_ip" {
type = string
}

0 comments on commit 1483240

Please sign in to comment.