Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.network.kotlin
import com.pulumi.azure.network.kotlin.outputs.SubnetDelegation
import com.pulumi.azure.network.kotlin.outputs.SubnetDelegation.Companion.toKotlin
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.Deprecated
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
/**
* Builder for [Subnet].
*/
@PulumiTagMarker
public class SubnetResourceBuilder internal constructor() {
public var name: String? = null
public var args: SubnetArgs = SubnetArgs()
public var opts: CustomResourceOptions = CustomResourceOptions()
/**
* @param name The _unique_ name of the resulting resource.
*/
public fun name(`value`: String) {
this.name = value
}
/**
* @param block The arguments to use to populate this resource's properties.
*/
public suspend fun args(block: suspend SubnetArgsBuilder.() -> Unit) {
val builder = SubnetArgsBuilder()
block(builder)
this.args = builder.build()
}
/**
* @param block A bag of options that control this resource's behavior.
*/
public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
}
internal fun build(): Subnet {
val builtJavaResource = com.pulumi.azure.network.Subnet(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Subnet(builtJavaResource)
}
}
/**
* 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
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azure from "@pulumi/azure";
* const example = new azure.core.ResourceGroup("example", {
* name: "example-resources",
* location: "West Europe",
* });
* const exampleVirtualNetwork = new azure.network.VirtualNetwork("example", {
* name: "example-vnet",
* addressSpaces: ["10.0.0.0/16"],
* location: example.location,
* resourceGroupName: example.name,
* });
* const exampleSubnet = new azure.network.Subnet("example", {
* name: "example-subnet",
* resourceGroupName: example.name,
* virtualNetworkName: exampleVirtualNetwork.name,
* addressPrefixes: ["10.0.1.0/24"],
* delegations: [{
* name: "delegation",
* serviceDelegation: {
* name: "Microsoft.ContainerInstance/containerGroups",
* actions: [
* "Microsoft.Network/virtualNetworks/subnets/join/action",
* "Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action",
* ],
* },
* }],
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* example = azure.core.ResourceGroup("example",
* name="example-resources",
* location="West Europe")
* example_virtual_network = azure.network.VirtualNetwork("example",
* name="example-vnet",
* address_spaces=["10.0.0.0/16"],
* location=example.location,
* resource_group_name=example.name)
* example_subnet = azure.network.Subnet("example",
* name="example-subnet",
* resource_group_name=example.name,
* virtual_network_name=example_virtual_network.name,
* address_prefixes=["10.0.1.0/24"],
* delegations=[{
* "name": "delegation",
* "service_delegation": {
* "name": "Microsoft.ContainerInstance/containerGroups",
* "actions": [
* "Microsoft.Network/virtualNetworks/subnets/join/action",
* "Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action",
* ],
* },
* }])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Azure = Pulumi.Azure;
* return await Deployment.RunAsync(() =>
* {
* var example = new Azure.Core.ResourceGroup("example", new()
* {
* Name = "example-resources",
* Location = "West Europe",
* });
* var exampleVirtualNetwork = new Azure.Network.VirtualNetwork("example", new()
* {
* Name = "example-vnet",
* AddressSpaces = new[]
* {
* "10.0.0.0/16",
* },
* Location = example.Location,
* ResourceGroupName = example.Name,
* });
* var exampleSubnet = new Azure.Network.Subnet("example", new()
* {
* Name = "example-subnet",
* ResourceGroupName = example.Name,
* VirtualNetworkName = exampleVirtualNetwork.Name,
* AddressPrefixes = new[]
* {
* "10.0.1.0/24",
* },
* Delegations = new[]
* {
* new Azure.Network.Inputs.SubnetDelegationArgs
* {
* Name = "delegation",
* ServiceDelegation = new Azure.Network.Inputs.SubnetDelegationServiceDelegationArgs
* {
* Name = "Microsoft.ContainerInstance/containerGroups",
* Actions = new[]
* {
* "Microsoft.Network/virtualNetworks/subnets/join/action",
* "Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action",
* },
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/network"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
* Name: pulumi.String("example-resources"),
* Location: pulumi.String("West Europe"),
* })
* if err != nil {
* return err
* }
* exampleVirtualNetwork, err := network.NewVirtualNetwork(ctx, "example", &network.VirtualNetworkArgs{
* Name: pulumi.String("example-vnet"),
* AddressSpaces: pulumi.StringArray{
* pulumi.String("10.0.0.0/16"),
* },
* Location: example.Location,
* ResourceGroupName: example.Name,
* })
* if err != nil {
* return err
* }
* _, err = network.NewSubnet(ctx, "example", &network.SubnetArgs{
* Name: pulumi.String("example-subnet"),
* ResourceGroupName: example.Name,
* VirtualNetworkName: exampleVirtualNetwork.Name,
* AddressPrefixes: pulumi.StringArray{
* pulumi.String("10.0.1.0/24"),
* },
* Delegations: network.SubnetDelegationArray{
* &network.SubnetDelegationArgs{
* Name: pulumi.String("delegation"),
* ServiceDelegation: &network.SubnetDelegationServiceDelegationArgs{
* Name: pulumi.String("Microsoft.ContainerInstance/containerGroups"),
* Actions: pulumi.StringArray{
* pulumi.String("Microsoft.Network/virtualNetworks/subnets/join/action"),
* pulumi.String("Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action"),
* },
* },
* },
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* 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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
* .name("example-resources")
* .location("West Europe")
* .build());
* var exampleVirtualNetwork = new VirtualNetwork("exampleVirtualNetwork", VirtualNetworkArgs.builder()
* .name("example-vnet")
* .addressSpaces("10.0.0.0/16")
* .location(example.location())
* .resourceGroupName(example.name())
* .build());
* var exampleSubnet = new Subnet("exampleSubnet", SubnetArgs.builder()
* .name("example-subnet")
* .resourceGroupName(example.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());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: azure:core:ResourceGroup
* properties:
* name: example-resources
* location: West Europe
* exampleVirtualNetwork:
* type: azure:network:VirtualNetwork
* name: example
* properties:
* name: example-vnet
* addressSpaces:
* - 10.0.0.0/16
* location: ${example.location}
* resourceGroupName: ${example.name}
* exampleSubnet:
* type: azure:network:Subnet
* name: example
* properties:
* name: example-subnet
* resourceGroupName: ${example.name}
* virtualNetworkName: ${exampleVirtualNetwork.name}
* addressPrefixes:
* - 10.0.1.0/24
* delegations:
* - name: delegation
* serviceDelegation:
* name: Microsoft.ContainerInstance/containerGroups
* actions:
* - Microsoft.Network/virtualNetworks/subnets/join/action
* - Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action
* ```
*
* ## Import
* Subnets can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:network/subnet:Subnet exampleSubnet /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/virtualNetworks/myvnet1/subnets/mysubnet1
* ```
*/
public class Subnet internal constructor(
override val javaResource: com.pulumi.azure.network.Subnet,
) : KotlinCustomResource(javaResource, SubnetMapper) {
/**
* The address prefixes to use for the subnet.
* > **NOTE:** Currently only a single address prefix can be set as the [Multiple Subnet Address Prefixes Feature](https://github.com/Azure/azure-cli/issues/18194#issuecomment-880484269) is not yet in public preview or general availability.
*/
public val addressPrefixes: Output>
get() = javaResource.addressPrefixes().applyValue({ args0 -> args0.map({ args0 -> args0 }) })
/**
* Enable default outbound access to the internet for the subnet. Defaults to `true`.
*/
public val defaultOutboundAccessEnabled: Output?
get() = javaResource.defaultOutboundAccessEnabled().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* One or more `delegation` blocks as defined below.
*/
public val delegations: Output>?
get() = javaResource.delegations().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> toKotlin(args0) })
})
}).orElse(null)
})
@Deprecated(
message = """
`enforce_private_link_endpoint_network_policies` will be removed in favour of the property
`private_endpoint_network_policies` in version 4.0 of the AzureRM Provider
""",
)
public val enforcePrivateLinkEndpointNetworkPolicies: Output
get() = javaResource.enforcePrivateLinkEndpointNetworkPolicies().applyValue({ args0 -> args0 })
@Deprecated(
message = """
`enforce_private_link_service_network_policies` will be removed in favour of the property
`private_link_service_network_policies_enabled` in version 4.0 of the AzureRM Provider
""",
)
public val enforcePrivateLinkServiceNetworkPolicies: Output
get() = javaResource.enforcePrivateLinkServiceNetworkPolicies().applyValue({ args0 -> args0 })
/**
* The name of the subnet. Changing this forces a new resource to be created.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* Enable or Disable network policies for the private endpoint on the subnet. Possible values are `Disabled`, `Enabled`, `NetworkSecurityGroupEnabled` and `RouteTableEnabled`. Defaults to `Disabled`.
* > **NOTE:** If you don't want to use network policies like user-defined Routes and Network Security Groups, you need to set `private_endpoint_network_policies` in the subnet to `Disabled`. This setting only applies to Private Endpoints in the Subnet and affects all Private Endpoints in the Subnet. For other resources in the Subnet, access is controlled based via the Network Security Group which can be configured using the `azure.network.SubnetNetworkSecurityGroupAssociation` resource.
* > **NOTE:** If you want to use network policies like user-defined Routes and Network Security Groups, you need to set the `private_endpoint_network_policies` in the Subnet to `Enabled`/`NetworkSecurityGroupEnabled`/`RouteTableEnabled`. This setting only applies to Private Endpoints in the Subnet and affects all Private Endpoints in the Subnet. For other resources in the Subnet, access is controlled based via the Network Security Group which can be configured using the `azure.network.SubnetNetworkSecurityGroupAssociation` resource.
* > **NOTE:** See more details from [Manage network policies for Private Endpoints](https://learn.microsoft.com/en-gb/azure/private-link/disable-private-endpoint-network-policy?tabs=network-policy-portal).
*/
public val privateEndpointNetworkPolicies: Output
get() = javaResource.privateEndpointNetworkPolicies().applyValue({ args0 -> args0 })
@Deprecated(
message = """
`private_endpoint_network_policies_enabled` will be removed in favour of the property
`private_endpoint_network_policies` in version 4.0 of the AzureRM Provider
""",
)
public val privateEndpointNetworkPoliciesEnabled: Output
get() = javaResource.privateEndpointNetworkPoliciesEnabled().applyValue({ args0 -> args0 })
/**
* Enable or Disable network policies for the private link service on the subnet. Defaults to `true`.
* > **NOTE:** When configuring Azure Private Link service, the explicit setting `private_link_service_network_policies_enabled` must be set to `false` in the subnet since Private Link Service does not support network policies like user-defined Routes and Network Security Groups. This setting only affects the Private Link service. For other resources in the subnet, access is controlled based on the Network Security Group which can be configured using the `azure.network.SubnetNetworkSecurityGroupAssociation` resource. See more details from [Manage network policies for Private Link Services](https://learn.microsoft.com/en-gb/azure/private-link/disable-private-link-service-network-policy?tabs=private-link-network-policy-powershell).
*/
public val privateLinkServiceNetworkPoliciesEnabled: Output
get() = javaResource.privateLinkServiceNetworkPoliciesEnabled().applyValue({ args0 -> args0 })
/**
* The name of the resource group in which to create the subnet. This must be the resource group that the virtual network resides in. Changing this forces a new resource to be created.
*/
public val resourceGroupName: Output
get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })
/**
* The list of IDs of Service Endpoint Policies to associate with the subnet.
*/
public val serviceEndpointPolicyIds: Output>?
get() = javaResource.serviceEndpointPolicyIds().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 -> args0 })
}).orElse(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`.
* > **NOTE:** In order to use `Microsoft.Storage.Global` service endpoint (which allows access to virtual networks in other regions), you must enable the `AllowGlobalTagsForStorage` feature in your subscription. This is currently a preview feature, please see the [official documentation](https://learn.microsoft.com/en-us/azure/storage/common/storage-network-security?tabs=azure-cli#enabling-access-to-virtual-networks-in-other-regions-preview) for more information.
*/
public val serviceEndpoints: Output>?
get() = javaResource.serviceEndpoints().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 -> args0 })
}).orElse(null)
})
/**
* The name of the virtual network to which to attach the subnet. Changing this forces a new resource to be created.
*/
public val virtualNetworkName: Output
get() = javaResource.virtualNetworkName().applyValue({ args0 -> args0 })
}
public object SubnetMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.network.Subnet::class == javaResource::class
override fun map(javaResource: Resource): Subnet = Subnet(
javaResource as
com.pulumi.azure.network.Subnet,
)
}
/**
* @see [Subnet].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [Subnet].
*/
public suspend fun subnet(name: String, block: suspend SubnetResourceBuilder.() -> Unit): Subnet {
val builder = SubnetResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [Subnet].
* @param name The _unique_ name of the resulting resource.
*/
public fun subnet(name: String): Subnet {
val builder = SubnetResourceBuilder()
builder.name(name)
return builder.build()
}