SubnetArgs

data class SubnetArgs(val addressPrefixes: Output<List<String>>? = null, val delegations: Output<List<SubnetDelegationArgs>>? = null, val enforcePrivateLinkEndpointNetworkPolicies: Output<Boolean>? = null, val enforcePrivateLinkServiceNetworkPolicies: Output<Boolean>? = null, val name: Output<String>? = null, val privateEndpointNetworkPoliciesEnabled: Output<Boolean>? = null, val privateLinkServiceNetworkPoliciesEnabled: Output<Boolean>? = null, val resourceGroupName: Output<String>? = null, val serviceEndpointPolicyIds: Output<List<String>>? = null, val serviceEndpoints: Output<List<String>>? = null, val virtualNetworkName: Output<String>? = null) : ConvertibleToJava<SubnetArgs>

Manages a subnet. Subnets represent network segments within the IP space defined by the virtual network.

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 Subnets.

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.VirtualNetwork;
import com.pulumi.azure.network.VirtualNetworkArgs;
import com.pulumi.azure.network.Subnet;
import com.pulumi.azure.network.SubnetArgs;
import com.pulumi.azure.network.inputs.SubnetDelegationArgs;
import com.pulumi.azure.network.inputs.SubnetDelegationServiceDelegationArgs;
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 exampleVirtualNetwork = new VirtualNetwork("exampleVirtualNetwork", VirtualNetworkArgs.builder()
.addressSpaces("10.0.0.0/16")
.location(exampleResourceGroup.location())
.resourceGroupName(exampleResourceGroup.name())
.build());
var exampleSubnet = new Subnet("exampleSubnet", SubnetArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.virtualNetworkName(exampleVirtualNetwork.name())
.addressPrefixes("10.0.1.0/24")
.delegations(SubnetDelegationArgs.builder()
.name("delegation")
.serviceDelegation(SubnetDelegationServiceDelegationArgs.builder()
.name("Microsoft.ContainerInstance/containerGroups")
.actions(
"Microsoft.Network/virtualNetworks/subnets/join/action",
"Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action")
.build())
.build())
.build());
}
}

Import

Subnets can be imported using the resource id, e.g.

$ pulumi import azure:network/subnet:Subnet exampleSubnet /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/virtualNetworks/myvnet1/subnets/mysubnet1

Constructors

Link copied to clipboard
fun SubnetArgs(addressPrefixes: Output<List<String>>? = null, delegations: Output<List<SubnetDelegationArgs>>? = null, enforcePrivateLinkEndpointNetworkPolicies: Output<Boolean>? = null, enforcePrivateLinkServiceNetworkPolicies: Output<Boolean>? = null, name: Output<String>? = null, privateEndpointNetworkPoliciesEnabled: Output<Boolean>? = null, privateLinkServiceNetworkPoliciesEnabled: Output<Boolean>? = null, resourceGroupName: Output<String>? = null, serviceEndpointPolicyIds: Output<List<String>>? = null, serviceEndpoints: Output<List<String>>? = null, virtualNetworkName: Output<String>? = null)

Functions

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

Properties

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

The address prefixes to use for the subnet.

Link copied to clipboard
val delegations: Output<List<SubnetDelegationArgs>>? = null

One or more delegation blocks as defined below.

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

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

Link copied to clipboard

Enable or Disable network policies for the private endpoint on the subnet. Setting this to true will Enable the policy and setting this to false will Disable the policy. Defaults to true.

Link copied to clipboard

Enable or Disable network policies for the private link service on the subnet. Setting this to true will Enable the policy and setting this to false will Disable the policy. Defaults to true.

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

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

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

The list of IDs of Service Endpoint Policies to associate with the subnet.

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

The list of Service endpoints to associate with the subnet. Possible values include: Microsoft.AzureActiveDirectory, Microsoft.AzureCosmosDB, Microsoft.ContainerRegistry, Microsoft.EventHub, Microsoft.KeyVault, Microsoft.ServiceBus, Microsoft.Sql, Microsoft.Storage, Microsoft.Storage.Global and Microsoft.Web.

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

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