Please wait. This can take some minutes ...
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.
com.pulumi.gcp.compute.kotlin.Subnetwork.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.compute.kotlin
import com.pulumi.core.Output
import com.pulumi.gcp.compute.kotlin.outputs.SubnetworkLogConfig
import com.pulumi.gcp.compute.kotlin.outputs.SubnetworkSecondaryIpRange
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
import com.pulumi.gcp.compute.kotlin.outputs.SubnetworkLogConfig.Companion.toKotlin as subnetworkLogConfigToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.SubnetworkSecondaryIpRange.Companion.toKotlin as subnetworkSecondaryIpRangeToKotlin
/**
* Builder for [Subnetwork].
*/
@PulumiTagMarker
public class SubnetworkResourceBuilder internal constructor() {
public var name: String? = null
public var args: SubnetworkArgs = SubnetworkArgs()
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 SubnetworkArgsBuilder.() -> Unit) {
val builder = SubnetworkArgsBuilder()
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(): Subnetwork {
val builtJavaResource = com.pulumi.gcp.compute.Subnetwork(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Subnetwork(builtJavaResource)
}
}
/**
* A VPC network is a virtual version of the traditional physical networks
* that exist within and between physical data centers. A VPC network
* provides connectivity for your Compute Engine virtual machine (VM)
* instances, Container Engine containers, App Engine Flex services, and
* other network-related resources.
* Each GCP project contains one or more VPC networks. Each VPC network is a
* global entity spanning all GCP regions. This global VPC network allows VM
* instances and other resources to communicate with each other via internal,
* private IP addresses.
* Each VPC network is subdivided into subnets, and each subnet is contained
* within a single region. You can have more than one subnet in a region for
* a given VPC network. Each subnet has a contiguous private RFC1918 IP
* space. You create instances, containers, and the like in these subnets.
* When you create an instance, you must create it in a subnet, and the
* instance draws its internal IP address from that subnet.
* Virtual machine (VM) instances in a VPC network can communicate with
* instances in all other subnets of the same VPC network, regardless of
* region, using their RFC1918 private IP addresses. You can isolate portions
* of the network, even entire subnets, using firewall rules.
* To get more information about Subnetwork, see:
* * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/subnetworks)
* * How-to Guides
* * [Cloud Networking](https://cloud.google.com/vpc/docs/using-vpc)
* * [Private Google Access](https://cloud.google.com/vpc/docs/configure-private-google-access)
* ## Example Usage
* ### Subnetwork Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const custom_test = new gcp.compute.Network("custom-test", {
* name: "test-network",
* autoCreateSubnetworks: false,
* });
* const network_with_private_secondary_ip_ranges = new gcp.compute.Subnetwork("network-with-private-secondary-ip-ranges", {
* name: "test-subnetwork",
* ipCidrRange: "10.2.0.0/16",
* region: "us-central1",
* network: custom_test.id,
* secondaryIpRanges: [{
* rangeName: "tf-test-secondary-range-update1",
* ipCidrRange: "192.168.10.0/24",
* }],
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* custom_test = gcp.compute.Network("custom-test",
* name="test-network",
* auto_create_subnetworks=False)
* network_with_private_secondary_ip_ranges = gcp.compute.Subnetwork("network-with-private-secondary-ip-ranges",
* name="test-subnetwork",
* ip_cidr_range="10.2.0.0/16",
* region="us-central1",
* network=custom_test.id,
* secondary_ip_ranges=[{
* "range_name": "tf-test-secondary-range-update1",
* "ip_cidr_range": "192.168.10.0/24",
* }])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var custom_test = new Gcp.Compute.Network("custom-test", new()
* {
* Name = "test-network",
* AutoCreateSubnetworks = false,
* });
* var network_with_private_secondary_ip_ranges = new Gcp.Compute.Subnetwork("network-with-private-secondary-ip-ranges", new()
* {
* Name = "test-subnetwork",
* IpCidrRange = "10.2.0.0/16",
* Region = "us-central1",
* Network = custom_test.Id,
* SecondaryIpRanges = new[]
* {
* new Gcp.Compute.Inputs.SubnetworkSecondaryIpRangeArgs
* {
* RangeName = "tf-test-secondary-range-update1",
* IpCidrRange = "192.168.10.0/24",
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := compute.NewNetwork(ctx, "custom-test", &compute.NetworkArgs{
* Name: pulumi.String("test-network"),
* AutoCreateSubnetworks: pulumi.Bool(false),
* })
* if err != nil {
* return err
* }
* _, err = compute.NewSubnetwork(ctx, "network-with-private-secondary-ip-ranges", &compute.SubnetworkArgs{
* Name: pulumi.String("test-subnetwork"),
* IpCidrRange: pulumi.String("10.2.0.0/16"),
* Region: pulumi.String("us-central1"),
* Network: custom_test.ID(),
* SecondaryIpRanges: compute.SubnetworkSecondaryIpRangeArray{
* &compute.SubnetworkSecondaryIpRangeArgs{
* RangeName: pulumi.String("tf-test-secondary-range-update1"),
* IpCidrRange: pulumi.String("192.168.10.0/24"),
* },
* },
* })
* 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.gcp.compute.Network;
* import com.pulumi.gcp.compute.NetworkArgs;
* import com.pulumi.gcp.compute.Subnetwork;
* import com.pulumi.gcp.compute.SubnetworkArgs;
* import com.pulumi.gcp.compute.inputs.SubnetworkSecondaryIpRangeArgs;
* 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 custom_test = new Network("custom-test", NetworkArgs.builder()
* .name("test-network")
* .autoCreateSubnetworks(false)
* .build());
* var network_with_private_secondary_ip_ranges = new Subnetwork("network-with-private-secondary-ip-ranges", SubnetworkArgs.builder()
* .name("test-subnetwork")
* .ipCidrRange("10.2.0.0/16")
* .region("us-central1")
* .network(custom_test.id())
* .secondaryIpRanges(SubnetworkSecondaryIpRangeArgs.builder()
* .rangeName("tf-test-secondary-range-update1")
* .ipCidrRange("192.168.10.0/24")
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* network-with-private-secondary-ip-ranges:
* type: gcp:compute:Subnetwork
* properties:
* name: test-subnetwork
* ipCidrRange: 10.2.0.0/16
* region: us-central1
* network: ${["custom-test"].id}
* secondaryIpRanges:
* - rangeName: tf-test-secondary-range-update1
* ipCidrRange: 192.168.10.0/24
* custom-test:
* type: gcp:compute:Network
* properties:
* name: test-network
* autoCreateSubnetworks: false
* ```
*
* ### Subnetwork Logging Config
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const custom_test = new gcp.compute.Network("custom-test", {
* name: "log-test-network",
* autoCreateSubnetworks: false,
* });
* const subnet_with_logging = new gcp.compute.Subnetwork("subnet-with-logging", {
* name: "log-test-subnetwork",
* ipCidrRange: "10.2.0.0/16",
* region: "us-central1",
* network: custom_test.id,
* logConfig: {
* aggregationInterval: "INTERVAL_10_MIN",
* flowSampling: 0.5,
* metadata: "INCLUDE_ALL_METADATA",
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* custom_test = gcp.compute.Network("custom-test",
* name="log-test-network",
* auto_create_subnetworks=False)
* subnet_with_logging = gcp.compute.Subnetwork("subnet-with-logging",
* name="log-test-subnetwork",
* ip_cidr_range="10.2.0.0/16",
* region="us-central1",
* network=custom_test.id,
* log_config={
* "aggregation_interval": "INTERVAL_10_MIN",
* "flow_sampling": 0.5,
* "metadata": "INCLUDE_ALL_METADATA",
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var custom_test = new Gcp.Compute.Network("custom-test", new()
* {
* Name = "log-test-network",
* AutoCreateSubnetworks = false,
* });
* var subnet_with_logging = new Gcp.Compute.Subnetwork("subnet-with-logging", new()
* {
* Name = "log-test-subnetwork",
* IpCidrRange = "10.2.0.0/16",
* Region = "us-central1",
* Network = custom_test.Id,
* LogConfig = new Gcp.Compute.Inputs.SubnetworkLogConfigArgs
* {
* AggregationInterval = "INTERVAL_10_MIN",
* FlowSampling = 0.5,
* Metadata = "INCLUDE_ALL_METADATA",
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := compute.NewNetwork(ctx, "custom-test", &compute.NetworkArgs{
* Name: pulumi.String("log-test-network"),
* AutoCreateSubnetworks: pulumi.Bool(false),
* })
* if err != nil {
* return err
* }
* _, err = compute.NewSubnetwork(ctx, "subnet-with-logging", &compute.SubnetworkArgs{
* Name: pulumi.String("log-test-subnetwork"),
* IpCidrRange: pulumi.String("10.2.0.0/16"),
* Region: pulumi.String("us-central1"),
* Network: custom_test.ID(),
* LogConfig: &compute.SubnetworkLogConfigArgs{
* AggregationInterval: pulumi.String("INTERVAL_10_MIN"),
* FlowSampling: pulumi.Float64(0.5),
* Metadata: pulumi.String("INCLUDE_ALL_METADATA"),
* },
* })
* 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.gcp.compute.Network;
* import com.pulumi.gcp.compute.NetworkArgs;
* import com.pulumi.gcp.compute.Subnetwork;
* import com.pulumi.gcp.compute.SubnetworkArgs;
* import com.pulumi.gcp.compute.inputs.SubnetworkLogConfigArgs;
* 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 custom_test = new Network("custom-test", NetworkArgs.builder()
* .name("log-test-network")
* .autoCreateSubnetworks(false)
* .build());
* var subnet_with_logging = new Subnetwork("subnet-with-logging", SubnetworkArgs.builder()
* .name("log-test-subnetwork")
* .ipCidrRange("10.2.0.0/16")
* .region("us-central1")
* .network(custom_test.id())
* .logConfig(SubnetworkLogConfigArgs.builder()
* .aggregationInterval("INTERVAL_10_MIN")
* .flowSampling(0.5)
* .metadata("INCLUDE_ALL_METADATA")
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* subnet-with-logging:
* type: gcp:compute:Subnetwork
* properties:
* name: log-test-subnetwork
* ipCidrRange: 10.2.0.0/16
* region: us-central1
* network: ${["custom-test"].id}
* logConfig:
* aggregationInterval: INTERVAL_10_MIN
* flowSampling: 0.5
* metadata: INCLUDE_ALL_METADATA
* custom-test:
* type: gcp:compute:Network
* properties:
* name: log-test-network
* autoCreateSubnetworks: false
* ```
*
* ### Subnetwork Internal L7lb
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const custom_test = new gcp.compute.Network("custom-test", {
* name: "l7lb-test-network",
* autoCreateSubnetworks: false,
* });
* const network_for_l7lb = new gcp.compute.Subnetwork("network-for-l7lb", {
* name: "l7lb-test-subnetwork",
* ipCidrRange: "10.0.0.0/22",
* region: "us-central1",
* purpose: "REGIONAL_MANAGED_PROXY",
* role: "ACTIVE",
* network: custom_test.id,
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* custom_test = gcp.compute.Network("custom-test",
* name="l7lb-test-network",
* auto_create_subnetworks=False)
* network_for_l7lb = gcp.compute.Subnetwork("network-for-l7lb",
* name="l7lb-test-subnetwork",
* ip_cidr_range="10.0.0.0/22",
* region="us-central1",
* purpose="REGIONAL_MANAGED_PROXY",
* role="ACTIVE",
* network=custom_test.id)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var custom_test = new Gcp.Compute.Network("custom-test", new()
* {
* Name = "l7lb-test-network",
* AutoCreateSubnetworks = false,
* });
* var network_for_l7lb = new Gcp.Compute.Subnetwork("network-for-l7lb", new()
* {
* Name = "l7lb-test-subnetwork",
* IpCidrRange = "10.0.0.0/22",
* Region = "us-central1",
* Purpose = "REGIONAL_MANAGED_PROXY",
* Role = "ACTIVE",
* Network = custom_test.Id,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := compute.NewNetwork(ctx, "custom-test", &compute.NetworkArgs{
* Name: pulumi.String("l7lb-test-network"),
* AutoCreateSubnetworks: pulumi.Bool(false),
* })
* if err != nil {
* return err
* }
* _, err = compute.NewSubnetwork(ctx, "network-for-l7lb", &compute.SubnetworkArgs{
* Name: pulumi.String("l7lb-test-subnetwork"),
* IpCidrRange: pulumi.String("10.0.0.0/22"),
* Region: pulumi.String("us-central1"),
* Purpose: pulumi.String("REGIONAL_MANAGED_PROXY"),
* Role: pulumi.String("ACTIVE"),
* Network: custom_test.ID(),
* })
* 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.gcp.compute.Network;
* import com.pulumi.gcp.compute.NetworkArgs;
* import com.pulumi.gcp.compute.Subnetwork;
* import com.pulumi.gcp.compute.SubnetworkArgs;
* 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 custom_test = new Network("custom-test", NetworkArgs.builder()
* .name("l7lb-test-network")
* .autoCreateSubnetworks(false)
* .build());
* var network_for_l7lb = new Subnetwork("network-for-l7lb", SubnetworkArgs.builder()
* .name("l7lb-test-subnetwork")
* .ipCidrRange("10.0.0.0/22")
* .region("us-central1")
* .purpose("REGIONAL_MANAGED_PROXY")
* .role("ACTIVE")
* .network(custom_test.id())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* network-for-l7lb:
* type: gcp:compute:Subnetwork
* properties:
* name: l7lb-test-subnetwork
* ipCidrRange: 10.0.0.0/22
* region: us-central1
* purpose: REGIONAL_MANAGED_PROXY
* role: ACTIVE
* network: ${["custom-test"].id}
* custom-test:
* type: gcp:compute:Network
* properties:
* name: l7lb-test-network
* autoCreateSubnetworks: false
* ```
*
* ### Subnetwork Ipv6
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const custom_test = new gcp.compute.Network("custom-test", {
* name: "ipv6-test-network",
* autoCreateSubnetworks: false,
* });
* const subnetwork_ipv6 = new gcp.compute.Subnetwork("subnetwork-ipv6", {
* name: "ipv6-test-subnetwork",
* ipCidrRange: "10.0.0.0/22",
* region: "us-west2",
* stackType: "IPV4_IPV6",
* ipv6AccessType: "EXTERNAL",
* network: custom_test.id,
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* custom_test = gcp.compute.Network("custom-test",
* name="ipv6-test-network",
* auto_create_subnetworks=False)
* subnetwork_ipv6 = gcp.compute.Subnetwork("subnetwork-ipv6",
* name="ipv6-test-subnetwork",
* ip_cidr_range="10.0.0.0/22",
* region="us-west2",
* stack_type="IPV4_IPV6",
* ipv6_access_type="EXTERNAL",
* network=custom_test.id)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var custom_test = new Gcp.Compute.Network("custom-test", new()
* {
* Name = "ipv6-test-network",
* AutoCreateSubnetworks = false,
* });
* var subnetwork_ipv6 = new Gcp.Compute.Subnetwork("subnetwork-ipv6", new()
* {
* Name = "ipv6-test-subnetwork",
* IpCidrRange = "10.0.0.0/22",
* Region = "us-west2",
* StackType = "IPV4_IPV6",
* Ipv6AccessType = "EXTERNAL",
* Network = custom_test.Id,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := compute.NewNetwork(ctx, "custom-test", &compute.NetworkArgs{
* Name: pulumi.String("ipv6-test-network"),
* AutoCreateSubnetworks: pulumi.Bool(false),
* })
* if err != nil {
* return err
* }
* _, err = compute.NewSubnetwork(ctx, "subnetwork-ipv6", &compute.SubnetworkArgs{
* Name: pulumi.String("ipv6-test-subnetwork"),
* IpCidrRange: pulumi.String("10.0.0.0/22"),
* Region: pulumi.String("us-west2"),
* StackType: pulumi.String("IPV4_IPV6"),
* Ipv6AccessType: pulumi.String("EXTERNAL"),
* Network: custom_test.ID(),
* })
* 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.gcp.compute.Network;
* import com.pulumi.gcp.compute.NetworkArgs;
* import com.pulumi.gcp.compute.Subnetwork;
* import com.pulumi.gcp.compute.SubnetworkArgs;
* 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 custom_test = new Network("custom-test", NetworkArgs.builder()
* .name("ipv6-test-network")
* .autoCreateSubnetworks(false)
* .build());
* var subnetwork_ipv6 = new Subnetwork("subnetwork-ipv6", SubnetworkArgs.builder()
* .name("ipv6-test-subnetwork")
* .ipCidrRange("10.0.0.0/22")
* .region("us-west2")
* .stackType("IPV4_IPV6")
* .ipv6AccessType("EXTERNAL")
* .network(custom_test.id())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* subnetwork-ipv6:
* type: gcp:compute:Subnetwork
* properties:
* name: ipv6-test-subnetwork
* ipCidrRange: 10.0.0.0/22
* region: us-west2
* stackType: IPV4_IPV6
* ipv6AccessType: EXTERNAL
* network: ${["custom-test"].id}
* custom-test:
* type: gcp:compute:Network
* properties:
* name: ipv6-test-network
* autoCreateSubnetworks: false
* ```
*
* ### Subnetwork Internal Ipv6
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const custom_test = new gcp.compute.Network("custom-test", {
* name: "internal-ipv6-test-network",
* autoCreateSubnetworks: false,
* enableUlaInternalIpv6: true,
* });
* const subnetwork_internal_ipv6 = new gcp.compute.Subnetwork("subnetwork-internal-ipv6", {
* name: "internal-ipv6-test-subnetwork",
* ipCidrRange: "10.0.0.0/22",
* region: "us-west2",
* stackType: "IPV4_IPV6",
* ipv6AccessType: "INTERNAL",
* network: custom_test.id,
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* custom_test = gcp.compute.Network("custom-test",
* name="internal-ipv6-test-network",
* auto_create_subnetworks=False,
* enable_ula_internal_ipv6=True)
* subnetwork_internal_ipv6 = gcp.compute.Subnetwork("subnetwork-internal-ipv6",
* name="internal-ipv6-test-subnetwork",
* ip_cidr_range="10.0.0.0/22",
* region="us-west2",
* stack_type="IPV4_IPV6",
* ipv6_access_type="INTERNAL",
* network=custom_test.id)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var custom_test = new Gcp.Compute.Network("custom-test", new()
* {
* Name = "internal-ipv6-test-network",
* AutoCreateSubnetworks = false,
* EnableUlaInternalIpv6 = true,
* });
* var subnetwork_internal_ipv6 = new Gcp.Compute.Subnetwork("subnetwork-internal-ipv6", new()
* {
* Name = "internal-ipv6-test-subnetwork",
* IpCidrRange = "10.0.0.0/22",
* Region = "us-west2",
* StackType = "IPV4_IPV6",
* Ipv6AccessType = "INTERNAL",
* Network = custom_test.Id,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := compute.NewNetwork(ctx, "custom-test", &compute.NetworkArgs{
* Name: pulumi.String("internal-ipv6-test-network"),
* AutoCreateSubnetworks: pulumi.Bool(false),
* EnableUlaInternalIpv6: pulumi.Bool(true),
* })
* if err != nil {
* return err
* }
* _, err = compute.NewSubnetwork(ctx, "subnetwork-internal-ipv6", &compute.SubnetworkArgs{
* Name: pulumi.String("internal-ipv6-test-subnetwork"),
* IpCidrRange: pulumi.String("10.0.0.0/22"),
* Region: pulumi.String("us-west2"),
* StackType: pulumi.String("IPV4_IPV6"),
* Ipv6AccessType: pulumi.String("INTERNAL"),
* Network: custom_test.ID(),
* })
* 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.gcp.compute.Network;
* import com.pulumi.gcp.compute.NetworkArgs;
* import com.pulumi.gcp.compute.Subnetwork;
* import com.pulumi.gcp.compute.SubnetworkArgs;
* 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 custom_test = new Network("custom-test", NetworkArgs.builder()
* .name("internal-ipv6-test-network")
* .autoCreateSubnetworks(false)
* .enableUlaInternalIpv6(true)
* .build());
* var subnetwork_internal_ipv6 = new Subnetwork("subnetwork-internal-ipv6", SubnetworkArgs.builder()
* .name("internal-ipv6-test-subnetwork")
* .ipCidrRange("10.0.0.0/22")
* .region("us-west2")
* .stackType("IPV4_IPV6")
* .ipv6AccessType("INTERNAL")
* .network(custom_test.id())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* subnetwork-internal-ipv6:
* type: gcp:compute:Subnetwork
* properties:
* name: internal-ipv6-test-subnetwork
* ipCidrRange: 10.0.0.0/22
* region: us-west2
* stackType: IPV4_IPV6
* ipv6AccessType: INTERNAL
* network: ${["custom-test"].id}
* custom-test:
* type: gcp:compute:Network
* properties:
* name: internal-ipv6-test-network
* autoCreateSubnetworks: false
* enableUlaInternalIpv6: true
* ```
*
* ### Subnetwork Purpose Private Nat
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const custom_test = new gcp.compute.Network("custom-test", {
* name: "subnet-purpose-test-network",
* autoCreateSubnetworks: false,
* });
* const subnetwork_purpose_private_nat = new gcp.compute.Subnetwork("subnetwork-purpose-private-nat", {
* name: "subnet-purpose-test-subnetwork",
* region: "us-west2",
* ipCidrRange: "192.168.1.0/24",
* purpose: "PRIVATE_NAT",
* network: custom_test.id,
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* custom_test = gcp.compute.Network("custom-test",
* name="subnet-purpose-test-network",
* auto_create_subnetworks=False)
* subnetwork_purpose_private_nat = gcp.compute.Subnetwork("subnetwork-purpose-private-nat",
* name="subnet-purpose-test-subnetwork",
* region="us-west2",
* ip_cidr_range="192.168.1.0/24",
* purpose="PRIVATE_NAT",
* network=custom_test.id)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var custom_test = new Gcp.Compute.Network("custom-test", new()
* {
* Name = "subnet-purpose-test-network",
* AutoCreateSubnetworks = false,
* });
* var subnetwork_purpose_private_nat = new Gcp.Compute.Subnetwork("subnetwork-purpose-private-nat", new()
* {
* Name = "subnet-purpose-test-subnetwork",
* Region = "us-west2",
* IpCidrRange = "192.168.1.0/24",
* Purpose = "PRIVATE_NAT",
* Network = custom_test.Id,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := compute.NewNetwork(ctx, "custom-test", &compute.NetworkArgs{
* Name: pulumi.String("subnet-purpose-test-network"),
* AutoCreateSubnetworks: pulumi.Bool(false),
* })
* if err != nil {
* return err
* }
* _, err = compute.NewSubnetwork(ctx, "subnetwork-purpose-private-nat", &compute.SubnetworkArgs{
* Name: pulumi.String("subnet-purpose-test-subnetwork"),
* Region: pulumi.String("us-west2"),
* IpCidrRange: pulumi.String("192.168.1.0/24"),
* Purpose: pulumi.String("PRIVATE_NAT"),
* Network: custom_test.ID(),
* })
* 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.gcp.compute.Network;
* import com.pulumi.gcp.compute.NetworkArgs;
* import com.pulumi.gcp.compute.Subnetwork;
* import com.pulumi.gcp.compute.SubnetworkArgs;
* 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 custom_test = new Network("custom-test", NetworkArgs.builder()
* .name("subnet-purpose-test-network")
* .autoCreateSubnetworks(false)
* .build());
* var subnetwork_purpose_private_nat = new Subnetwork("subnetwork-purpose-private-nat", SubnetworkArgs.builder()
* .name("subnet-purpose-test-subnetwork")
* .region("us-west2")
* .ipCidrRange("192.168.1.0/24")
* .purpose("PRIVATE_NAT")
* .network(custom_test.id())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* subnetwork-purpose-private-nat:
* type: gcp:compute:Subnetwork
* properties:
* name: subnet-purpose-test-subnetwork
* region: us-west2
* ipCidrRange: 192.168.1.0/24
* purpose: PRIVATE_NAT
* network: ${["custom-test"].id}
* custom-test:
* type: gcp:compute:Network
* properties:
* name: subnet-purpose-test-network
* autoCreateSubnetworks: false
* ```
*
* ### Subnetwork Cidr Overlap
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const net_cidr_overlap = new gcp.compute.Network("net-cidr-overlap", {
* name: "net-cidr-overlap",
* autoCreateSubnetworks: false,
* });
* const subnetwork_cidr_overlap = new gcp.compute.Subnetwork("subnetwork-cidr-overlap", {
* name: "subnet-cidr-overlap",
* region: "us-west2",
* ipCidrRange: "192.168.1.0/24",
* allowSubnetCidrRoutesOverlap: true,
* network: net_cidr_overlap.id,
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* net_cidr_overlap = gcp.compute.Network("net-cidr-overlap",
* name="net-cidr-overlap",
* auto_create_subnetworks=False)
* subnetwork_cidr_overlap = gcp.compute.Subnetwork("subnetwork-cidr-overlap",
* name="subnet-cidr-overlap",
* region="us-west2",
* ip_cidr_range="192.168.1.0/24",
* allow_subnet_cidr_routes_overlap=True,
* network=net_cidr_overlap.id)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var net_cidr_overlap = new Gcp.Compute.Network("net-cidr-overlap", new()
* {
* Name = "net-cidr-overlap",
* AutoCreateSubnetworks = false,
* });
* var subnetwork_cidr_overlap = new Gcp.Compute.Subnetwork("subnetwork-cidr-overlap", new()
* {
* Name = "subnet-cidr-overlap",
* Region = "us-west2",
* IpCidrRange = "192.168.1.0/24",
* AllowSubnetCidrRoutesOverlap = true,
* Network = net_cidr_overlap.Id,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := compute.NewNetwork(ctx, "net-cidr-overlap", &compute.NetworkArgs{
* Name: pulumi.String("net-cidr-overlap"),
* AutoCreateSubnetworks: pulumi.Bool(false),
* })
* if err != nil {
* return err
* }
* _, err = compute.NewSubnetwork(ctx, "subnetwork-cidr-overlap", &compute.SubnetworkArgs{
* Name: pulumi.String("subnet-cidr-overlap"),
* Region: pulumi.String("us-west2"),
* IpCidrRange: pulumi.String("192.168.1.0/24"),
* AllowSubnetCidrRoutesOverlap: pulumi.Bool(true),
* Network: net_cidr_overlap.ID(),
* })
* 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.gcp.compute.Network;
* import com.pulumi.gcp.compute.NetworkArgs;
* import com.pulumi.gcp.compute.Subnetwork;
* import com.pulumi.gcp.compute.SubnetworkArgs;
* 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 net_cidr_overlap = new Network("net-cidr-overlap", NetworkArgs.builder()
* .name("net-cidr-overlap")
* .autoCreateSubnetworks(false)
* .build());
* var subnetwork_cidr_overlap = new Subnetwork("subnetwork-cidr-overlap", SubnetworkArgs.builder()
* .name("subnet-cidr-overlap")
* .region("us-west2")
* .ipCidrRange("192.168.1.0/24")
* .allowSubnetCidrRoutesOverlap(true)
* .network(net_cidr_overlap.id())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* subnetwork-cidr-overlap:
* type: gcp:compute:Subnetwork
* properties:
* name: subnet-cidr-overlap
* region: us-west2
* ipCidrRange: 192.168.1.0/24
* allowSubnetCidrRoutesOverlap: true
* network: ${["net-cidr-overlap"].id}
* net-cidr-overlap:
* type: gcp:compute:Network
* properties:
* name: net-cidr-overlap
* autoCreateSubnetworks: false
* ```
*
* ## Import
* Subnetwork can be imported using any of these accepted formats:
* * `projects/{{project}}/regions/{{region}}/subnetworks/{{name}}`
* * `{{project}}/{{region}}/{{name}}`
* * `{{region}}/{{name}}`
* * `{{name}}`
* When using the `pulumi import` command, Subnetwork can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:compute/subnetwork:Subnetwork default projects/{{project}}/regions/{{region}}/subnetworks/{{name}}
* ```
* ```sh
* $ pulumi import gcp:compute/subnetwork:Subnetwork default {{project}}/{{region}}/{{name}}
* ```
* ```sh
* $ pulumi import gcp:compute/subnetwork:Subnetwork default {{region}}/{{name}}
* ```
* ```sh
* $ pulumi import gcp:compute/subnetwork:Subnetwork default {{name}}
* ```
*/
public class Subnetwork internal constructor(
override val javaResource: com.pulumi.gcp.compute.Subnetwork,
) : KotlinCustomResource(javaResource, SubnetworkMapper) {
/**
* Typically packets destined to IPs within the subnetwork range that do not match
* existing resources are dropped and prevented from leaving the VPC.
* Setting this field to true will allow these packets to match dynamic routes injected
* via BGP even if their destinations match existing subnet ranges.
*/
public val allowSubnetCidrRoutesOverlap: Output
get() = javaResource.allowSubnetCidrRoutesOverlap().applyValue({ args0 -> args0 })
/**
* Creation timestamp in RFC3339 text format.
*/
public val creationTimestamp: Output
get() = javaResource.creationTimestamp().applyValue({ args0 -> args0 })
/**
* An optional description of this resource. Provide this property when
* you create the resource. This field can be set only at resource
* creation time.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The range of external IPv6 addresses that are owned by this subnetwork.
*/
public val externalIpv6Prefix: Output
get() = javaResource.externalIpv6Prefix().applyValue({ args0 -> args0 })
/**
* Fingerprint of this resource. This field is used internally during updates of this resource.
*/
@Deprecated(
message = """
This field is not useful for users, and has been removed as an output.
""",
)
public val fingerprint: Output
get() = javaResource.fingerprint().applyValue({ args0 -> args0 })
/**
* The gateway address for default routes to reach destination addresses
* outside this subnetwork.
*/
public val gatewayAddress: Output
get() = javaResource.gatewayAddress().applyValue({ args0 -> args0 })
/**
* The internal IPv6 address range that is assigned to this subnetwork.
*/
public val internalIpv6Prefix: Output
get() = javaResource.internalIpv6Prefix().applyValue({ args0 -> args0 })
/**
* The range of internal addresses that are owned by this subnetwork.
* Provide this property when you create the subnetwork. For example,
* 10.0.0.0/8 or 192.168.0.0/16. Ranges must be unique and
* non-overlapping within a network. Only IPv4 is supported.
*/
public val ipCidrRange: Output
get() = javaResource.ipCidrRange().applyValue({ args0 -> args0 })
/**
* The access type of IPv6 address this subnet holds. It's immutable and can only be specified during creation
* or the first time the subnet is updated into IPV4_IPV6 dual stack. If the ipv6_type is EXTERNAL then this subnet
* cannot enable direct path.
* Possible values are: `EXTERNAL`, `INTERNAL`.
*/
public val ipv6AccessType: Output?
get() = javaResource.ipv6AccessType().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The range of internal IPv6 addresses that are owned by this subnetwork.
*/
public val ipv6CidrRange: Output
get() = javaResource.ipv6CidrRange().applyValue({ args0 -> args0 })
/**
* This field denotes the VPC flow logging options for this subnetwork. If
* logging is enabled, logs are exported to Cloud Logging. Flow logging
* isn't supported if the subnet `purpose` field is set to subnetwork is
* `REGIONAL_MANAGED_PROXY` or `GLOBAL_MANAGED_PROXY`.
* Structure is documented below.
*/
public val logConfig: Output?
get() = javaResource.logConfig().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
subnetworkLogConfigToKotlin(args0)
})
}).orElse(null)
})
/**
* The name of the resource, provided by the client when initially
* creating the resource. The name must be 1-63 characters long, and
* comply with RFC1035. Specifically, the name must be 1-63 characters
* long and match the regular expression `a-z?` which
* means the first character must be a lowercase letter, and all
* following characters must be a dash, lowercase letter, or digit,
* except the last character, which cannot be a dash.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* The network this subnet belongs to.
* Only networks that are in the distributed mode can have subnetworks.
* - - -
*/
public val network: Output
get() = javaResource.network().applyValue({ args0 -> args0 })
/**
* When enabled, VMs in this subnetwork without external IP addresses can
* access Google APIs and services by using Private Google Access.
*/
public val privateIpGoogleAccess: Output
get() = javaResource.privateIpGoogleAccess().applyValue({ args0 -> args0 })
/**
* The private IPv6 google access type for the VMs in this subnet.
*/
public val privateIpv6GoogleAccess: Output
get() = javaResource.privateIpv6GoogleAccess().applyValue({ args0 -> args0 })
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
public val project: Output
get() = javaResource.project().applyValue({ args0 -> args0 })
/**
* The purpose of the resource. This field can be either `PRIVATE_RFC_1918`, `REGIONAL_MANAGED_PROXY`, `GLOBAL_MANAGED_PROXY`, `PRIVATE_SERVICE_CONNECT` or `PRIVATE_NAT`.
* A subnet with purpose set to `REGIONAL_MANAGED_PROXY` is a user-created subnetwork that is reserved for regional Envoy-based load balancers.
* A subnetwork in a given region with purpose set to `GLOBAL_MANAGED_PROXY` is a proxy-only subnet and is shared between all the cross-regional Envoy-based load balancers.
* A subnetwork with purpose set to `PRIVATE_SERVICE_CONNECT` reserves the subnet for hosting a Private Service Connect published service.
* A subnetwork with purpose set to `PRIVATE_NAT` is used as source range for Private NAT gateways.
* Note that `REGIONAL_MANAGED_PROXY` is the preferred setting for all regional Envoy load balancers.
* If unspecified, the purpose defaults to `PRIVATE_RFC_1918`.
*/
public val purpose: Output
get() = javaResource.purpose().applyValue({ args0 -> args0 })
/**
* The GCP region for this subnetwork.
*/
public val region: Output
get() = javaResource.region().applyValue({ args0 -> args0 })
/**
* The role of subnetwork.
* Currently, this field is only used when `purpose` is `REGIONAL_MANAGED_PROXY`.
* The value can be set to `ACTIVE` or `BACKUP`.
* An `ACTIVE` subnetwork is one that is currently being used for Envoy-based load balancers in a region.
* A `BACKUP` subnetwork is one that is ready to be promoted to `ACTIVE` or is currently draining.
* Possible values are: `ACTIVE`, `BACKUP`.
*/
public val role: Output?
get() = javaResource.role().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* An array of configurations for secondary IP ranges for VM instances
* contained in this subnetwork. The primary IP of such VM must belong
* to the primary ipCidrRange of the subnetwork. The alias IPs may belong
* to either primary or secondary ranges.
* Structure is documented below.
*/
public val secondaryIpRanges: Output>
get() = javaResource.secondaryIpRanges().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> subnetworkSecondaryIpRangeToKotlin(args0) })
})
})
/**
* The URI of the created resource.
*/
public val selfLink: Output
get() = javaResource.selfLink().applyValue({ args0 -> args0 })
/**
* Controls the removal behavior of secondary_ip_range.
* When false, removing secondary_ip_range from config will not produce a diff as
* the provider will default to the API's value.
* When true, the provider will treat removing secondary_ip_range as sending an
* empty list of secondary IP ranges to the API.
* Defaults to false.
*/
public val sendSecondaryIpRangeIfEmpty: Output?
get() = javaResource.sendSecondaryIpRangeIfEmpty().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The stack type for this subnet to identify whether the IPv6 feature is enabled or not.
* If not specified IPV4_ONLY will be used.
* Possible values are: `IPV4_ONLY`, `IPV4_IPV6`.
*/
public val stackType: Output
get() = javaResource.stackType().applyValue({ args0 -> args0 })
}
public object SubnetworkMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.gcp.compute.Subnetwork::class == javaResource::class
override fun map(javaResource: Resource): Subnetwork = Subnetwork(
javaResource as
com.pulumi.gcp.compute.Subnetwork,
)
}
/**
* @see [Subnetwork].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [Subnetwork].
*/
public suspend fun subnetwork(name: String, block: suspend SubnetworkResourceBuilder.() -> Unit): Subnetwork {
val builder = SubnetworkResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [Subnetwork].
* @param name The _unique_ name of the resulting resource.
*/
public fun subnetwork(name: String): Subnetwork {
val builder = SubnetworkResourceBuilder()
builder.name(name)
return builder.build()
}