@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
162 lines • 6.96 kB
JavaScript
;
// *** 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.InstanceGroupNamedPort = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* Mange the named ports setting for a managed instance group without
* managing the group as whole. This resource is primarily intended for use
* with GKE-generated groups that shouldn't otherwise be managed by other
* tools.
*
* To get more information about InstanceGroupNamedPort, see:
*
* * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/instanceGroup)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/compute/docs/instance-groups/)
*
* ## Example Usage
*
* ### Instance Group Named Port Gke
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const containerNetwork = new gcp.compute.Network("container_network", {
* name: "container-network",
* autoCreateSubnetworks: false,
* });
* const containerSubnetwork = new gcp.compute.Subnetwork("container_subnetwork", {
* name: "container-subnetwork",
* region: "us-central1",
* network: containerNetwork.name,
* ipCidrRange: "10.0.36.0/24",
* });
* const myCluster = new gcp.container.Cluster("my_cluster", {
* name: "my-cluster",
* location: "us-central1-a",
* initialNodeCount: 1,
* network: containerNetwork.name,
* subnetwork: containerSubnetwork.name,
* ipAllocationPolicy: {
* clusterIpv4CidrBlock: "/19",
* servicesIpv4CidrBlock: "/22",
* },
* deletionProtection: true,
* });
* const myPort = new gcp.compute.InstanceGroupNamedPort("my_port", {
* group: myCluster.nodePools.apply(nodePools => nodePools[0].instanceGroupUrls?.[0]),
* zone: "us-central1-a",
* name: "http",
* port: 8080,
* });
* const myPorts = new gcp.compute.InstanceGroupNamedPort("my_ports", {
* group: myCluster.nodePools.apply(nodePools => nodePools[0].instanceGroupUrls?.[0]),
* zone: "us-central1-a",
* name: "https",
* port: 4443,
* });
* ```
*
* ## Import
*
* InstanceGroupNamedPort can be imported using any of these accepted formats:
*
* * `projects/{{project}}/zones/{{zone}}/instanceGroups/{{group}}/{{port}}/{{name}}`
* * `{{project}}/{{zone}}/{{group}}/{{port}}/{{name}}`
* * `{{zone}}/{{group}}/{{port}}/{{name}}`
* * `{{group}}/{{port}}/{{name}}`
*
* When using the `pulumi import` command, InstanceGroupNamedPort can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:compute/instanceGroupNamedPort:InstanceGroupNamedPort default projects/{{project}}/zones/{{zone}}/instanceGroups/{{group}}/{{port}}/{{name}}
* $ pulumi import gcp:compute/instanceGroupNamedPort:InstanceGroupNamedPort default {{project}}/{{zone}}/{{group}}/{{port}}/{{name}}
* $ pulumi import gcp:compute/instanceGroupNamedPort:InstanceGroupNamedPort default {{zone}}/{{group}}/{{port}}/{{name}}
* $ pulumi import gcp:compute/instanceGroupNamedPort:InstanceGroupNamedPort default {{group}}/{{port}}/{{name}}
* ```
*/
class InstanceGroupNamedPort extends pulumi.CustomResource {
/**
* Get an existing InstanceGroupNamedPort 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 InstanceGroupNamedPort(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'gcp:compute/instanceGroupNamedPort:InstanceGroupNamedPort';
/**
* Returns true if the given object is an instance of InstanceGroupNamedPort. 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'] === InstanceGroupNamedPort.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["deletionPolicy"] = state?.deletionPolicy;
resourceInputs["group"] = state?.group;
resourceInputs["name"] = state?.name;
resourceInputs["port"] = state?.port;
resourceInputs["project"] = state?.project;
resourceInputs["zone"] = state?.zone;
}
else {
const args = argsOrState;
if (args?.group === undefined && !opts.urn) {
throw new Error("Missing required property 'group'");
}
if (args?.port === undefined && !opts.urn) {
throw new Error("Missing required property 'port'");
}
resourceInputs["deletionPolicy"] = args?.deletionPolicy;
resourceInputs["group"] = args?.group;
resourceInputs["name"] = args?.name;
resourceInputs["port"] = args?.port;
resourceInputs["project"] = args?.project;
resourceInputs["zone"] = args?.zone;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(InstanceGroupNamedPort.__pulumiType, name, resourceInputs, opts);
}
}
exports.InstanceGroupNamedPort = InstanceGroupNamedPort;
//# sourceMappingURL=instanceGroupNamedPort.js.map