Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vpce for different services #7

Merged
merged 12 commits into from
Sep 25, 2024
81 changes: 81 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,87 @@ resource "aws_vpc_endpoint" "ssm" {
)
}

resource "aws_vpc_endpoint" "secretsmanager" {
vpc_id = aws_vpc.default.id
service_name = "com.amazonaws.${var.region}.secretsmanager"
vpc_endpoint_type = "Interface"

security_group_ids = [
aws_security_group.vpc_endpoint.id
]

subnet_ids = aws_subnet.private.*.id
private_dns_enabled = true

tags = merge(
{
Name = "${var.name}-endpointSecretsManager"
},
var.tags
)
}

resource "aws_vpc_endpoint" "cloudwatch" {
vpc_id = aws_vpc.default.id
service_name = "com.amazonaws.${var.region}.monitoring"
vpc_endpoint_type = "Interface"

security_group_ids = [
aws_security_group.vpc_endpoint.id
]

subnet_ids = aws_subnet.private.*.id
private_dns_enabled = true

tags = merge(
{
Name = "${var.name}-endpointCloudWatch"
},
var.tags
)
}

resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.default.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"

security_group_ids = [
aws_security_group.vpc_endpoint.id
]

subnet_ids = aws_subnet.private.*.id
private_dns_enabled = true

tags = merge(
{
Name = "${var.name}-endpointECR_API"
},
var.tags
)
}


resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.default.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"

security_group_ids = [
aws_security_group.vpc_endpoint.id
]

subnet_ids = aws_subnet.private.*.id
private_dns_enabled = true

tags = merge(
{
Name = "${var.name}-endpointECR_DKR"
},
var.tags
)
}

resource "aws_vpc_endpoint" "ssmmessages" {
vpc_id = aws_vpc.default.id
service_name = "com.amazonaws.${var.region}.ssmmessages"
Expand Down
8 changes: 8 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,11 @@ output "nat_gateway_ips" {
value = [aws_eip.nat.*.public_ip]
description = "Public IP addresses of the VPC NAT gateways."
}

output "route_table_public" {
value = [aws_route_table.public.id]
}

output "route_table_private" {
value = [aws_route_table.private.*.id]
}
Loading