diff --git a/README.md b/README.md index 21da998a9..954db2256 100644 --- a/README.md +++ b/README.md @@ -335,6 +335,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway | default\_network\_acl\_ingress | List of maps of ingress rules to set on the Default Network ACL | `list(map(string))` |
[
{
"action": "allow",
"cidr_block": "0.0.0.0/0",
"from_port": 0,
"protocol": "-1",
"rule_no": 100,
"to_port": 0
},
{
"action": "allow",
"from_port": 0,
"ipv6_cidr_block": "::/0",
"protocol": "-1",
"rule_no": 101,
"to_port": 0
}
]
| no | | default\_network\_acl\_name | Name to be used on the Default Network ACL | `string` | `""` | no | | default\_network\_acl\_tags | Additional tags for the Default Network ACL | `map(string)` | `{}` | no | +| default\_route\_table\_tags | Additional tags for the Default Route Table | `map(string)` | `{}` | no | | default\_security\_group\_egress | List of maps of egress rules to set on the default security group | `list(map(string))` | `null` | no | | default\_security\_group\_ingress | List of maps of ingress rules to set on the default security group | `list(map(string))` | `null` | no | | default\_security\_group\_name | Name to be used on the default security group | `string` | `"default"` | no | diff --git a/main.tf b/main.tf index e83ad6137..5d241c381 100644 --- a/main.tf +++ b/main.tf @@ -160,6 +160,22 @@ resource "aws_egress_only_internet_gateway" "this" { ) } + +################ +# Default route +################ +resource "aws_default_route_table" "default" { + count = var.create_vpc ? 1 : 0 + default_route_table_id = aws_vpc.this[0].default_route_table_id + tags = merge( + { + "Name" = format("%s", var.name) + }, + var.tags, + var.default_route_table_tags, + ) +} + ################ # Publiс routes ################ diff --git a/variables.tf b/variables.tf index 35b888719..daf5e4a8d 100644 --- a/variables.tf +++ b/variables.tf @@ -2602,3 +2602,9 @@ variable "create_egress_only_igw" { type = bool default = true } + +variable "default_route_table_tags" { + description = "Additional tags for the Default Route Table" + type = map(string) + default = {} +}