diff --git a/README.md b/README.md index 40d2524..e499e61 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Terraform module to create NAT instance. The module provides: * NAT instance security group with rules allowed 443 port by default -* VPC S3/ECR/CloudWatch Logs endpoints to avoid passing internal traffic through NAT +* VPC S3/ECR Logs endpoints to avoid passing internal traffic through NAT ## Usage diff --git a/s3_endpoint.tf b/endpoints.tf similarity index 66% rename from s3_endpoint.tf rename to endpoints.tf index b0f033c..07691bf 100644 --- a/s3_endpoint.tf +++ b/endpoints.tf @@ -9,16 +9,9 @@ resource "aws_vpc_endpoint" "s3" { resource "aws_vpc_endpoint" "ecr" { vpc_id = local.vpc_id service_name = "com.amazonaws.${data.aws_region.current.name}.ecr.dkr" + vpc_endpoint_type = "Interface" private_dns_enabled = true auto_accept = true route_table_ids = [aws_route_table.nat.id] tags = local.tags } - -resource "aws_vpc_endpoint" "logs" { - vpc_id = local.vpc_id - service_name = "com.amazonaws.${data.aws_region.current.name}.logs" - auto_accept = true - route_table_ids = [aws_route_table.nat.id] - tags = local.tags -} diff --git a/launch_template.tf b/launch_template.tf index 4aedb95..95f753d 100644 --- a/launch_template.tf +++ b/launch_template.tf @@ -1,5 +1,5 @@ resource "aws_network_interface" "nat" { - subnet_id = local.public_subnet_ids[0] + subnet_id = local.public_subnet_id source_dest_check = false security_groups = [aws_security_group.nat.id] tags = local.tags diff --git a/variables.tf b/variables.tf index 82d2702..34414b1 100644 --- a/variables.tf +++ b/variables.tf @@ -28,7 +28,7 @@ data "aws_ami" "nat" { } } data "aws_subnet" "nat" { - id = local.public_subnet_ids[0] + id = local.public_subnet_id } data "aws_region" "current" {} @@ -36,7 +36,7 @@ locals { name = var.name vpc_id = data.aws_subnet.nat.vpc_id instance_type = var.instance_type - public_subnet_ids = [var.public_subnet_id] + public_subnet_id = var.public_subnet_id private_subnet_cidrs = var.private_subnet_cidrs az = data.aws_subnet.nat.availability_zone ports = var.ports