File tree Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -33,3 +33,10 @@ resource "azurerm_subnet_nat_gateway_association" "this" {
33
33
subnet_id = var. export_subnet_id == null ? azurerm_subnet. this [0 ]. id : var. export_subnet_id
34
34
nat_gateway_id = var. nat_gateway_id
35
35
}
36
+
37
+ resource "azurerm_subnet_route_table_association" "this" {
38
+ count = var. route_table_association_enabled ? 1 : 0
39
+
40
+ subnet_id = var. export_subnet_id == null ? azurerm_subnet. this [0 ]. id : var. export_subnet_id
41
+ route_table_id = var. route_table_id
42
+ }
Original file line number Diff line number Diff line change @@ -23,6 +23,11 @@ output "nat_gateway_association_id" {
23
23
description = " The ID of the NAT Gateway Association"
24
24
}
25
25
26
+ output "route_table_association_id" {
27
+ value = try (azurerm_subnet_route_table_association. this [0 ]. id , null )
28
+ description = " The ID of the Route Table Association"
29
+ }
30
+
26
31
output "name_to_id_map" {
27
32
value = var. export_subnet_id == null ? { (azurerm_subnet.this[0 ].name) = azurerm_subnet.this[0 ].id } : null
28
33
description = " Map of Subnet Name to Id"
Original file line number Diff line number Diff line change @@ -73,3 +73,15 @@ variable "nat_gateway_id" {
73
73
description = " ID of the NAT Gateway which would be assigned to subnet"
74
74
default = null
75
75
}
76
+
77
+ variable "route_table_association_enabled" {
78
+ type = bool
79
+ description = " Boolean flag that determines if Route Table association would be created"
80
+ default = false
81
+ }
82
+
83
+ variable "route_table_id" {
84
+ type = string
85
+ description = " ID of the Route Table which would be assigned to subnet"
86
+ default = null
87
+ }
You can’t perform that action at this time.
0 commit comments