diff --git a/examples/vpc-full/nacls.tf b/examples/vpc-full/nacls.tf new file mode 100644 index 0000000..4985be0 --- /dev/null +++ b/examples/vpc-full/nacls.tf @@ -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" + } +} diff --git a/examples/vpc-full/outputs.tf b/examples/vpc-full/outputs.tf index 6bd50a8..22756b4 100644 --- a/examples/vpc-full/outputs.tf +++ b/examples/vpc-full/outputs.tf @@ -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 + } +} + diff --git a/examples/vpc-full/route-tables.tf b/examples/vpc-full/route-tables.tf new file mode 100644 index 0000000..625db76 --- /dev/null +++ b/examples/vpc-full/route-tables.tf @@ -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" + } +}