Skip to content

azurermDevTestVirtualNetwork

Manages a Virtual Network within a DevTest Lab.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "example-resources",
  }
);
const azurermDevTestLabExample = new azurerm.devTestLab.DevTestLab(
  this,
  "example_1",
  {
    location: azurermResourceGroupExample.location,
    name: "example-devtestlab",
    resource_group_name: azurermResourceGroupExample.name,
    tags: {
      Sydney: "Australia",
    },
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermDevTestLabExample.overrideLogicalId("example");
const azurermDevTestVirtualNetworkExample =
  new azurerm.devTestVirtualNetwork.DevTestVirtualNetwork(this, "example_2", {
    lab_name: azurermDevTestLabExample.name,
    name: "example-network",
    resource_group_name: azurermResourceGroupExample.name,
    subnet: [
      {
        use_in_virtual_machine_creation: "Allow",
        use_public_ip_address: "Allow",
      },
    ],
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermDevTestVirtualNetworkExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • name - (Required) Specifies the name of the Dev Test Virtual Network. Changing this forces a new resource to be created.

  • labName - (Required) Specifies the name of the Dev Test Lab in which the Virtual Network should be created. Changing this forces a new resource to be created.

  • resourceGroupName - (Required) The name of the resource group in which the Dev Test Lab resource exists. Changing this forces a new resource to be created.

  • description - (Optional) A description for the Virtual Network.

  • subnet - (Optional) A subnet block as defined below.

  • tags - (Optional) A mapping of tags to assign to the resource.


A subnet block supports the following:

  • usePublicIpAddress - (Optional) Can Virtual Machines in this Subnet use Public IP Addresses? Possible values are allow, default and deny.

  • useInVirtualMachineCreation - (Optional) Can this subnet be used for creating Virtual Machines? Possible values are allow, default and deny.

Attributes Reference

The following attributes are exported:

  • id - The ID of the Dev Test Virtual Network.

  • subnet - A subnet block as defined below.

  • uniqueIdentifier - The unique immutable identifier of the Dev Test Virtual Network.


A subnet block exports the following:

  • name - The name of the Subnet for this Virtual Network.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 30 minutes) Used when creating the DevTest Virtual Network.
  • update - (Defaults to 30 minutes) Used when updating the DevTest Virtual Network.
  • read - (Defaults to 5 minutes) Used when retrieving the DevTest Virtual Network.
  • delete - (Defaults to 30 minutes) Used when deleting the DevTest Virtual Network.

Import

DevTest Virtual Networks can be imported using the resourceId, e.g.

terraform import azurerm_dev_test_virtual_network.network1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/virtualNetworks/network1