Subnet

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 Subnet’s.

Create a Subnet Resource

new Subnet(name: string, args: SubnetArgs, opts?: CustomResourceOptions);
def Subnet(resource_name, opts=None, address_prefix=None, address_prefixes=None, delegations=None, enforce_private_link_endpoint_network_policies=None, enforce_private_link_service_network_policies=None, name=None, resource_group_name=None, service_endpoints=None, virtual_network_name=None, __props__=None);
func NewSubnet(ctx *Context, name string, args SubnetArgs, opts ...ResourceOption) (*Subnet, error)
public Subnet(string name, SubnetArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args SubnetArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args SubnetArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args SubnetArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

Subnet Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The Subnet resource accepts the following input properties:

ResourceGroupName string

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

VirtualNetworkName string

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

AddressPrefix string

The address prefix to use for the subnet.

Deprecated: Use the address_prefixes property instead.

AddressPrefixes List<string>

The address prefixes to use for the subnet.

Delegations List<SubnetDelegationArgs>

One or more delegation blocks as defined below.

EnforcePrivateLinkEndpointNetworkPolicies bool

Enable or Disable network policies for the private link endpoint on the subnet. Default value is false. Conflicts with enforce_private_link_service_network_policies.

EnforcePrivateLinkServiceNetworkPolicies bool

Enable or Disable network policies for the private link service on the subnet. Default valule is false. Conflicts with enforce_private_link_endpoint_network_policies.

Name string

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

ServiceEndpoints List<string>

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 and Microsoft.Web.

ResourceGroupName string

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

VirtualNetworkName string

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

AddressPrefix string

The address prefix to use for the subnet.

Deprecated: Use the address_prefixes property instead.

AddressPrefixes []string

The address prefixes to use for the subnet.

Delegations []SubnetDelegation

One or more delegation blocks as defined below.

EnforcePrivateLinkEndpointNetworkPolicies bool

Enable or Disable network policies for the private link endpoint on the subnet. Default value is false. Conflicts with enforce_private_link_service_network_policies.

EnforcePrivateLinkServiceNetworkPolicies bool

Enable or Disable network policies for the private link service on the subnet. Default valule is false. Conflicts with enforce_private_link_endpoint_network_policies.

Name string

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

ServiceEndpoints []string

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 and Microsoft.Web.

resourceGroupName string

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

virtualNetworkName string

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

addressPrefix string

The address prefix to use for the subnet.

Deprecated: Use the address_prefixes property instead.

addressPrefixes string[]

The address prefixes to use for the subnet.

delegations SubnetDelegation[]

One or more delegation blocks as defined below.

enforcePrivateLinkEndpointNetworkPolicies boolean

Enable or Disable network policies for the private link endpoint on the subnet. Default value is false. Conflicts with enforce_private_link_service_network_policies.

enforcePrivateLinkServiceNetworkPolicies boolean

Enable or Disable network policies for the private link service on the subnet. Default valule is false. Conflicts with enforce_private_link_endpoint_network_policies.

name string

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

serviceEndpoints string[]

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 and Microsoft.Web.

resource_group_name str

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

virtual_network_name str

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

address_prefix str

The address prefix to use for the subnet.

Deprecated: Use the address_prefixes property instead.

address_prefixes List[str]

The address prefixes to use for the subnet.

delegations List[SubnetDelegation]

One or more delegation blocks as defined below.

enforce_private_link_endpoint_network_policies bool

Enable or Disable network policies for the private link endpoint on the subnet. Default value is false. Conflicts with enforce_private_link_service_network_policies.

enforce_private_link_service_network_policies bool

Enable or Disable network policies for the private link service on the subnet. Default valule is false. Conflicts with enforce_private_link_endpoint_network_policies.

name str

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

service_endpoints List[str]

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 and Microsoft.Web.

Outputs

All input properties are implicitly available as output properties. Additionally, the Subnet resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.

Look up an Existing Subnet Resource

Get an existing Subnet resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: SubnetState, opts?: CustomResourceOptions): Subnet
static get(resource_name, id, opts=None, address_prefix=None, address_prefixes=None, delegations=None, enforce_private_link_endpoint_network_policies=None, enforce_private_link_service_network_policies=None, name=None, resource_group_name=None, service_endpoints=None, virtual_network_name=None, __props__=None);
func GetSubnet(ctx *Context, name string, id IDInput, state *SubnetState, opts ...ResourceOption) (*Subnet, error)
public static Subnet Get(string name, Input<string> id, SubnetState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

AddressPrefix string

The address prefix to use for the subnet.

Deprecated: Use the address_prefixes property instead.

AddressPrefixes List<string>

The address prefixes to use for the subnet.

Delegations List<SubnetDelegationArgs>

One or more delegation blocks as defined below.

EnforcePrivateLinkEndpointNetworkPolicies bool

Enable or Disable network policies for the private link endpoint on the subnet. Default value is false. Conflicts with enforce_private_link_service_network_policies.

EnforcePrivateLinkServiceNetworkPolicies bool

Enable or Disable network policies for the private link service on the subnet. Default valule is false. Conflicts with enforce_private_link_endpoint_network_policies.

Name string

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

ResourceGroupName string

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

ServiceEndpoints List<string>

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 and Microsoft.Web.

VirtualNetworkName string

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

AddressPrefix string

The address prefix to use for the subnet.

Deprecated: Use the address_prefixes property instead.

AddressPrefixes []string

The address prefixes to use for the subnet.

Delegations []SubnetDelegation

One or more delegation blocks as defined below.

EnforcePrivateLinkEndpointNetworkPolicies bool

Enable or Disable network policies for the private link endpoint on the subnet. Default value is false. Conflicts with enforce_private_link_service_network_policies.

EnforcePrivateLinkServiceNetworkPolicies bool

Enable or Disable network policies for the private link service on the subnet. Default valule is false. Conflicts with enforce_private_link_endpoint_network_policies.

Name string

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

ResourceGroupName string

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

ServiceEndpoints []string

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 and Microsoft.Web.

VirtualNetworkName string

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

addressPrefix string

The address prefix to use for the subnet.

Deprecated: Use the address_prefixes property instead.

addressPrefixes string[]

The address prefixes to use for the subnet.

delegations SubnetDelegation[]

One or more delegation blocks as defined below.

enforcePrivateLinkEndpointNetworkPolicies boolean

Enable or Disable network policies for the private link endpoint on the subnet. Default value is false. Conflicts with enforce_private_link_service_network_policies.

enforcePrivateLinkServiceNetworkPolicies boolean

Enable or Disable network policies for the private link service on the subnet. Default valule is false. Conflicts with enforce_private_link_endpoint_network_policies.

name string

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

resourceGroupName string

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

serviceEndpoints string[]

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 and Microsoft.Web.

virtualNetworkName string

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

address_prefix str

The address prefix to use for the subnet.

Deprecated: Use the address_prefixes property instead.

address_prefixes List[str]

The address prefixes to use for the subnet.

delegations List[SubnetDelegation]

One or more delegation blocks as defined below.

enforce_private_link_endpoint_network_policies bool

Enable or Disable network policies for the private link endpoint on the subnet. Default value is false. Conflicts with enforce_private_link_service_network_policies.

enforce_private_link_service_network_policies bool

Enable or Disable network policies for the private link service on the subnet. Default valule is false. Conflicts with enforce_private_link_endpoint_network_policies.

name str

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

resource_group_name str

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

service_endpoints List[str]

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 and Microsoft.Web.

virtual_network_name str

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

Supporting Types

SubnetDelegation

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

Name string

A name for this delegation.

ServiceDelegation SubnetDelegationServiceDelegationArgs

A service_delegation block as defined below.

Name string

A name for this delegation.

ServiceDelegation SubnetDelegationServiceDelegation

A service_delegation block as defined below.

name string

A name for this delegation.

serviceDelegation SubnetDelegationServiceDelegation

A service_delegation block as defined below.

name str

A name for this delegation.

serviceDelegation Dict[SubnetDelegationServiceDelegation]

A service_delegation block as defined below.

SubnetDelegationServiceDelegation

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

Name string

The name of service to delegate to. Possible values include Microsoft.BareMetal/AzureVMware, Microsoft.BareMetal/CrayServers, Microsoft.Batch/batchAccounts, Microsoft.ContainerInstance/containerGroups, Microsoft.Databricks/workspaces, Microsoft.DBforPostgreSQL/serversv2, Microsoft.HardwareSecurityModules/dedicatedHSMs, Microsoft.Logic/integrationServiceEnvironments, Microsoft.Netapp/volumes, Microsoft.ServiceFabricMesh/networks, Microsoft.Sql/managedInstances, Microsoft.Sql/servers, Microsoft.StreamAnalytics/streamingJobs, Microsoft.Web/hostingEnvironments and Microsoft.Web/serverFarms.

Actions List<string>

A list of Actions which should be delegated. This list is specific to the service to delegate to. Possible values include Microsoft.Network/networkinterfaces/*, Microsoft.Network/virtualNetworks/subnets/action, Microsoft.Network/virtualNetworks/subnets/join/action, Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action and Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action.

Name string

The name of service to delegate to. Possible values include Microsoft.BareMetal/AzureVMware, Microsoft.BareMetal/CrayServers, Microsoft.Batch/batchAccounts, Microsoft.ContainerInstance/containerGroups, Microsoft.Databricks/workspaces, Microsoft.DBforPostgreSQL/serversv2, Microsoft.HardwareSecurityModules/dedicatedHSMs, Microsoft.Logic/integrationServiceEnvironments, Microsoft.Netapp/volumes, Microsoft.ServiceFabricMesh/networks, Microsoft.Sql/managedInstances, Microsoft.Sql/servers, Microsoft.StreamAnalytics/streamingJobs, Microsoft.Web/hostingEnvironments and Microsoft.Web/serverFarms.

Actions []string

A list of Actions which should be delegated. This list is specific to the service to delegate to. Possible values include Microsoft.Network/networkinterfaces/*, Microsoft.Network/virtualNetworks/subnets/action, Microsoft.Network/virtualNetworks/subnets/join/action, Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action and Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action.

name string

The name of service to delegate to. Possible values include Microsoft.BareMetal/AzureVMware, Microsoft.BareMetal/CrayServers, Microsoft.Batch/batchAccounts, Microsoft.ContainerInstance/containerGroups, Microsoft.Databricks/workspaces, Microsoft.DBforPostgreSQL/serversv2, Microsoft.HardwareSecurityModules/dedicatedHSMs, Microsoft.Logic/integrationServiceEnvironments, Microsoft.Netapp/volumes, Microsoft.ServiceFabricMesh/networks, Microsoft.Sql/managedInstances, Microsoft.Sql/servers, Microsoft.StreamAnalytics/streamingJobs, Microsoft.Web/hostingEnvironments and Microsoft.Web/serverFarms.

actions string[]

A list of Actions which should be delegated. This list is specific to the service to delegate to. Possible values include Microsoft.Network/networkinterfaces/*, Microsoft.Network/virtualNetworks/subnets/action, Microsoft.Network/virtualNetworks/subnets/join/action, Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action and Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action.

name str

The name of service to delegate to. Possible values include Microsoft.BareMetal/AzureVMware, Microsoft.BareMetal/CrayServers, Microsoft.Batch/batchAccounts, Microsoft.ContainerInstance/containerGroups, Microsoft.Databricks/workspaces, Microsoft.DBforPostgreSQL/serversv2, Microsoft.HardwareSecurityModules/dedicatedHSMs, Microsoft.Logic/integrationServiceEnvironments, Microsoft.Netapp/volumes, Microsoft.ServiceFabricMesh/networks, Microsoft.Sql/managedInstances, Microsoft.Sql/servers, Microsoft.StreamAnalytics/streamingJobs, Microsoft.Web/hostingEnvironments and Microsoft.Web/serverFarms.

actions List[str]

A list of Actions which should be delegated. This list is specific to the service to delegate to. Possible values include Microsoft.Network/networkinterfaces/*, Microsoft.Network/virtualNetworks/subnets/action, Microsoft.Network/virtualNetworks/subnets/join/action, Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action and Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action.

Package Details

Repository
https://github.com/pulumi/pulumi-azure
License
Apache-2.0
Notes
This Pulumi package is based on the azurerm Terraform Provider.