From ab55dc7666010f08908a89d8016e717b741b0895 Mon Sep 17 00:00:00 2001 From: Sergei Ugdyzhekov Date: Thu, 26 Nov 2020 19:16:20 +0100 Subject: [PATCH] fix: Minor fixes --- README.md | 2 +- s3_endpoint.tf => endpoints.tf | 9 +-------- launch_template.tf | 2 +- variables.tf | 4 ++-- 4 files changed, 5 insertions(+), 12 deletions(-) rename s3_endpoint.tf => endpoints.tf (66%) 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