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 30, 2023
1 parent 9f36d80 commit b4046b9
Show file tree
Hide file tree
Showing 3 changed files with 193 additions and 6 deletions.
103 changes: 103 additions & 0 deletions examples/vpc-full/nacls.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
###################################################
# Network ACLs
###################################################

module "private_network_acl" {
source = "../../modules/nacl"
# source = "tedilabs/network/aws//modules/nacl"
# version = "~> 0.2.0"

name = "test-private"
vpc_id = module.vpc.id
subnets = module.private_subnet_group.ids

ingress_rules = {
900 = {
action = "ALLOW"
protocol = "-1"
ipv4_cidr = "10.0.0.0/16"
}
}
egress_rules = {
900 = {
action = "ALLOW"
protocol = "-1"
ipv4_cidr = "10.0.0.0/16"
}
}

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

module "public_network_acl" {
source = "../../modules/nacl"
# source = "tedilabs/network/aws//modules/nacl"
# version = "~> 0.2.0"

name = "test-public"
vpc_id = module.vpc.id
subnets = module.public_subnet_group.ids

ingress_rules = {
100 = {
action = "ALLOW"
protocol = "icmp"
ipv4_cidr = "0.0.0.0/0"
icmp_type = -1
icmp_code = -1
}
200 = {
action = "ALLOW"
protocol = "tcp"
ipv4_cidr = "0.0.0.0/0"
from_port = 22
to_port = 22
}
300 = {
action = "ALLOW"
protocol = "tcp"
ipv4_cidr = "0.0.0.0/0"
from_port = 80
to_port = 80
}
310 = {
action = "ALLOW"
protocol = "tcp"
ipv4_cidr = "0.0.0.0/0"
from_port = 443
to_port = 443
}
800 = {
action = "ALLOW"
protocol = "tcp"
ipv4_cidr = "0.0.0.0/0"
from_port = 1024
to_port = 65535
}
801 = {
action = "ALLOW"
protocol = "udp"
ipv4_cidr = "0.0.0.0/0"
from_port = 1024
to_port = 65535
}
900 = {
action = "ALLOW"
protocol = "-1"
ipv4_cidr = "10.0.0.0/16"
}
}
egress_rules = {
900 = {
action = "ALLOW"
protocol = "-1"
ipv4_cidr = "0.0.0.0/0"
}
}

tags = {
"project" = "terraform-aws-network-examples"
}
}
27 changes: 21 additions & 6 deletions examples/vpc-full/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,27 @@ output "subnet_groups" {
}
}

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

output "private_nat_gateways" {
description = "The NAT Gateways in private."
value = module.private_nat_gateway
output "nacls" {
description = "The Network ACLs."
value = {
public = module.public_network_acl
private = module.private_network_acl
}
}

output "route_tables" {
description = "The Route Tables."
value = {
public = module.public_route_table
private = module.private_route_table
}
}

69 changes: 69 additions & 0 deletions examples/vpc-full/route-tables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
###################################################
# Route Tables
###################################################

module "private_route_table" {
source = "../../modules/route-table"
# source = "tedilabs/network/aws//modules/route-table"
# version = "~> 0.2.0"

name = "test-private"
vpc_id = module.vpc.id
subnets = module.private_subnet_group.ids
gateways = []


## Route Rules
ipv4_routes = [
{
destination = "0.0.0.0/0"
target = {
type = "NAT_GATEWAY"
id = module.public_nat_gateway.id
}
},
]
ipv6_routes = []
prefix_list_routes = []

vpc_gateway_endpoints = []
propagating_vpn_gateways = []


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

module "public_route_table" {
source = "../../modules/route-table"
# source = "tedilabs/network/aws//modules/route-table"
# version = "~> 0.2.0"

name = "test-public"
vpc_id = module.vpc.id
subnets = module.public_subnet_group.ids
gateways = []


## Route Rules
ipv4_routes = [
{
destination = "0.0.0.0/0"
target = {
type = "INTERNET_GATEWAY"
id = module.vpc.internet_gateway.id
}
},
]
ipv6_routes = []
prefix_list_routes = []

vpc_gateway_endpoints = []
propagating_vpn_gateways = []


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

0 comments on commit b4046b9

Please sign in to comment.