UNPKG

@pulumi/gcp

Version:

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

232 lines • 8.98 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! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.Address = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = 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}} * ``` * * ```sh * $ pulumi import gcp:compute/address:Address default {{project}}/{{region}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:compute/address:Address default {{region}}/{{name}} * ``` * * ```sh * $ 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 }); } /** * 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["addressType"] = state?.addressType; resourceInputs["creationTimestamp"] = state?.creationTimestamp; resourceInputs["description"] = state?.description; resourceInputs["effectiveLabels"] = state?.effectiveLabels; 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["description"] = args?.description; 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["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; /** @internal */ Address.__pulumiType = 'gcp:compute/address:Address'; //# sourceMappingURL=address.js.map