-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
436 additions
and
58 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
84 changes: 84 additions & 0 deletions
84
examples/nat-gateway-private-secondary-ip-addresses/main.tf
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,84 @@ | ||
provider "aws" { | ||
region = "us-east-1" | ||
} | ||
|
||
data "aws_vpc" "default" { | ||
default = true | ||
} | ||
|
||
data "aws_subnets" "default" { | ||
filter { | ||
name = "vpc-id" | ||
values = [data.aws_vpc.default.id] | ||
} | ||
} | ||
|
||
|
||
################################################### | ||
# Public NAT Gateway | ||
################################################### | ||
|
||
module "nat_gateway" { | ||
source = "../../modules/nat-gateway" | ||
# source = "tedilabs/network/aws//modules/nat-gateway" | ||
# version = "~> 0.2.0" | ||
|
||
name = "test-count" | ||
is_private = true | ||
subnet = data.aws_subnets.default.ids[0] | ||
|
||
|
||
## Primary IP Address | ||
primary_ip_assignment = { | ||
# Automatically assign a public IP address to the NAT Gateway | ||
private_ip = null | ||
} | ||
|
||
|
||
## Secondary IP Addresses | ||
secondary_ip_count = 7 | ||
|
||
|
||
tags = { | ||
"project" = "terraform-aws-network-examples" | ||
} | ||
} | ||
|
||
module "nat_gateway_2" { | ||
source = "../../modules/nat-gateway" | ||
# source = "tedilabs/network/aws//modules/nat-gateway" | ||
# version = "~> 0.2.0" | ||
|
||
name = "test-assingments" | ||
is_private = true | ||
subnet = data.aws_subnets.default.ids[0] | ||
|
||
|
||
## Primary IP Address | ||
primary_ip_assignment = { | ||
# Automatically assign a public IP address to the NAT Gateway | ||
private_ip = "172.31.51.100" | ||
} | ||
|
||
|
||
## Secondary IP Addresses | ||
secondary_ip_assignments = [ | ||
{ | ||
private_ip = "172.31.51.101" | ||
}, | ||
{ | ||
private_ip = "172.31.51.102" | ||
}, | ||
{ | ||
private_ip = "172.31.51.103" | ||
}, | ||
{ | ||
private_ip = "172.31.51.104" | ||
}, | ||
] | ||
|
||
|
||
tags = { | ||
"project" = "terraform-aws-network-examples" | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
examples/nat-gateway-private-secondary-ip-addresses/outputs.tf
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,7 @@ | ||
output "nat_gateway" { | ||
description = "The NAT Gateways." | ||
value = { | ||
count = module.nat_gateway | ||
assignments = module.nat_gateway_2 | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
examples/nat-gateway-private-secondary-ip-addresses/versions.tf
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,10 @@ | ||
terraform { | ||
required_version = "~> 1.5" | ||
|
||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = "~> 5.0" | ||
} | ||
} | ||
} |
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,41 @@ | ||
provider "aws" { | ||
region = "us-east-1" | ||
} | ||
|
||
data "aws_vpc" "default" { | ||
default = true | ||
} | ||
|
||
data "aws_subnets" "default" { | ||
filter { | ||
name = "vpc-id" | ||
values = [data.aws_vpc.default.id] | ||
} | ||
} | ||
|
||
|
||
################################################### | ||
# Public NAT Gateway | ||
################################################### | ||
|
||
module "nat_gateway" { | ||
source = "../../modules/nat-gateway" | ||
# source = "tedilabs/network/aws//modules/nat-gateway" | ||
# version = "~> 0.2.0" | ||
|
||
name = "test/az1" | ||
is_private = true | ||
subnet = data.aws_subnets.default.ids[0] | ||
|
||
|
||
## Primary IP Address | ||
primary_ip_assignment = { | ||
# Automatically assign a public IP address to the NAT Gateway | ||
private_ip = null | ||
} | ||
|
||
|
||
tags = { | ||
"project" = "terraform-aws-network-examples" | ||
} | ||
} |
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,4 @@ | ||
output "nat_gateway" { | ||
description = "The NAT Gateway." | ||
value = module.nat_gateway | ||
} |
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,10 @@ | ||
terraform { | ||
required_version = "~> 1.5" | ||
|
||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = "~> 5.0" | ||
} | ||
} | ||
} |
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,57 @@ | ||
provider "aws" { | ||
region = "us-east-1" | ||
} | ||
|
||
data "aws_vpc" "default" { | ||
default = true | ||
} | ||
|
||
data "aws_subnets" "default" { | ||
filter { | ||
name = "vpc-id" | ||
values = [data.aws_vpc.default.id] | ||
} | ||
} | ||
|
||
|
||
################################################### | ||
# Elastic IP | ||
################################################### | ||
|
||
module "elastic_ip" { | ||
source = "tedilabs/ipam/aws//modules/elastic-ip" | ||
version = "~> 0.3.0" | ||
|
||
name = "nat-gw-public" | ||
type = "AMAZON" | ||
|
||
tags = { | ||
"project" = "terraform-aws-network-examples" | ||
} | ||
} | ||
|
||
|
||
################################################### | ||
# Public NAT Gateway | ||
################################################### | ||
|
||
module "nat_gateway" { | ||
source = "../../modules/nat-gateway" | ||
# source = "tedilabs/network/aws//modules/nat-gateway" | ||
# version = "~> 0.2.0" | ||
|
||
name = "test/az1" | ||
is_private = false | ||
subnet = data.aws_subnets.default.ids[0] | ||
|
||
|
||
## Primary IP Address | ||
primary_ip_assignment = { | ||
elastic_ip = module.elastic_ip.id | ||
} | ||
|
||
|
||
tags = { | ||
"project" = "terraform-aws-network-examples" | ||
} | ||
} |
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,9 @@ | ||
output "elastic_ip" { | ||
description = "The Elastic IP." | ||
value = module.elastic_ip | ||
} | ||
|
||
output "nat_gateway" { | ||
description = "The NAT Gateway." | ||
value = module.nat_gateway | ||
} |
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,10 @@ | ||
terraform { | ||
required_version = "~> 1.5" | ||
|
||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = "~> 5.0" | ||
} | ||
} | ||
} |
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
Oops, something went wrong.