All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.gcp.networkconnectivity.kotlin.InternalRange.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.networkconnectivity.kotlin

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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map

/**
 * Builder for [InternalRange].
 */
@PulumiTagMarker
public class InternalRangeResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: InternalRangeArgs = InternalRangeArgs()

    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 InternalRangeArgsBuilder.() -> Unit) {
        val builder = InternalRangeArgsBuilder()
        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(): InternalRange {
        val builtJavaResource =
            com.pulumi.gcp.networkconnectivity.InternalRange(
                this.name,
                this.args.toJava(),
                this.opts.toJava(),
            )
        return InternalRange(builtJavaResource)
    }
}

/**
 * The internal range resource for IPAM operations within a VPC network. Used to represent a private address range along with behavioral characterstics of that range (its usage and peering behavior). Networking resources can link to this range if they are created as belonging to it.
 * To get more information about InternalRange, see:
 * * [API documentation](https://cloud.google.com/network-connectivity/docs/reference/networkconnectivity/rest/v1/projects.locations.internalRanges)
 * * How-to Guides
 *     * [Use internal ranges](https://cloud.google.com/vpc/docs/create-use-internal-ranges)
 * ## Example Usage
 * ### Network Connectivity Internal Ranges Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const defaultNetwork = new gcp.compute.Network("default", {
 *     name: "internal-ranges",
 *     autoCreateSubnetworks: false,
 * });
 * const _default = new gcp.networkconnectivity.InternalRange("default", {
 *     name: "basic",
 *     description: "Test internal range",
 *     network: defaultNetwork.selfLink,
 *     usage: "FOR_VPC",
 *     peering: "FOR_SELF",
 *     ipCidrRange: "10.0.0.0/24",
 *     labels: {
 *         "label-a": "b",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * default_network = gcp.compute.Network("default",
 *     name="internal-ranges",
 *     auto_create_subnetworks=False)
 * default = gcp.networkconnectivity.InternalRange("default",
 *     name="basic",
 *     description="Test internal range",
 *     network=default_network.self_link,
 *     usage="FOR_VPC",
 *     peering="FOR_SELF",
 *     ip_cidr_range="10.0.0.0/24",
 *     labels={
 *         "label-a": "b",
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var defaultNetwork = new Gcp.Compute.Network("default", new()
 *     {
 *         Name = "internal-ranges",
 *         AutoCreateSubnetworks = false,
 *     });
 *     var @default = new Gcp.NetworkConnectivity.InternalRange("default", new()
 *     {
 *         Name = "basic",
 *         Description = "Test internal range",
 *         Network = defaultNetwork.SelfLink,
 *         Usage = "FOR_VPC",
 *         Peering = "FOR_SELF",
 *         IpCidrRange = "10.0.0.0/24",
 *         Labels =
 *         {
 *             { "label-a", "b" },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/networkconnectivity"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		defaultNetwork, err := compute.NewNetwork(ctx, "default", &compute.NetworkArgs{
 * 			Name:                  pulumi.String("internal-ranges"),
 * 			AutoCreateSubnetworks: pulumi.Bool(false),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = networkconnectivity.NewInternalRange(ctx, "default", &networkconnectivity.InternalRangeArgs{
 * 			Name:        pulumi.String("basic"),
 * 			Description: pulumi.String("Test internal range"),
 * 			Network:     defaultNetwork.SelfLink,
 * 			Usage:       pulumi.String("FOR_VPC"),
 * 			Peering:     pulumi.String("FOR_SELF"),
 * 			IpCidrRange: pulumi.String("10.0.0.0/24"),
 * 			Labels: pulumi.StringMap{
 * 				"label-a": pulumi.String("b"),
 * 			},
 * 		})
 * 		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.networkconnectivity.InternalRange;
 * import com.pulumi.gcp.networkconnectivity.InternalRangeArgs;
 * 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 defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
 *             .name("internal-ranges")
 *             .autoCreateSubnetworks(false)
 *             .build());
 *         var default_ = new InternalRange("default", InternalRangeArgs.builder()
 *             .name("basic")
 *             .description("Test internal range")
 *             .network(defaultNetwork.selfLink())
 *             .usage("FOR_VPC")
 *             .peering("FOR_SELF")
 *             .ipCidrRange("10.0.0.0/24")
 *             .labels(Map.of("label-a", "b"))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: gcp:networkconnectivity:InternalRange
 *     properties:
 *       name: basic
 *       description: Test internal range
 *       network: ${defaultNetwork.selfLink}
 *       usage: FOR_VPC
 *       peering: FOR_SELF
 *       ipCidrRange: 10.0.0.0/24
 *       labels:
 *         label-a: b
 *   defaultNetwork:
 *     type: gcp:compute:Network
 *     name: default
 *     properties:
 *       name: internal-ranges
 *       autoCreateSubnetworks: false
 * ```
 * 
 * ### Network Connectivity Internal Ranges Automatic Reservation
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const defaultNetwork = new gcp.compute.Network("default", {
 *     name: "internal-ranges",
 *     autoCreateSubnetworks: false,
 * });
 * const _default = new gcp.networkconnectivity.InternalRange("default", {
 *     name: "automatic-reservation",
 *     network: defaultNetwork.id,
 *     usage: "FOR_VPC",
 *     peering: "FOR_SELF",
 *     prefixLength: 24,
 *     targetCidrRanges: ["192.16.0.0/16"],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * default_network = gcp.compute.Network("default",
 *     name="internal-ranges",
 *     auto_create_subnetworks=False)
 * default = gcp.networkconnectivity.InternalRange("default",
 *     name="automatic-reservation",
 *     network=default_network.id,
 *     usage="FOR_VPC",
 *     peering="FOR_SELF",
 *     prefix_length=24,
 *     target_cidr_ranges=["192.16.0.0/16"])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var defaultNetwork = new Gcp.Compute.Network("default", new()
 *     {
 *         Name = "internal-ranges",
 *         AutoCreateSubnetworks = false,
 *     });
 *     var @default = new Gcp.NetworkConnectivity.InternalRange("default", new()
 *     {
 *         Name = "automatic-reservation",
 *         Network = defaultNetwork.Id,
 *         Usage = "FOR_VPC",
 *         Peering = "FOR_SELF",
 *         PrefixLength = 24,
 *         TargetCidrRanges = new[]
 *         {
 *             "192.16.0.0/16",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/networkconnectivity"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		defaultNetwork, err := compute.NewNetwork(ctx, "default", &compute.NetworkArgs{
 * 			Name:                  pulumi.String("internal-ranges"),
 * 			AutoCreateSubnetworks: pulumi.Bool(false),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = networkconnectivity.NewInternalRange(ctx, "default", &networkconnectivity.InternalRangeArgs{
 * 			Name:         pulumi.String("automatic-reservation"),
 * 			Network:      defaultNetwork.ID(),
 * 			Usage:        pulumi.String("FOR_VPC"),
 * 			Peering:      pulumi.String("FOR_SELF"),
 * 			PrefixLength: pulumi.Int(24),
 * 			TargetCidrRanges: pulumi.StringArray{
 * 				pulumi.String("192.16.0.0/16"),
 * 			},
 * 		})
 * 		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.networkconnectivity.InternalRange;
 * import com.pulumi.gcp.networkconnectivity.InternalRangeArgs;
 * 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 defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
 *             .name("internal-ranges")
 *             .autoCreateSubnetworks(false)
 *             .build());
 *         var default_ = new InternalRange("default", InternalRangeArgs.builder()
 *             .name("automatic-reservation")
 *             .network(defaultNetwork.id())
 *             .usage("FOR_VPC")
 *             .peering("FOR_SELF")
 *             .prefixLength(24)
 *             .targetCidrRanges("192.16.0.0/16")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: gcp:networkconnectivity:InternalRange
 *     properties:
 *       name: automatic-reservation
 *       network: ${defaultNetwork.id}
 *       usage: FOR_VPC
 *       peering: FOR_SELF
 *       prefixLength: 24
 *       targetCidrRanges:
 *         - 192.16.0.0/16
 *   defaultNetwork:
 *     type: gcp:compute:Network
 *     name: default
 *     properties:
 *       name: internal-ranges
 *       autoCreateSubnetworks: false
 * ```
 * 
 * ### Network Connectivity Internal Ranges External Ranges
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const defaultNetwork = new gcp.compute.Network("default", {
 *     name: "internal-ranges",
 *     autoCreateSubnetworks: false,
 * });
 * const _default = new gcp.networkconnectivity.InternalRange("default", {
 *     name: "external-ranges",
 *     network: defaultNetwork.id,
 *     usage: "EXTERNAL_TO_VPC",
 *     peering: "FOR_SELF",
 *     ipCidrRange: "172.16.0.0/24",
 *     labels: {
 *         "external-reserved-range": "on-premises",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * default_network = gcp.compute.Network("default",
 *     name="internal-ranges",
 *     auto_create_subnetworks=False)
 * default = gcp.networkconnectivity.InternalRange("default",
 *     name="external-ranges",
 *     network=default_network.id,
 *     usage="EXTERNAL_TO_VPC",
 *     peering="FOR_SELF",
 *     ip_cidr_range="172.16.0.0/24",
 *     labels={
 *         "external-reserved-range": "on-premises",
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var defaultNetwork = new Gcp.Compute.Network("default", new()
 *     {
 *         Name = "internal-ranges",
 *         AutoCreateSubnetworks = false,
 *     });
 *     var @default = new Gcp.NetworkConnectivity.InternalRange("default", new()
 *     {
 *         Name = "external-ranges",
 *         Network = defaultNetwork.Id,
 *         Usage = "EXTERNAL_TO_VPC",
 *         Peering = "FOR_SELF",
 *         IpCidrRange = "172.16.0.0/24",
 *         Labels =
 *         {
 *             { "external-reserved-range", "on-premises" },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/networkconnectivity"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		defaultNetwork, err := compute.NewNetwork(ctx, "default", &compute.NetworkArgs{
 * 			Name:                  pulumi.String("internal-ranges"),
 * 			AutoCreateSubnetworks: pulumi.Bool(false),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = networkconnectivity.NewInternalRange(ctx, "default", &networkconnectivity.InternalRangeArgs{
 * 			Name:        pulumi.String("external-ranges"),
 * 			Network:     defaultNetwork.ID(),
 * 			Usage:       pulumi.String("EXTERNAL_TO_VPC"),
 * 			Peering:     pulumi.String("FOR_SELF"),
 * 			IpCidrRange: pulumi.String("172.16.0.0/24"),
 * 			Labels: pulumi.StringMap{
 * 				"external-reserved-range": pulumi.String("on-premises"),
 * 			},
 * 		})
 * 		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.networkconnectivity.InternalRange;
 * import com.pulumi.gcp.networkconnectivity.InternalRangeArgs;
 * 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 defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
 *             .name("internal-ranges")
 *             .autoCreateSubnetworks(false)
 *             .build());
 *         var default_ = new InternalRange("default", InternalRangeArgs.builder()
 *             .name("external-ranges")
 *             .network(defaultNetwork.id())
 *             .usage("EXTERNAL_TO_VPC")
 *             .peering("FOR_SELF")
 *             .ipCidrRange("172.16.0.0/24")
 *             .labels(Map.of("external-reserved-range", "on-premises"))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: gcp:networkconnectivity:InternalRange
 *     properties:
 *       name: external-ranges
 *       network: ${defaultNetwork.id}
 *       usage: EXTERNAL_TO_VPC
 *       peering: FOR_SELF
 *       ipCidrRange: 172.16.0.0/24
 *       labels:
 *         external-reserved-range: on-premises
 *   defaultNetwork:
 *     type: gcp:compute:Network
 *     name: default
 *     properties:
 *       name: internal-ranges
 *       autoCreateSubnetworks: false
 * ```
 * 
 * ### Network Connectivity Internal Ranges Reserve With Overlap
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const defaultNetwork = new gcp.compute.Network("default", {
 *     name: "internal-ranges",
 *     autoCreateSubnetworks: false,
 * });
 * const defaultSubnetwork = new gcp.compute.Subnetwork("default", {
 *     name: "overlapping-subnet",
 *     ipCidrRange: "10.0.0.0/24",
 *     region: "us-central1",
 *     network: defaultNetwork.id,
 * });
 * const _default = new gcp.networkconnectivity.InternalRange("default", {
 *     name: "overlap-range",
 *     description: "Test internal range",
 *     network: defaultNetwork.id,
 *     usage: "FOR_VPC",
 *     peering: "FOR_SELF",
 *     ipCidrRange: "10.0.0.0/30",
 *     overlaps: ["OVERLAP_EXISTING_SUBNET_RANGE"],
 * }, {
 *     dependsOn: [defaultSubnetwork],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * default_network = gcp.compute.Network("default",
 *     name="internal-ranges",
 *     auto_create_subnetworks=False)
 * default_subnetwork = gcp.compute.Subnetwork("default",
 *     name="overlapping-subnet",
 *     ip_cidr_range="10.0.0.0/24",
 *     region="us-central1",
 *     network=default_network.id)
 * default = gcp.networkconnectivity.InternalRange("default",
 *     name="overlap-range",
 *     description="Test internal range",
 *     network=default_network.id,
 *     usage="FOR_VPC",
 *     peering="FOR_SELF",
 *     ip_cidr_range="10.0.0.0/30",
 *     overlaps=["OVERLAP_EXISTING_SUBNET_RANGE"],
 *     opts = pulumi.ResourceOptions(depends_on=[default_subnetwork]))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var defaultNetwork = new Gcp.Compute.Network("default", new()
 *     {
 *         Name = "internal-ranges",
 *         AutoCreateSubnetworks = false,
 *     });
 *     var defaultSubnetwork = new Gcp.Compute.Subnetwork("default", new()
 *     {
 *         Name = "overlapping-subnet",
 *         IpCidrRange = "10.0.0.0/24",
 *         Region = "us-central1",
 *         Network = defaultNetwork.Id,
 *     });
 *     var @default = new Gcp.NetworkConnectivity.InternalRange("default", new()
 *     {
 *         Name = "overlap-range",
 *         Description = "Test internal range",
 *         Network = defaultNetwork.Id,
 *         Usage = "FOR_VPC",
 *         Peering = "FOR_SELF",
 *         IpCidrRange = "10.0.0.0/30",
 *         Overlaps = new[]
 *         {
 *             "OVERLAP_EXISTING_SUBNET_RANGE",
 *         },
 *     }, new CustomResourceOptions
 *     {
 *         DependsOn =
 *         {
 *             defaultSubnetwork,
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/networkconnectivity"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		defaultNetwork, err := compute.NewNetwork(ctx, "default", &compute.NetworkArgs{
 * 			Name:                  pulumi.String("internal-ranges"),
 * 			AutoCreateSubnetworks: pulumi.Bool(false),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		defaultSubnetwork, err := compute.NewSubnetwork(ctx, "default", &compute.SubnetworkArgs{
 * 			Name:        pulumi.String("overlapping-subnet"),
 * 			IpCidrRange: pulumi.String("10.0.0.0/24"),
 * 			Region:      pulumi.String("us-central1"),
 * 			Network:     defaultNetwork.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = networkconnectivity.NewInternalRange(ctx, "default", &networkconnectivity.InternalRangeArgs{
 * 			Name:        pulumi.String("overlap-range"),
 * 			Description: pulumi.String("Test internal range"),
 * 			Network:     defaultNetwork.ID(),
 * 			Usage:       pulumi.String("FOR_VPC"),
 * 			Peering:     pulumi.String("FOR_SELF"),
 * 			IpCidrRange: pulumi.String("10.0.0.0/30"),
 * 			Overlaps: pulumi.StringArray{
 * 				pulumi.String("OVERLAP_EXISTING_SUBNET_RANGE"),
 * 			},
 * 		}, pulumi.DependsOn([]pulumi.Resource{
 * 			defaultSubnetwork,
 * 		}))
 * 		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.networkconnectivity.InternalRange;
 * import com.pulumi.gcp.networkconnectivity.InternalRangeArgs;
 * import com.pulumi.resources.CustomResourceOptions;
 * 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 defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
 *             .name("internal-ranges")
 *             .autoCreateSubnetworks(false)
 *             .build());
 *         var defaultSubnetwork = new Subnetwork("defaultSubnetwork", SubnetworkArgs.builder()
 *             .name("overlapping-subnet")
 *             .ipCidrRange("10.0.0.0/24")
 *             .region("us-central1")
 *             .network(defaultNetwork.id())
 *             .build());
 *         var default_ = new InternalRange("default", InternalRangeArgs.builder()
 *             .name("overlap-range")
 *             .description("Test internal range")
 *             .network(defaultNetwork.id())
 *             .usage("FOR_VPC")
 *             .peering("FOR_SELF")
 *             .ipCidrRange("10.0.0.0/30")
 *             .overlaps("OVERLAP_EXISTING_SUBNET_RANGE")
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(defaultSubnetwork)
 *                 .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: gcp:networkconnectivity:InternalRange
 *     properties:
 *       name: overlap-range
 *       description: Test internal range
 *       network: ${defaultNetwork.id}
 *       usage: FOR_VPC
 *       peering: FOR_SELF
 *       ipCidrRange: 10.0.0.0/30
 *       overlaps:
 *         - OVERLAP_EXISTING_SUBNET_RANGE
 *     options:
 *       dependson:
 *         - ${defaultSubnetwork}
 *   defaultNetwork:
 *     type: gcp:compute:Network
 *     name: default
 *     properties:
 *       name: internal-ranges
 *       autoCreateSubnetworks: false
 *   defaultSubnetwork:
 *     type: gcp:compute:Subnetwork
 *     name: default
 *     properties:
 *       name: overlapping-subnet
 *       ipCidrRange: 10.0.0.0/24
 *       region: us-central1
 *       network: ${defaultNetwork.id}
 * ```
 * 
 * ## Import
 * InternalRange can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/global/internalRanges/{{name}}`
 * * `{{project}}/{{name}}`
 * * `{{name}}`
 * When using the `pulumi import` command, InternalRange can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:networkconnectivity/internalRange:InternalRange default projects/{{project}}/locations/global/internalRanges/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:networkconnectivity/internalRange:InternalRange default {{project}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:networkconnectivity/internalRange:InternalRange default {{name}}
 * ```
 */
