hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.46k stars 4.54k forks source link

azurerm_dev_test_virtual_network - attach existing subnet of existing VNet to DevTest Lab #9759

Open MaxiPalle opened 3 years ago

MaxiPalle commented 3 years ago

Community Note

Description

Currently, only a new VNet and subnet are created using this resource provider. We need to integrate existing subnet.

New or Affected Resource(s)

Potential Terraform Configuration

resource "azurerm_dev_test_virtual_network" "vnet-dtl-lab1" {
  vnet_id                = azurerm_virtual_network.vnet-dtl.id
  lab_name            = azurerm_dev_test_lab.lab1.name
  resource_group_name = azurerm_resource_group.dtl-lab1.name

  subnet {
    subnet_id                   = azurerm_subnet.subnet-example.id
    use_public_ip_address           = "Deny"
    use_in_virtual_machine_creation = "Allow"
  }
}

References

MaxiPalle commented 3 years ago

Any update on this? We still need this!

schwarzzz commented 3 years ago

It looks like the current modelling of DevTest Lab resources in the azurerm provider prevents proper dependency inversion:

In real life, you most probably want to create the DevTest Lab instance on an already existing vNet.

eehret commented 1 year ago

I also need this functionality. This issue has been open for a really long time with no apparent movement. Is it not feasible to support this? I find it odd that you can do this via Azure Portal but not via Terraform.