UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

248 lines • 10.4 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Address = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * Represents an Address resource. * * Each virtual machine instance has an ephemeral internal IP address and, * optionally, an external IP address. To communicate between instances on * the same network, you can use an instance's internal IP address. To * communicate with the Internet and instances outside of the same network, * you must specify the instance's external IP address. * * Internal IP addresses are ephemeral and only belong to an instance for * the lifetime of the instance; if the instance is deleted and recreated, * the instance is assigned a new internal IP address, either by Compute * Engine or by you. External IP addresses can be either ephemeral or * static. * * To get more information about Address, see: * * * [API documentation](https://cloud.google.com/compute/docs/reference/beta/addresses) * * How-to Guides * * [Reserving a Static External IP Address](https://cloud.google.com/compute/docs/instances-and-network) * * [Reserving a Static Internal IP Address](https://cloud.google.com/compute/docs/ip-addresses/reserve-static-internal-ip-address) * * ## Example Usage * * ### Address Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const ipAddress = new gcp.compute.Address("ip_address", {name: "my-address"}); * ``` * ### Address With Subnetwork * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const _default = new gcp.compute.Network("default", {name: "my-network"}); * const defaultSubnetwork = new gcp.compute.Subnetwork("default", { * name: "my-subnet", * ipCidrRange: "10.0.0.0/16", * region: "us-central1", * network: _default.id, * }); * const internalWithSubnetAndAddress = new gcp.compute.Address("internal_with_subnet_and_address", { * name: "my-internal-address", * subnetwork: defaultSubnetwork.id, * addressType: "INTERNAL", * address: "10.0.42.42", * region: "us-central1", * }); * ``` * ### Address With Gce Endpoint * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const internalWithGceEndpoint = new gcp.compute.Address("internal_with_gce_endpoint", { * name: "my-internal-address-", * addressType: "INTERNAL", * purpose: "GCE_ENDPOINT", * }); * ``` * ### Instance With Ip * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const static = new gcp.compute.Address("static", {name: "ipv4-address"}); * const debianImage = gcp.compute.getImage({ * family: "debian-11", * project: "debian-cloud", * }); * const instanceWithIp = new gcp.compute.Instance("instance_with_ip", { * name: "vm-instance", * machineType: "f1-micro", * zone: "us-central1-a", * bootDisk: { * initializeParams: { * image: debianImage.then(debianImage => debianImage.selfLink), * }, * }, * networkInterfaces: [{ * network: "default", * accessConfigs: [{ * natIp: static.address, * }], * }], * }); * ``` * ### Compute Address Ipsec Interconnect * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const network = new gcp.compute.Network("network", { * name: "test-network", * autoCreateSubnetworks: false, * }); * const ipsec_interconnect_address = new gcp.compute.Address("ipsec-interconnect-address", { * name: "test-address", * addressType: "INTERNAL", * purpose: "IPSEC_INTERCONNECT", * address: "192.168.1.0", * prefixLength: 29, * network: network.selfLink, * }); * ``` * ## Import * * Address can be imported using any of these accepted formats: * * * `projects/{{project}}/regions/{{region}}/addresses/{{name}}` * * `{{project}}/{{region}}/{{name}}` * * `{{region}}/{{name}}` * * `{{name}}` * * When using the `pulumi import` command, Address can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:compute/address:Address default projects/{{project}}/regions/{{region}}/addresses/{{name}} * $ pulumi import gcp:compute/address:Address default {{project}}/{{region}}/{{name}} * $ pulumi import gcp:compute/address:Address default {{region}}/{{name}} * $ pulumi import gcp:compute/address:Address default {{name}} * ``` */ class Address extends pulumi.CustomResource { /** * Get an existing Address 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, id, state, opts) { return new Address(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'gcp:compute/address:Address'; /** * Returns true if the given object is an instance of Address. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === Address.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["address"] = state?.address; resourceInputs["addressId"] = state?.addressId; resourceInputs["addressType"] = state?.addressType; resourceInputs["creationTimestamp"] = state?.creationTimestamp; resourceInputs["deletionPolicy"] = state?.deletionPolicy; resourceInputs["description"] = state?.description; resourceInputs["effectiveLabels"] = state?.effectiveLabels; resourceInputs["ipCollection"] = state?.ipCollection; resourceInputs["ipVersion"] = state?.ipVersion; resourceInputs["ipv6EndpointType"] = state?.ipv6EndpointType; resourceInputs["labelFingerprint"] = state?.labelFingerprint; resourceInputs["labels"] = state?.labels; resourceInputs["name"] = state?.name; resourceInputs["network"] = state?.network; resourceInputs["networkTier"] = state?.networkTier; resourceInputs["prefixLength"] = state?.prefixLength; resourceInputs["project"] = state?.project; resourceInputs["pulumiLabels"] = state?.pulumiLabels; resourceInputs["purpose"] = state?.purpose; resourceInputs["region"] = state?.region; resourceInputs["selfLink"] = state?.selfLink; resourceInputs["subnetwork"] = state?.subnetwork; resourceInputs["users"] = state?.users; } else { const args = argsOrState; resourceInputs["address"] = args?.address; resourceInputs["addressType"] = args?.addressType; resourceInputs["deletionPolicy"] = args?.deletionPolicy; resourceInputs["description"] = args?.description; resourceInputs["ipCollection"] = args?.ipCollection; resourceInputs["ipVersion"] = args?.ipVersion; resourceInputs["ipv6EndpointType"] = args?.ipv6EndpointType; resourceInputs["labels"] = args?.labels; resourceInputs["name"] = args?.name; resourceInputs["network"] = args?.network; resourceInputs["networkTier"] = args?.networkTier; resourceInputs["prefixLength"] = args?.prefixLength; resourceInputs["project"] = args?.project; resourceInputs["purpose"] = args?.purpose; resourceInputs["region"] = args?.region; resourceInputs["subnetwork"] = args?.subnetwork; resourceInputs["addressId"] = undefined /*out*/; resourceInputs["creationTimestamp"] = undefined /*out*/; resourceInputs["effectiveLabels"] = undefined /*out*/; resourceInputs["labelFingerprint"] = undefined /*out*/; resourceInputs["pulumiLabels"] = undefined /*out*/; resourceInputs["selfLink"] = undefined /*out*/; resourceInputs["users"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(Address.__pulumiType, name, resourceInputs, opts); } } exports.Address = Address; //# sourceMappingURL=address.js.map