aztfm / terraform-azurerm-virtual-network

Terraform module for Microsoft Azure to manage Virtual Network resource.
https://registry.terraform.io/modules/aztfm/virtual-network/azurerm/
MIT License
7 stars 14 forks source link

Associate a route table with a subnet #4

Open gareda opened 3 years ago

gareda commented 3 years ago

Description

Add an optional parameter to subnets that allows the ability to associate a subnet with a route table.

New or affected parameter(s)/configuration(s)

subnets.route_table_id

Potential Terraform Configuration

resource "azurerm_resource_group" "rg" {
  name     = "terraform-azurerm-virtual-network"
  location = "West Europe"
}

resource "azurerm_nat_gateway" "nat" {
  name                = "nat-gateway"
  location            = azurerm_resource_group.rg.location
  resource_group_name = azurerm_resource_group.rg.name
}

module "virtual-network" {
  source              = "aztfm/virtual-network/azurerm"
  version             = ">=1.0.0"
  name                = "virtual-network"
  resource_group_name = azurerm_resource_group.rg.name
  location            = azurerm_resource_group.rg.location
  address_space       = ["10.0.0.0/16"]
  subnets = [
    {
      name           = "subnet1"
      address_prefix = "10.0.0.0/24"
      route_table_id = azurerm_route_table.rt.id
    }
  ]
}

References

gareda commented 6 months ago