@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
149 lines • 6.1 kB
JavaScript
;
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.InstanceGroupNamedPort = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = 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}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/instanceGroupNamedPort:InstanceGroupNamedPort default {{project}}/{{zone}}/{{group}}/{{port}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/instanceGroupNamedPort:InstanceGroupNamedPort default {{zone}}/{{group}}/{{port}}/{{name}}
* ```
*
* ```sh
* $ 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, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* 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["group"] = state ? state.group : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["port"] = state ? state.port : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["zone"] = state ? state.zone : undefined;
}
else {
const args = argsOrState;
if ((!args || args.group === undefined) && !opts.urn) {
throw new Error("Missing required property 'group'");
}
if ((!args || args.port === undefined) && !opts.urn) {
throw new Error("Missing required property 'port'");
}
resourceInputs["group"] = args ? args.group : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["port"] = args ? args.port : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["zone"] = args ? args.zone : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(InstanceGroupNamedPort.__pulumiType, name, resourceInputs, opts);
}
}
exports.InstanceGroupNamedPort = InstanceGroupNamedPort;
/** @internal */
InstanceGroupNamedPort.__pulumiType = 'gcp:compute/instanceGroupNamedPort:InstanceGroupNamedPort';
//# sourceMappingURL=instanceGroupNamedPort.js.map