Skip to content

Data Source: azurermVirtualNetwork

Use this data source to access information about an existing Virtual Network.

Example Usage

import * as cdktf from "cdktf";
/*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 dataAzurermVirtualNetworkExample =
  new azurerm.dataAzurermVirtualNetwork.DataAzurermVirtualNetwork(
    this,
    "example",
    {
      name: "production",
      resource_group_name: "networking",
    }
  );
new cdktf.TerraformOutput(this, "virtual_network_id", {
  value: dataAzurermVirtualNetworkExample.id,
});

Argument Reference

  • name - Specifies the name of the Virtual Network.
  • resourceGroupName - Specifies the name of the resource group the Virtual Network is located in.

Attributes Reference

  • id - The ID of the virtual network.
  • location - Location of the virtual network.
  • addressSpace - The list of address spaces used by the virtual network.
  • dnsServers - The list of DNS servers used by the virtual network.
  • guid - The GUID of the virtual network.
  • subnets - The list of name of the subnets that are attached to this virtual network.
  • vnetPeerings - A mapping of name - virtual network id of the virtual network peerings.
  • vnetPeeringsAddresses - A list of virtual network peerings IP addresses.
  • tags - A mapping of tags to assigned to the resource.

Timeouts

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

  • read - (Defaults to 5 minutes) Used when retrieving the Virtual Network.