Skip to content

Commit

Permalink
hurodata[47] update route table resource to create multiple rt in sam…
Browse files Browse the repository at this point in the history
…e vnet
  • Loading branch information
nileshgadgi committed Apr 3, 2023
1 parent 7477340 commit cebe280
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions _example/default_subnet/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ module "subnet" {
subnet_prefixes = ["10.0.1.0/24", "10.0.2.0/24"]

# route_table
enable_route_table = true
route_table_name = "default_subnet"
routes = [
{
name = "rt-test"
Expand Down
1 change: 1 addition & 0 deletions _example/name-specific_subnet/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ module "name_specific_subnet" {
subnet_prefixes = ["10.0.1.0/24"]

# route_table
route_table_name = "name_specific_subnet"
routes = [
{
name = "rt-test"
Expand Down
1 change: 1 addition & 0 deletions _example/nat-gateway_subnet/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ module "subnet" {
subnet_prefixes = ["10.0.1.0/24", "10.0.2.0/24"]

# route_table
route_table_name = "nat_gateway"
routes = [
{
name = "rt-test"
Expand Down
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ resource "azurerm_subnet_nat_gateway_association" "subnet_assoc" {
#Route Table
resource "azurerm_route_table" "rt" {
count = var.enable && var.enable_route_table ? 1 : 0
name = format("%s-route-table", module.labels.id)
name = format("%s-%s-route-table", module.labels.id,var.route_table_name)
location = var.location
resource_group_name = var.resource_group_name
dynamic "route" {
Expand Down
6 changes: 6 additions & 0 deletions variable.tf
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@ variable "routes" {
/*ROUTES = [{ name = "", address_prefix = "", next_hop_type = "", next_hop_in_ip_address = "" }]*/
}

variable "route_table_name" {
type = string
default = ""
description = "The name of the route table."
}

variable "disable_bgp_route_propagation" {
type = bool
default = false
Expand Down

0 comments on commit cebe280

Please sign in to comment.