Skip to content

Commit

Permalink
Merge pull request #3531 from alphagov/BC-remove-psn-vpc-endpoint
Browse files Browse the repository at this point in the history
Remove PSN vpn endpoint in production london
  • Loading branch information
malcgds committed Dec 18, 2023
2 parents 2ec80ea + b5bd70c commit 4dfea7c
Showing 1 changed file with 2 additions and 56 deletions.
58 changes: 2 additions & 56 deletions terraform/psn/psn.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,60 +18,6 @@ variable "security_group_name" {
description = "The security group to allow access to the PSN VPC Endpoint."
}

data "aws_security_group" "security_group" {
name = var.security_group_name
}

resource "aws_vpc_endpoint" "psn_service" {
vpc_id = var.vpc_id
service_name = var.vpc_endpoint
vpc_endpoint_type = "Interface"

security_group_ids = [aws_security_group.psn_endpoint.id]

subnet_ids = var.subnet_ids
private_dns_enabled = false
}

resource "aws_security_group" "psn_endpoint" {
name = "psn-endpoint"
description = "The PSN VPC Endpoint"
vpc_id = var.vpc_id
}

resource "aws_security_group_rule" "psn_ingress_from_cells" {
security_group_id = aws_security_group.psn_endpoint.id

type = "ingress"
protocol = "tcp"
from_port = 3128
to_port = 3128

source_security_group_id = data.aws_security_group.security_group.id
}

resource "aws_security_group_rule" "cells_egress_to_psn" {
security_group_id = data.aws_security_group.security_group.id

type = "egress"
protocol = "tcp"
from_port = 3128
to_port = 3128

source_security_group_id = aws_security_group.psn_endpoint.id
}

data "aws_network_interface" "psn_interface" {
for_each = aws_vpc_endpoint.psn_service.network_interface_ids

id = each.value
}

output "psn_security_group_seed_json" {
value = templatefile(
"${path.module}/data/security-group-seed.json.tpl",
{
psn_cidrs = [for interface in data.aws_network_interface.psn_interface : interface.private_ip]
}
)
}
value = "[]"
}

0 comments on commit 4dfea7c

Please sign in to comment.