feat: nat-gateways

This commit is contained in:
david committed 2024-04-27 18:25:39 +02:00
1 parent b7b1653cc6
commit e19d7fc053
11 files changed
+88 -53

No files matched your search

+5 -5
View File
@@ -4,10 +4,10 @@ Configuration in this directory creates a VPC with 2 groups of subnets named __p
1 subnet per availability zone in the region is created on each group. Cidr block for each subnet in the
group is calculated automaticaly based on the group __cidr_block__ and the numbre of availability zone used.
The group named __public__ is declared as public, that means a route table with a default route to internet
gateway is associated to each subnet of this group.
The group named __public__ is declared as public with its default route through Internet Gatewat.
Other subnets are routed localy inside the VPC.
The group named __private__ has a default route to a NAT Gateway in __public__ subnets group. That means a NAT
Gateway will be created in each __public__ subnets as target default route in route tables of __private__ subnets.
__network_acl_disabled__ is set to __true__ becsause in this exemple we don't want to manage Network ACLs.
That way, the VPC default Network ACL is configure with ingress and egress rules whitch are allowing all trafic.
@@ -21,7 +21,7 @@ terraform init
terraform plan
terraform apply
```
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
<!-- BEGIN_TF_DOCS -->
## Requirements
| Name | Version |
@@ -52,4 +52,4 @@ No inputs.
| Name | Description |
|------|-------------|
| <a name="output_module"></a> [module](#output\_module) | VPC module outputs |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
<!-- END_TF_DOCS -->
+4 -3
View File
@@ -24,11 +24,12 @@ module "vpc" {
cidr_block = local.cidr_block
subnet_groups = {
public = {
public = true
cidr_block = cidrsubnet(local.cidr_block, 1, 0)
default_route = "internet_gateway"
cidr_block = cidrsubnet(local.cidr_block, 1, 0)
}
private = {
cidr_block = cidrsubnet(local.cidr_block, 1, 1)
default_route = "nat_gateway.public"
cidr_block = cidrsubnet(local.cidr_block, 1, 1)
}
}
}