Skip to content

Commit

Permalink
Update vpc-full example
Browse files Browse the repository at this point in the history
  • Loading branch information
posquit0 committed Oct 26, 2023
1 parent 3ce1410 commit f07c61a
Show file tree
Hide file tree
Showing 3 changed files with 223 additions and 0 deletions.
67 changes: 67 additions & 0 deletions examples/vpc-full/nat-gateways.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
###################################################
# Elastic IP
###################################################

module "elastic_ip" {
source = "tedilabs/ipam/aws//modules/elastic-ip"
version = "~> 0.3.0"

name = "nat-gw-test-public/az2"
type = "AMAZON"

tags = {
"project" = "terraform-aws-network-examples"
}
}


###################################################
# Public NAT Gateway
###################################################

module "public_nat_gateway" {
source = "../../modules/nat-gateway"
# source = "tedilabs/network/aws//modules/nat-gateway"
# version = "~> 0.2.0"

name = "test-public/az2"
is_private = false
subnet = module.public_subnet_group.subnets_by_az["use1-az2"][0].id


## Primary IP Address
primary_ip_assignment = {
elastic_ip = module.elastic_ip.id
}


tags = {
"project" = "terraform-aws-network-examples"
}
}


###################################################
# Private NAT Gateway
###################################################

module "private_nat_gateway" {
source = "../../modules/nat-gateway"
# source = "tedilabs/network/aws//modules/nat-gateway"
# version = "~> 0.2.0"

name = "test-private/az2"
is_private = true
subnet = module.private_subnet_group.subnets_by_az["use1-az2"][0].id


## Primary IP Address
primary_ip_assignment = {
private_ip = "10.0.200.7"
}


tags = {
"project" = "terraform-aws-network-examples"
}
}
18 changes: 18 additions & 0 deletions examples/vpc-full/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,21 @@ output "vpc" {
description = "The VPC."
value = module.vpc
}

output "subnet_groups" {
description = "The Subnet Groups for the VPC."
value = {
private = module.private_subnet_group
public = module.public_subnet_group
}
}

output "public_nat_gateways" {
description = "The NAT Gateways in public."
value = module.public_nat_gateway
}

output "private_nat_gateways" {
description = "The NAT Gateways in private."
value = module.private_nat_gateway
}
138 changes: 138 additions & 0 deletions examples/vpc-full/subnet-groups.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
###################################################
# Subnet Groups
###################################################

module "private_subnet_group" {
source = "../../modules/subnet-group"
# source = "tedilabs/network/aws//modules/subnet-group"
# version = "~> 0.2.0"

name = "test/private"

vpc_id = module.vpc.id

subnets = {
"test/private/az2" = {
availability_zone_id = "use1-az2"
ipv4_cidr = "10.0.200.0/24"
}
"test/private/az4" = {
availability_zone_id = "use1-az4"
ipv4_cidr = "10.0.201.0/24"
}
}


## IP Assignments
public_ipv4_address_assignment = {
enabled = false
}
ipv6_address_assignment = {
enabled = false
}
customer_owned_ipv4_address_assignment = {
enabled = false
}


## DNS Configurations
dns_config = {
hostname_type = "RESOURCE_NAME"
dns_resource_name_ipv4_enabled = true
dns_resource_name_ipv6_enabled = false
dns64_enabled = false
}

## Integrations
dax_subnet_group = {
enabled = true
name = "test-dax"
description = "Test DAX Subnet Group"
}
dms_replication_subnet_group = {
enabled = true
name = "test-dms-replication"
description = "Test DMS Replication Subnet Group"
}
docdb_subnet_group = {
enabled = true
name = "test-docdb"
description = "Test DocumentDB Subnet Group"
}
elasticache_subnet_group = {
enabled = true
name = "test-elasticache"
description = "Test ElastiCache Subnet Group"
}
memorydb_subnet_group = {
enabled = true
name = "test-memorydb"
description = "Test MemoryDB Subnet Group"
}
neptune_subnet_group = {
enabled = true
name = "test-neptune"
description = "Test Neptune Subnet Group"
}
rds_subnet_group = {
enabled = true
name = "test-rds"
description = "Test RDS Subnet Group"
}
redshift_subnet_group = {
enabled = true
name = "test-redshift"
description = "Test Redshift Subnet Group"
}

tags = {
"project" = "terraform-aws-network-examples"
}
}

module "public_subnet_group" {
source = "../../modules/subnet-group"
# source = "tedilabs/network/aws//modules/subnet-group"
# version = "~> 0.2.0"

name = "test/public"

vpc_id = module.vpc.id

subnets = {
"test/public/az2" = {
availability_zone_id = "use1-az2"
ipv4_cidr = "10.0.100.0/24"
}
"test/public/az4" = {
availability_zone_id = "use1-az4"
ipv4_cidr = "10.0.101.0/24"
}
}


## IP Assignments
public_ipv4_address_assignment = {
enabled = true
}
ipv6_address_assignment = {
enabled = false
}
customer_owned_ipv4_address_assignment = {
enabled = false
}


## DNS Configurations
dns_config = {
hostname_type = "RESOURCE_NAME"
dns_resource_name_ipv4_enabled = true
dns_resource_name_ipv6_enabled = false
dns64_enabled = false
}


tags = {
"project" = "terraform-aws-network-examples"
}
}

0 comments on commit f07c61a

Please sign in to comment.