import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * 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", * }, * }); * ``` * ### 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"], * }); * ``` * ### 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", * }, * }); * ``` * ### 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], * }); * ``` * ### Network Connectivity Internal Ranges Migration * * ```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 source = new gcp.compute.Subnetwork("source", { * name: "source-subnet", * ipCidrRange: "10.1.0.0/16", * region: "us-central1", * network: defaultNetwork.name, * }); * const targetProject = gcp.organizations.getProject({}); * const _default = new gcp.networkconnectivity.InternalRange("default", { * name: "migration", * description: "Test internal range", * network: defaultNetwork.selfLink, * usage: "FOR_MIGRATION", * peering: "FOR_SELF", * ipCidrRange: "10.1.0.0/16", * migration: { * source: source.selfLink, * target: targetProject.then(targetProject => `projects/${targetProject.projectId}/regions/us-central1/subnetworks/target-subnet`), * }, * }); * ``` * ### Network Connectivity Internal Ranges Allocation Algoritms * * ```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: "allocation-algorithms", * network: defaultNetwork.id, * usage: "FOR_VPC", * peering: "FOR_SELF", * prefixLength: 24, * targetCidrRanges: ["192.16.0.0/16"], * allocationOptions: { * allocationStrategy: "FIRST_SMALLEST_FITTING", * }, * }); * ``` * ### Network Connectivity Internal Ranges Allocation Algoritms Random First N * * ```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: "allocation-algorithms-random-first-n", * network: defaultNetwork.id, * usage: "FOR_VPC", * peering: "FOR_SELF", * prefixLength: 24, * targetCidrRanges: ["192.16.0.0/16"], * allocationOptions: { * allocationStrategy: "RANDOM_FIRST_N_AVAILABLE", * firstAvailableRangesLookupSize: 20, * }, * }); * ``` * * ## 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}} * $ pulumi import gcp:networkconnectivity/internalRange:InternalRange default {{project}}/{{name}} * $ pulumi import gcp:networkconnectivity/internalRange:InternalRange default {{name}} * ``` */ export declare class InternalRange extends pulumi.CustomResource { /** * Get an existing InternalRange resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input, state?: InternalRangeState, opts?: pulumi.CustomResourceOptions): InternalRange; /** * Returns true if the given object is an instance of InternalRange. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is InternalRange; /** * Options for automatically allocating a free range with a size given by prefixLength. * Structure is documented below. */ readonly allocationOptions: pulumi.Output; /** * An optional description of this resource. */ readonly description: pulumi.Output; /** * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services. */ readonly effectiveLabels: pulumi.Output<{ [key: string]: string; }>; /** * Optional. List of IP CIDR ranges to be excluded. Resulting reserved Internal Range will not overlap with any CIDR blocks mentioned in this list. * Only IPv4 CIDR ranges are supported. */ readonly excludeCidrRanges: pulumi.Output; /** * Immutable ranges cannot have their fields modified, except for labels and description. */ readonly immutable: pulumi.Output; /** * The IP range that this internal range defines. * NOTE: IPv6 ranges are limited to usage=EXTERNAL_TO_VPC and peering=FOR_SELF * NOTE: For IPv6 Ranges this field is compulsory, i.e. the address range must be specified explicitly. */ readonly ipCidrRange: pulumi.Output; /** * User-defined labels. * * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. * Please refer to the field `effectiveLabels` for all of the labels present on the resource. */ readonly labels: pulumi.Output<{ [key: string]: string; } | undefined>; /** * Specification for migration with source and target resource names. * Structure is documented below. */ readonly migration: pulumi.Output; /** * The name of the policy based route. */ readonly name: pulumi.Output; /** * Fully-qualified URL of the network that this route applies to, for example: projects/my-project/global/networks/my-network. */ readonly network: pulumi.Output; /** * 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`. */ readonly overlaps: pulumi.Output; /** * The type of peering set for this internal range. * Possible values are: `FOR_SELF`, `FOR_PEER`, `NOT_SHARED`. */ readonly peering: pulumi.Output; /** * 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. * NOTE: For IPv6 this field only works if ipCidrRange is set as well, and both fields must match. In other words, with IPv6 this field only works as * a redundant parameter. */ readonly prefixLength: pulumi.Output; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ readonly project: pulumi.Output; /** * The combination of labels configured directly on the resource * and default labels configured on the provider. */ readonly pulumiLabels: pulumi.Output<{ [key: string]: string; }>; /** * 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. */ readonly targetCidrRanges: pulumi.Output; /** * The type of usage set for this InternalRange. * Possible values are: `FOR_VPC`, `EXTERNAL_TO_VPC`, `FOR_MIGRATION`. */ readonly usage: pulumi.Output; /** * 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. */ readonly users: pulumi.Output; /** * Create a InternalRange resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: InternalRangeArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering InternalRange resources. */ export interface InternalRangeState { /** * Options for automatically allocating a free range with a size given by prefixLength. * Structure is documented below. */ allocationOptions?: pulumi.Input; /** * An optional description of this resource. */ description?: pulumi.Input; /** * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services. */ effectiveLabels?: pulumi.Input<{ [key: string]: pulumi.Input; }>; /** * Optional. List of IP CIDR ranges to be excluded. Resulting reserved Internal Range will not overlap with any CIDR blocks mentioned in this list. * Only IPv4 CIDR ranges are supported. */ excludeCidrRanges?: pulumi.Input[]>; /** * Immutable ranges cannot have their fields modified, except for labels and description. */ immutable?: pulumi.Input; /** * The IP range that this internal range defines. * NOTE: IPv6 ranges are limited to usage=EXTERNAL_TO_VPC and peering=FOR_SELF * NOTE: For IPv6 Ranges this field is compulsory, i.e. the address range must be specified explicitly. */ ipCidrRange?: pulumi.Input; /** * User-defined labels. * * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. * Please refer to the field `effectiveLabels` for all of the labels present on the resource. */ labels?: pulumi.Input<{ [key: string]: pulumi.Input; }>; /** * Specification for migration with source and target resource names. * Structure is documented below. */ migration?: pulumi.Input; /** * The name of the policy based route. */ name?: pulumi.Input; /** * Fully-qualified URL of the network that this route applies to, for example: projects/my-project/global/networks/my-network. */ network?: pulumi.Input; /** * 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`. */ overlaps?: pulumi.Input[]>; /** * The type of peering set for this internal range. * Possible values are: `FOR_SELF`, `FOR_PEER`, `NOT_SHARED`. */ peering?: pulumi.Input; /** * 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. * NOTE: For IPv6 this field only works if ipCidrRange is set as well, and both fields must match. In other words, with IPv6 this field only works as * a redundant parameter. */ prefixLength?: pulumi.Input; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input; /** * The combination of labels configured directly on the resource * and default labels configured on the provider. */ pulumiLabels?: pulumi.Input<{ [key: string]: pulumi.Input; }>; /** * 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. */ targetCidrRanges?: pulumi.Input[]>; /** * The type of usage set for this InternalRange. * Possible values are: `FOR_VPC`, `EXTERNAL_TO_VPC`, `FOR_MIGRATION`. */ usage?: pulumi.Input; /** * 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. */ users?: pulumi.Input[]>; } /** * The set of arguments for constructing a InternalRange resource. */ export interface InternalRangeArgs { /** * Options for automatically allocating a free range with a size given by prefixLength. * Structure is documented below. */ allocationOptions?: pulumi.Input; /** * An optional description of this resource. */ description?: pulumi.Input; /** * Optional. List of IP CIDR ranges to be excluded. Resulting reserved Internal Range will not overlap with any CIDR blocks mentioned in this list. * Only IPv4 CIDR ranges are supported. */ excludeCidrRanges?: pulumi.Input[]>; /** * Immutable ranges cannot have their fields modified, except for labels and description. */ immutable?: pulumi.Input; /** * The IP range that this internal range defines. * NOTE: IPv6 ranges are limited to usage=EXTERNAL_TO_VPC and peering=FOR_SELF * NOTE: For IPv6 Ranges this field is compulsory, i.e. the address range must be specified explicitly. */ ipCidrRange?: pulumi.Input; /** * User-defined labels. * * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. * Please refer to the field `effectiveLabels` for all of the labels present on the resource. */ labels?: pulumi.Input<{ [key: string]: pulumi.Input; }>; /** * Specification for migration with source and target resource names. * Structure is documented below. */ migration?: pulumi.Input; /** * The name of the policy based route. */ name?: pulumi.Input; /** * Fully-qualified URL of the network that this route applies to, for example: projects/my-project/global/networks/my-network. */ network: pulumi.Input; /** * 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`. */ overlaps?: pulumi.Input[]>; /** * The type of peering set for this internal range. * Possible values are: `FOR_SELF`, `FOR_PEER`, `NOT_SHARED`. */ peering: pulumi.Input; /** * 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. * NOTE: For IPv6 this field only works if ipCidrRange is set as well, and both fields must match. In other words, with IPv6 this field only works as * a redundant parameter. */ prefixLength?: pulumi.Input; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input; /** * 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. */ targetCidrRanges?: pulumi.Input[]>; /** * The type of usage set for this InternalRange. * Possible values are: `FOR_VPC`, `EXTERNAL_TO_VPC`, `FOR_MIGRATION`. */ usage: pulumi.Input; }