SubnetArgs

data class SubnetArgs(val addressPrefix: Output<String>? = null, val addressPrefixes: Output<List<String>>? = null, val applicationGatewayIPConfigurations: Output<List<ApplicationGatewayIPConfigurationArgs>>? = null, val delegations: Output<List<DelegationArgs>>? = null, val id: Output<String>? = null, val ipAllocations: Output<List<SubResourceArgs>>? = null, val name: Output<String>? = null, val natGateway: Output<SubResourceArgs>? = null, val networkSecurityGroup: Output<NetworkSecurityGroupArgs>? = null, val privateEndpointNetworkPolicies: Output<Either<String, VirtualNetworkPrivateEndpointNetworkPolicies>>? = null, val privateLinkServiceNetworkPolicies: Output<Either<String, VirtualNetworkPrivateLinkServiceNetworkPolicies>>? = null, val resourceGroupName: Output<String>? = null, val routeTable: Output<RouteTableArgs>? = null, val serviceEndpointPolicies: Output<List<ServiceEndpointPolicyArgs>>? = null, val serviceEndpoints: Output<List<ServiceEndpointPropertiesFormatArgs>>? = null, val subnetName: Output<String>? = null, val type: Output<String>? = null, val virtualNetworkName: Output<String>? = null) : ConvertibleToJava<SubnetArgs>

Subnet in a virtual network resource. Uses Azure REST API version 2023-02-01. In version 1.x of the Azure Native provider, it used API version 2020-11-01. Other available API versions: 2019-02-01, 2019-06-01, 2019-08-01, 2020-06-01, 2022-07-01, 2023-04-01, 2023-05-01, 2023-06-01, 2023-09-01, 2023-11-01, 2024-01-01, 2024-03-01, 2024-05-01.

Example Usage

Create subnet

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var subnet = new AzureNative.Network.Subnet("subnet", new()
{
AddressPrefix = "10.0.0.0/16",
ResourceGroupName = "subnet-test",
SubnetName = "subnet1",
VirtualNetworkName = "vnetname",
});
});
package main
import (
network "github.com/pulumi/pulumi-azure-native-sdk/network/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := network.NewSubnet(ctx, "subnet", &network.SubnetArgs{
AddressPrefix: pulumi.String("10.0.0.0/16"),
ResourceGroupName: pulumi.String("subnet-test"),
SubnetName: pulumi.String("subnet1"),
VirtualNetworkName: pulumi.String("vnetname"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.network.Subnet;
import com.pulumi.azurenative.network.SubnetArgs;
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 subnet = new Subnet("subnet", SubnetArgs.builder()
.addressPrefix("10.0.0.0/16")
.resourceGroupName("subnet-test")
.subnetName("subnet1")
.virtualNetworkName("vnetname")
.build());
}
}

Create subnet with a delegation

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var subnet = new AzureNative.Network.Subnet("subnet", new()
{
AddressPrefix = "10.0.0.0/16",
ResourceGroupName = "subnet-test",
SubnetName = "subnet1",
VirtualNetworkName = "vnetname",
});
});
package main
import (
network "github.com/pulumi/pulumi-azure-native-sdk/network/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := network.NewSubnet(ctx, "subnet", &network.SubnetArgs{
AddressPrefix: pulumi.String("10.0.0.0/16"),
ResourceGroupName: pulumi.String("subnet-test"),
SubnetName: pulumi.String("subnet1"),
VirtualNetworkName: pulumi.String("vnetname"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.network.Subnet;
import com.pulumi.azurenative.network.SubnetArgs;
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 subnet = new Subnet("subnet", SubnetArgs.builder()
.addressPrefix("10.0.0.0/16")
.resourceGroupName("subnet-test")
.subnetName("subnet1")
.virtualNetworkName("vnetname")
.build());
}
}