public class InternalRange internal constructor(
    override val javaResource: com.pulumi.gcp.networkconnectivity.InternalRange,
) : KotlinCustomResource(javaResource, InternalRangeMapper) {
    /**
     * An optional description of this resource.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
     */
    public val effectiveLabels: Output>
        get() = javaResource.effectiveLabels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * The IP range that this internal range defines.
     */
    public val ipCidrRange: Output
        get() = javaResource.ipCidrRange().applyValue({ args0 -> args0 })

    /**
     * User-defined labels.
     * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
     * Please refer to the field `effective_labels` for all of the labels present on the resource.
     */
    public val labels: Output>?
        get() = javaResource.labels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * The name of the policy based route.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Fully-qualified URL of the network that this route applies to, for example: projects/my-project/global/networks/my-network.
     */
    public val network: Output
        get() = javaResource.network().applyValue({ args0 -> args0 })

    /**
     * Optional. Types of resources that are allowed to overlap with the current internal range.
     * Each value may be one of: `OVERLAP_ROUTE_RANGE`, `OVERLAP_EXISTING_SUBNET_RANGE`.
     */
    public val overlaps: Output>?
        get() = javaResource.overlaps().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })

    /**
     * The type of peering set for this internal range.
     * Possible values are: `FOR_SELF`, `FOR_PEER`, `NOT_SHARED`.
     * - - -
     */
    public val peering: Output
        get() = javaResource.peering().applyValue({ args0 -> args0 })

    /**
     * An alternate to ipCidrRange. Can be set when trying to create a reservation that automatically finds a free range of the given size.
     * If both ipCidrRange and prefixLength are set, there is an error if the range sizes do not match. Can also be used during updates to change the range size.
     */
    public val prefixLength: Output?
        get() = javaResource.prefixLength().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * 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 combination of labels configured directly on the resource
     * and default labels configured on the provider.
     */
    public val pulumiLabels: Output>
        get() = javaResource.pulumiLabels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * Optional. Can be set to narrow down or pick a different address space while searching for a free range.
     * If not set, defaults to the "10.0.0.0/8" address space. This can be used to search in other rfc-1918 address spaces like "172.16.0.0/12" and "192.168.0.0/16" or non-rfc-1918 address spaces used in the VPC.
     */
    public val targetCidrRanges: Output>?
        get() = javaResource.targetCidrRanges().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * The type of usage set for this InternalRange.
     * Possible values are: `FOR_VPC`, `EXTERNAL_TO_VPC`.
     */
    public val usage: Output
        get() = javaResource.usage().applyValue({ args0 -> args0 })

    /**
     * Output only. The list of resources that refer to this internal range.
     * Resources that use the internal range for their range allocation are referred to as users of the range.
     * Other resources mark themselves as users while doing so by creating a reference to this internal range. Having a user, based on this reference, prevents deletion of the internal range referred to. Can be empty.
     */
    public val users: Output>
        get() = javaResource.users().applyValue({ args0 -> args0.map({ args0 -> args0 }) })
}

public object InternalRangeMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.networkconnectivity.InternalRange::class == javaResource::class

    override fun map(javaResource: Resource): InternalRange = InternalRange(
        javaResource as
            com.pulumi.gcp.networkconnectivity.InternalRange,
    )
}

/**
 * @see [InternalRange].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [InternalRange].
 */
public suspend fun internalRange(
    name: String,
    block: suspend InternalRangeResourceBuilder.() -> Unit,
): InternalRange {
    val builder = InternalRangeResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [InternalRange].
 * @param name The _unique_ name of the resulting resource.
 */
public fun internalRange(name: String): InternalRange {
    val builder = InternalRangeResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy