CloudNationHQ / terraform-azure-vnet

Terraform module which creates virtual network resources used by workloads and accelerators.
https://library.tf/modules/CloudNationHQ/vnet/azure/latest
MIT License
1 stars 1 forks source link

fix route table creation #41

Closed dkooll closed 4 months ago

dkooll commented 4 months ago

When using the below config 1 shared and 1 non shared route table should be created.

module "network" {
  source  = "cloudnationhq/vnet/azure"
  version = "~> 1.0"

  naming = local.naming

  vnet = {
    name          = module.naming.virtual_network.name
    location      = module.rg.groups.demo.location
    resourcegroup = module.rg.groups.demo.name
    cidr          = ["10.18.0.0/16"]

    subnets = {
      sn1 = {
        cidr        = ["10.18.1.0/24"]
        route_table = "shd"
        nsg         = {}
      },
      sn2 = {
        cidr        = ["10.18.2.0/24"]
        route_table = "shd"
        nsg         = {}
      },
      sn3 = {
        cidr = ["10.18.3.0/24"]
        nsg  = {}
        route = {
          routes = {
            rt3 = {
              address_prefix = "storage"
              next_hop_type  = "Internet"
            }
          }
        }
      }
    }

    route_tables = {
      shd = {
        routes = {
          rt1 = { address_prefix = "0.0.0.0/0", next_hop_type = "Internet" }
        }
      }
    }
  }
}

Instead all 4 route tables are created