Skip to content

Commit

Permalink
fix: Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sugdyzhekov committed Nov 26, 2020
1 parent e3795ba commit ab55dc7
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 1 addition & 8 deletions s3_endpoint.tf → endpoints.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion launch_template.tf
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ data "aws_ami" "nat" {
}
}
data "aws_subnet" "nat" {
id = local.public_subnet_ids[0]
id = local.public_subnet_id
}
data "aws_region" "current" {}

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
Expand Down

0 comments on commit ab55dc7

Please sign in to comment.