VirtualNetworkArgs

data class VirtualNetworkArgs(val addressSpaces: Output<List<String>>? = null, val bgpCommunity: Output<String>? = null, val ddosProtectionPlan: Output<VirtualNetworkDdosProtectionPlanArgs>? = null, val dnsServers: Output<List<String>>? = null, val edgeZone: Output<String>? = null, val encryption: Output<VirtualNetworkEncryptionArgs>? = null, val flowTimeoutInMinutes: Output<Int>? = null, val location: Output<String>? = null, val name: Output<String>? = null, val resourceGroupName: Output<String>? = null, val subnets: Output<List<VirtualNetworkSubnetArgs>>? = null, val tags: Output<Map<String, String>>? = null) : ConvertibleToJava<VirtualNetworkArgs>

Manages a virtual network including any configured subnets. Each subnet can optionally be configured with a security group to be associated with the subnet.

NOTE on Virtual Networks and Subnet's: This provider currently provides both a standalone Subnet resource, and allows for Subnets to be defined in-line within the Virtual Network resource. At this time you cannot use a Virtual Network with in-line Subnets in conjunction with any Subnet resources. Doing so will cause a conflict of Subnet configurations and will overwrite Subnet's. NOTE on Virtual Networks and DNS Servers: This provider currently provides both a standalone virtual network DNS Servers resource, and allows for DNS servers to be defined in-line within the Virtual Network resource. At this time you cannot use a Virtual Network with in-line DNS servers in conjunction with any Virtual Network DNS Servers resources. Doing so will cause a conflict of Virtual Network DNS Servers configurations and will overwrite virtual networks DNS servers.

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.network.NetworkSecurityGroup;
import com.pulumi.azure.network.NetworkSecurityGroupArgs;
import com.pulumi.azure.network.VirtualNetwork;
import com.pulumi.azure.network.VirtualNetworkArgs;
import com.pulumi.azure.network.inputs.VirtualNetworkSubnetArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
.location("West Europe")
.build());
var exampleNetworkSecurityGroup = new NetworkSecurityGroup("exampleNetworkSecurityGroup", NetworkSecurityGroupArgs.builder()
.location(exampleResourceGroup.location())
.resourceGroupName(exampleResourceGroup.name())
.build());
var exampleVirtualNetwork = new VirtualNetwork("exampleVirtualNetwork", VirtualNetworkArgs.builder()
.location(exampleResourceGroup.location())
.resourceGroupName(exampleResourceGroup.name())
.addressSpaces("10.0.0.0/16")
.dnsServers(
"10.0.0.4",
"10.0.0.5")
.subnets(
VirtualNetworkSubnetArgs.builder()
.name("subnet1")
.addressPrefix("10.0.1.0/24")
.build(),
VirtualNetworkSubnetArgs.builder()
.name("subnet2")
.addressPrefix("10.0.2.0/24")
.securityGroup(exampleNetworkSecurityGroup.id())
.build())
.tags(Map.of("environment", "Production"))
.build());
}
}

Import

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

$ pulumi import azure:network/virtualNetwork:VirtualNetwork exampleNetwork /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/virtualNetworks/myvnet1

Constructors

Link copied to clipboard
fun VirtualNetworkArgs(addressSpaces: Output<List<String>>? = null, bgpCommunity: Output<String>? = null, ddosProtectionPlan: Output<VirtualNetworkDdosProtectionPlanArgs>? = null, dnsServers: Output<List<String>>? = null, edgeZone: Output<String>? = null, encryption: Output<VirtualNetworkEncryptionArgs>? = null, flowTimeoutInMinutes: Output<Int>? = null, location: Output<String>? = null, name: Output<String>? = null, resourceGroupName: Output<String>? = null, subnets: Output<List<VirtualNetworkSubnetArgs>>? = null, tags: Output<Map<String, String>>? = null)

Functions

Link copied to clipboard
open override fun toJava(): VirtualNetworkArgs

Properties

Link copied to clipboard
val addressSpaces: Output<List<String>>? = null

The address space that is used the virtual network. You can supply more than one address space.

Link copied to clipboard
val bgpCommunity: Output<String>? = null

The BGP community attribute in format <as-number>:<community-value>.

Link copied to clipboard

A ddos_protection_plan block as documented below.

Link copied to clipboard
val dnsServers: Output<List<String>>? = null

List of IP addresses of DNS servers

Link copied to clipboard
val edgeZone: Output<String>? = null

Specifies the Edge Zone within the Azure Region where this Virtual Network should exist. Changing this forces a new Virtual Network to be created.

Link copied to clipboard

A encryption block as defined below.

Link copied to clipboard
val flowTimeoutInMinutes: Output<Int>? = null

The flow timeout in minutes for the Virtual Network, which is used to enable connection tracking for intra-VM flows. Possible values are between 4 and 30 minutes.

Link copied to clipboard
val location: Output<String>? = null

The location/region where the virtual network is created. Changing this forces a new resource to be created.

Link copied to clipboard
val name: Output<String>? = null

The name of the virtual network. Changing this forces a new resource to be created.

Link copied to clipboard
val resourceGroupName: Output<String>? = null

The name of the resource group in which to create the virtual network. Changing this forces a new resource to be created.

Link copied to clipboard
val subnets: Output<List<VirtualNetworkSubnetArgs>>? = null

Can be specified multiple times to define multiple subnets. Each subnet block supports fields documented below.

Link copied to clipboard
val tags: Output<Map<String, String>>? = null

A mapping of tags to assign to the resource.