Create subnet with service endpoints

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var subnet = new AzureNative.Network.Subnet("subnet", new()
{
AddressPrefix = "10.0.0.0/16",
ResourceGroupName = "subnet-test",
ServiceEndpoints = new[]
{
new AzureNative.Network.Inputs.ServiceEndpointPropertiesFormatArgs
{
Service = "Microsoft.Storage",
},
},
SubnetName = "subnet1",
VirtualNetworkName = "vnetname",
});
});
package main
import (
network "github.com/pulumi/pulumi-azure-native-sdk/network/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := network.NewSubnet(ctx, "subnet", &network.SubnetArgs{
AddressPrefix: pulumi.String("10.0.0.0/16"),
ResourceGroupName: pulumi.String("subnet-test"),
ServiceEndpoints: network.ServiceEndpointPropertiesFormatArray{
&network.ServiceEndpointPropertiesFormatArgs{
Service: pulumi.String("Microsoft.Storage"),
},
},
SubnetName: pulumi.String("subnet1"),
VirtualNetworkName: pulumi.String("vnetname"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.network.Subnet;
import com.pulumi.azurenative.network.SubnetArgs;
import com.pulumi.azurenative.network.inputs.ServiceEndpointPropertiesFormatArgs;
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 subnet = new Subnet("subnet", SubnetArgs.builder()
.addressPrefix("10.0.0.0/16")
.resourceGroupName("subnet-test")
.serviceEndpoints(ServiceEndpointPropertiesFormatArgs.builder()
.service("Microsoft.Storage")
.build())
.subnetName("subnet1")
.virtualNetworkName("vnetname")
.build());
}
}

Import

An existing resource can be imported using its type token, name, and identifier, e.g.

$ pulumi import azure-native:network:Subnet subnet1 /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}

Constructors

Link copied to clipboard
constructor(addressPrefix: Output<String>? = null, addressPrefixes: Output<List<String>>? = null, applicationGatewayIPConfigurations: Output<List<ApplicationGatewayIPConfigurationArgs>>? = null, delegations: Output<List<DelegationArgs>>? = null, id: Output<String>? = null, ipAllocations: Output<List<SubResourceArgs>>? = null, name: Output<String>? = null, natGateway: Output<SubResourceArgs>? = null, networkSecurityGroup: Output<NetworkSecurityGroupArgs>? = null, privateEndpointNetworkPolicies: Output<Either<String, VirtualNetworkPrivateEndpointNetworkPolicies>>? = null, privateLinkServiceNetworkPolicies: Output<Either<String, VirtualNetworkPrivateLinkServiceNetworkPolicies>>? = null, resourceGroupName: Output<String>? = null, routeTable: Output<RouteTableArgs>? = null, serviceEndpointPolicies: Output<List<ServiceEndpointPolicyArgs>>? = null, serviceEndpoints: Output<List<ServiceEndpointPropertiesFormatArgs>>? = null, subnetName: Output<String>? = null, type: Output<String>? = null, virtualNetworkName: Output<String>? = null)

Properties

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

The address prefix for the subnet.

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

List of address prefixes for the subnet.

Link copied to clipboard

Application gateway IP configurations of virtual network resource.

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

An array of references to the delegations on the subnet.

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

Resource ID.

Link copied to clipboard
val ipAllocations: Output<List<SubResourceArgs>>? = null

Array of IpAllocation which reference this subnet.

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

The name of the resource that is unique within a resource group. This name can be used to access the resource.

Link copied to clipboard
val natGateway: Output<SubResourceArgs>? = null

Nat gateway associated with this subnet.

Link copied to clipboard

The reference to the NetworkSecurityGroup resource.

Link copied to clipboard

Enable or Disable apply network policies on private end point in the subnet.

Link copied to clipboard

Enable or Disable apply network policies on private link service in the subnet.

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

The name of the resource group.

Link copied to clipboard
val routeTable: Output<RouteTableArgs>? = null

The reference to the RouteTable resource.

Link copied to clipboard

An array of service endpoint policies.

Link copied to clipboard

An array of service endpoints.

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

The name of the subnet.

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

Resource type.

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

The name of the virtual network.

Functions

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