Skip to content

Commit

Permalink
Merge pull request #50 from DNXLabs/feature/igw_attachment
Browse files Browse the repository at this point in the history
Feature/igw attachment
  • Loading branch information
caiovfernandes authored May 12, 2024
2 parents 49b281f + a8bf9da commit f0e0736
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,10 @@ module "network" {

## Requirements

For releases <= `1.8.5`

| Name | Version |
|------|---------|
| terraform | >= 0.14.0 |

For releases > `1.8.5`

| Name | Version |
|------|---------|
| terraform | >= 1.3.0 |
| terraform | >= 0.14.0 |

## Providers

Expand All @@ -64,6 +57,7 @@ For releases > `1.8.5`

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| attachInternetGateway | To attach or not the internet gateway within the public subnet. | `boolean` | `true` | no |
| byoip | Enable module to use your own Elastic IPs (Bring Your Own IP) | `bool` | `false` | no |
| cf\_export\_name | Name prefix for the export resources of the cloud formation output | `string` | `""` | no |
| eip\_allocation\_ids | User-specified primary or secondary private IP address to associate with the Elastic IP address | `list(string)` | `[]` | no |
Expand Down
8 changes: 7 additions & 1 deletion _variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -323,4 +323,10 @@ variable "kms_key_arn" {
type = string
default = ""
description = "The ARN of the KMS Key to use when encrypting log data."
}
}

variable "attachInternetGateway" {
type = boolean
default = true
description = "To attach or not the internet gateway within the public subnet."
}
4 changes: 2 additions & 2 deletions subnet-public.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ resource "aws_route_table" "public" {
resource "aws_route" "public_internet_route" {
route_table_id = aws_route_table.public.id
destination_cidr_block = "0.0.0.0/0"
gateway_id = var.network_firewall ? null : aws_internet_gateway.default.id
gateway_id = var.network_firewall ? null : (var.attachInternetGateway ? aws_internet_gateway.default.id : null)
vpc_endpoint_id = var.network_firewall ? (aws_networkfirewall_firewall.default[0].firewall_status[0].sync_states[*].attachment[0].endpoint_id)[0] : null

lifecycle {
Expand Down Expand Up @@ -68,4 +68,4 @@ resource "aws_vpc_endpoint_route_table_association" "dynamodb_public" {
count = var.vpc_endpoint_dynamodb_gateway ? 1 : 0
route_table_id = aws_route_table.public.id
vpc_endpoint_id = aws_vpc_endpoint.dynamodb[0].id
}
}

0 comments on commit f0e0736

Please sign in to comment.