azurestack_virtual_network_peering

Manages a virtual network peering which allows resources to access other resources in the linked virtual network.

Example Usage

resource "azurestack_resource_group" "example" {
  name     = "peeredvnets-rg"
  location = "ashregion"
}

resource "azurestack_virtual_network" "example-1" {
  name                = "peternetwork1"
  resource_group_name = azurestack_resource_group.example.name
  address_space       = ["10.0.1.0/24"]
  location            = "ashregion"
}

resource "azurestack_virtual_network" "example-2" {
  name                = "peternetwork2"
  resource_group_name = azurestack_resource_group.example.name
  address_space       = ["10.0.2.0/24"]
  location            = "ashregion"
}

resource "azurestack_virtual_network_peering" "example-1" {
  name                      = "peer1to2"
  resource_group_name       = azurestack_resource_group.example.name
  virtual_network_name      = azurestack_virtual_network.example-1.name
  remote_virtual_network_id = azurestack_virtual_network.example-2.id
}

resource "azurestack_virtual_network_peering" "example-2" {
  name                      = "peer2to1"
  resource_group_name       = azurestack_resource_group.example.name
  virtual_network_name      = azurestack_virtual_network.example-2.name
  remote_virtual_network_id = azurestack_virtual_network.example-1.id
}

Argument Reference

The following arguments are supported:

Attributes Reference

The following attributes are exported:

Timeouts

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

Note

Virtual Network peerings cannot be created, updated or deleted concurrently.

Import

Virtual Network Peerings can be imported using the resource id, e.g.

terraform import azurestack_virtual_network_peering.examplePeering /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/virtualNetworks/myvnet1/virtualNetworkPeerings/myvnet1peering