Skip to content

Commit

Permalink
feat: Add support to tag default route table
Browse files Browse the repository at this point in the history
Signed-off-by: Lays Rodrigues <laysrodriguessilva@gmail.com>
  • Loading branch information
lays147 committed Dec 17, 2020
1 parent af51566 commit 4394b25
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,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))` | <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 |
| 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 |
Expand Down
16 changes: 16 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
################
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2596,3 +2596,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 = {}
}

0 comments on commit 4394b25

Please sign in to comment.