-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separate NAT instance configuration using a 'terraform module'.
- Loading branch information
Showing
16 changed files
with
335 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# | ||
# Project Name:: en_infra_aws | ||
# Module:: NAT | ||
# | ||
# Copyright (C) 2017 - Present | ||
# Author: 'Mihai Vultur <mihai.vultur@___.com>' | ||
# | ||
# All rights reserved | ||
# | ||
# Description: | ||
# Configures Elastic IP that will be associated with the NAT instance | ||
# | ||
|
||
resource "aws_eip" "NatInstance" { | ||
instance = "${aws_instance.NatInstance.id}" | ||
vpc = true | ||
} | ||
#-- | ||
resource "aws_eip_association" "eip_assoc_NatInstance" { | ||
instance_id = "${aws_instance.NatInstance.id}" | ||
allocation_id = "${aws_eip.NatInstance.id}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# | ||
# Project Name:: en_infra_aws | ||
# Module:: NAT | ||
# | ||
# Copyright (C) 2017 - Present | ||
# Author: 'Mihai Vultur <mihai.vultur@___.com>' | ||
# | ||
# All rights reserved | ||
# | ||
# Description: | ||
# Creation of the EC2 instance that will serve as NAT Gateway | ||
# | ||
|
||
resource "aws_instance" "NatInstance" { | ||
count = "${var.number_of_instances}" | ||
ami = "${var.ami_id}" | ||
instance_type = "${var.instance_type}" | ||
subnet_id = "${element(split(",", var.subnet_id), count.index)}" | ||
key_name = "${var.key_name}" | ||
|
||
vpc_security_group_ids = [ | ||
"${split(",", var.sgs)}" | ||
] | ||
|
||
source_dest_check = false | ||
|
||
root_block_device { | ||
volume_type = "gp2" | ||
volume_size = "${var.root_volume_size}" | ||
delete_on_termination = true | ||
} | ||
|
||
tags = "${merge(map("ManageRunningTime", "WorkingHoursStop"), map("Provisioner", "terraform"), map("VPC", var.vpc_name), map("Name", format("%s_%s", var.vpc_name, var.instance_name)))}" | ||
|
||
} | ||
|
Oops, something went wrong.