Skip to content

Commit

Permalink
Merge pull request #3 from headout/ft-existing-vpc
Browse files Browse the repository at this point in the history
Adding gateway id values
  • Loading branch information
joelkbiju12 authored Nov 19, 2023
2 parents d1ca502 + 97691df commit fcdc24a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 4 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ locals {
len_intra_subnets = max(length(var.intra_subnets), length(var.intra_subnet_ipv6_prefixes))
len_outpost_subnets = max(length(var.outpost_subnets), length(var.outpost_subnet_ipv6_prefixes))


max_subnet_length = max(
local.len_private_subnets,
local.len_public_subnets,
Expand Down Expand Up @@ -147,7 +148,7 @@ resource "aws_route" "public_internet_gateway" {

route_table_id = aws_route_table.public[0].id
destination_cidr_block = "0.0.0.0/0"
gateway_id = aws_internet_gateway.this[0].id
gateway_id = var.create_igw ? aws_internet_gateway.this[0].id : var.igw_id

timeouts {
create = "5m"
Expand All @@ -159,7 +160,7 @@ resource "aws_route" "public_internet_gateway_ipv6" {

route_table_id = aws_route_table.public[0].id
destination_ipv6_cidr_block = "::/0"
gateway_id = aws_internet_gateway.this[0].id
gateway_id = var.create_igw ? aws_internet_gateway.this[0].id : var.igw_id
}

################################################################################
Expand Down Expand Up @@ -416,7 +417,7 @@ resource "aws_route" "database_internet_gateway" {

route_table_id = aws_route_table.database[0].id
destination_cidr_block = "0.0.0.0/0"
gateway_id = aws_internet_gateway.this[0].id
gateway_id = var.create_igw ? aws_internet_gateway.this[0].id : var.igw_id

timeouts {
create = "5m"
Expand Down
5 changes: 5 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -1164,6 +1164,11 @@ variable "igw_tags" {
default = {}
}

variable "igw_id" {
description = "existing gateway id"
type = string
}

################################################################################
# NAT Gateway
################################################################################
Expand Down

0 comments on commit fcdc24a

Please sign in to comment.