Skip to content

Commit 4394b25

Browse files
committed
feat: Add support to tag default route table
Signed-off-by: Lays Rodrigues <[email protected]>
1 parent af51566 commit 4394b25

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway
331331
| default\_network\_acl\_ingress | List of maps of ingress rules to set on the Default Network ACL | `list(map(string))` | <pre>[<br> {<br> "action": "allow",<br> "cidr_block": "0.0.0.0/0",<br> "from_port": 0,<br> "protocol": "-1",<br> "rule_no": 100,<br> "to_port": 0<br> },<br> {<br> "action": "allow",<br> "from_port": 0,<br> "ipv6_cidr_block": "::/0",<br> "protocol": "-1",<br> "rule_no": 101,<br> "to_port": 0<br> }<br>]</pre> | no |
332332
| default\_network\_acl\_name | Name to be used on the Default Network ACL | `string` | `""` | no |
333333
| default\_network\_acl\_tags | Additional tags for the Default Network ACL | `map(string)` | `{}` | no |
334+
| default\_route\_table\_tags | Additional tags for the Default Route Table | `map(string)` | `{}` | no |
334335
| default\_security\_group\_egress | List of maps of egress rules to set on the default security group | `list(map(string))` | `null` | no |
335336
| default\_security\_group\_ingress | List of maps of ingress rules to set on the default security group | `list(map(string))` | `null` | no |
336337
| default\_security\_group\_name | Name to be used on the default security group | `string` | `"default"` | no |

main.tf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,22 @@ resource "aws_egress_only_internet_gateway" "this" {
160160
)
161161
}
162162

163+
164+
################
165+
# Default route
166+
################
167+
resource "aws_default_route_table" "default" {
168+
count = var.create_vpc ? 1 : 0
169+
default_route_table_id = aws_vpc.this[0].default_route_table_id
170+
tags = merge(
171+
{
172+
"Name" = format("%s", var.name)
173+
},
174+
var.tags,
175+
var.default_route_table_tags,
176+
)
177+
}
178+
163179
################
164180
# Publiс routes
165181
################

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2596,3 +2596,9 @@ variable "create_egress_only_igw" {
25962596
type = bool
25972597
default = true
25982598
}
2599+
2600+
variable "default_route_table_tags" {
2601+
description = "Additional tags for the Default Route Table"
2602+
type = map(string)
2603+
default = {}
2604+
}

0 commit comments

Comments
 (0)