Skip to content

Splitting vnet data and supporting different RGs for VM & VNet #12

Open
@tohewi

Description

@tohewi

Hi,

Instead of having local data on vnet:

data "azurerm_virtual_network" "vnet" {
  name                = var.virtual_network_name
  resource_group_name = data.azurerm_resource_group.rg.name
}

would you please consider having the possibility to provide network map as input to the module.

I am using a map like this to

locals {
  vnet_map = merge(
	var.vnet_map,
    {
    dev = {
      vnet = "${data.azurerm_virtual_network.pe_dev_vnet01.id}"
      default_subnet = "${data.azurerm_subnet.pe_dev_vnet01_subnet01.id}"
    }
    test = {
      vnet = "${data.azurerm_virtual_network.pe_test_vnet01.id}"
      default_subnet = "${data.azurerm_subnet.pe_test_vnet01_subnet01.id}"
    }
    prod = {
      vnet = "${data.azurerm_virtual_network.pe_prod_vnet01.id}"
      default_subnet = "${data.azurerm_subnet.pe_prod_vnet01_subnet01.id}"
    }
    },
  )
}

to create an environment specific map of vnet and subnet ids.

This would help keeping vnet data consistently in one "module" and also support cases where VNETs and VMs are in different resource groups.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions