-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinetgw.tf
33 lines (30 loc) · 1.34 KB
/
inetgw.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
##################################################
# File: inetgw.tf #
# Created Date: 03202019 #
# Author: Fred Stuck #
# Version: 0.1 #
# Description: Creates an Internet Gateway #
# #
# Change History: #
# 03202019: Initial File #
# 05142021: Added egress only IGW #
# #
##################################################
resource "aws_internet_gateway" "inet-gw" {
count = contains(keys(var.subnets), "pub") && !var.egress_only_internet_gateway ? 1 : 0
vpc_id = aws_vpc.main_vpc.id
tags = merge(
var.tags,
map("Name",format("%s", "${var.name-vars["account"]}-${var.name-vars["name"]}-${replace(var.region,"-", "")}-igw" )),
local.resource-tags["aws_internet_gateway"]
)
}
resource "aws_egress_only_internet_gateway" "eg-inet-gw" {
count = contains(keys(var.subnets), "pub") && var.egress_only_internet_gateway ? 1 : 0
vpc_id = aws_vpc.main_vpc.id
tags = merge(
var.tags,
map("Name",format("%s", "${var.name-vars["account"]}-${var.name-vars["name"]}-${replace(var.region,"-", "")}-igw" )),
local.resource-tags["aws_internet_gateway"]
)
}