Skip to content

Commit 2985eba

Browse files
lawliet89antonbabenko
authored andcommitted
Manage Default Route Table under Terraform (terraform-aws-modules#69)
* Manage Default Route Table under Terraform - With name - And Tags * Use `aws_default_route_table` instead * Added aws_main_route_table_association resource * Update main.tf
1 parent 6d7b091 commit 2985eba

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

main.tf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,3 +333,17 @@ resource "aws_vpn_gateway" "this" {
333333

334334
tags = "${merge(var.tags, map("Name", format("%s", var.name)))}"
335335
}
336+
337+
###########
338+
# Defaults
339+
###########
340+
resource "aws_default_route_table" "default" {
341+
default_route_table_id = "${aws_vpc.this.default_route_table_id}"
342+
343+
tags = "${merge(var.tags, var.default_route_table_tags, map("Name", format("%s-default", var.name)))}"
344+
}
345+
346+
resource "aws_main_route_table_association" "default" {
347+
vpc_id = "${aws_vpc.this.id}"
348+
route_table_id = "${aws_default_route_table.default.default_route_table_id}"
349+
}

variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ variable "private_subnet_tags" {
132132
default = {}
133133
}
134134

135+
variable "default_route_table_tags" {
136+
description = "Additional tags for the default route table"
137+
default = {}
138+
}
139+
135140
variable "public_route_table_tags" {
136141
description = "Additional tags for the public route tables"
137142
default = {}

0 commit comments

Comments
 (0)