@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
251 lines • 10.2 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.NodePool = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* "A set of Kubernetes nodes in a cluster with common configuration and specification."
*
* To get more information about NodePool, see:
*
* * [API documentation](https://cloud.google.com/distributed-cloud/edge/latest/docs/reference/container/rest/v1/projects.locations.clusters.nodePools)
* * How-to Guides
* * [Google Distributed Cloud Edge](https://cloud.google.com/distributed-cloud/edge/latest/docs)
*
* ## Example Usage
*
* ### Edgecontainer Node Pool
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const project = gcp.organizations.getProject({});
* const cluster = new gcp.edgecontainer.Cluster("cluster", {
* name: "default",
* location: "us-central1",
* authorization: {
* adminUsers: {
* username: "admin@hashicorptest.com",
* },
* },
* networking: {
* clusterIpv4CidrBlocks: ["10.0.0.0/16"],
* servicesIpv4CidrBlocks: ["10.1.0.0/16"],
* },
* fleet: {
* project: project.then(project => `projects/${project.number}`),
* },
* });
* const _default = new gcp.edgecontainer.NodePool("default", {
* name: "nodepool-1",
* cluster: cluster.name,
* location: "us-central1",
* nodeLocation: "us-central1-edge-example-edgesite",
* nodeCount: 3,
* labels: {
* my_key: "my_val",
* other_key: "other_val",
* },
* });
* ```
* ### Edgecontainer Node Pool With Cmek
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const project = gcp.organizations.getProject({});
* const cluster = new gcp.edgecontainer.Cluster("cluster", {
* name: "default",
* location: "us-central1",
* authorization: {
* adminUsers: {
* username: "admin@hashicorptest.com",
* },
* },
* networking: {
* clusterIpv4CidrBlocks: ["10.0.0.0/16"],
* servicesIpv4CidrBlocks: ["10.1.0.0/16"],
* },
* fleet: {
* project: project.then(project => `projects/${project.number}`),
* },
* });
* const keyRing = new gcp.kms.KeyRing("key_ring", {
* name: "keyring",
* location: "us-central1",
* });
* const cryptoKeyCryptoKey = new gcp.kms.CryptoKey("crypto_key", {
* name: "key",
* keyRing: keyRing.id,
* });
* const cryptoKey = new gcp.kms.CryptoKeyIAMMember("crypto_key", {
* cryptoKeyId: cryptoKeyCryptoKey.id,
* role: "roles/cloudkms.cryptoKeyEncrypterDecrypter",
* member: project.then(project => `serviceAccount:service-${project.number}@gcp-sa-edgecontainer.iam.gserviceaccount.com`),
* });
* const _default = new gcp.edgecontainer.NodePool("default", {
* name: "nodepool-1",
* cluster: cluster.name,
* location: "us-central1",
* nodeLocation: "us-central1-edge-example-edgesite",
* nodeCount: 3,
* localDiskEncryption: {
* kmsKey: cryptoKeyCryptoKey.id,
* },
* }, {
* dependsOn: [cryptoKey],
* });
* ```
* ### Edgecontainer Local Control Plane Node Pool
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const project = gcp.organizations.getProject({});
* const _default = new gcp.edgecontainer.Cluster("default", {
* name: "",
* location: "us-central1",
* authorization: {
* adminUsers: {
* username: "admin@hashicorptest.com",
* },
* },
* networking: {
* clusterIpv4CidrBlocks: ["10.0.0.0/16"],
* servicesIpv4CidrBlocks: ["10.1.0.0/16"],
* },
* fleet: {
* project: project.then(project => `projects/${project.number}`),
* },
* externalLoadBalancerIpv4AddressPools: ["10.100.0.0-10.100.0.10"],
* controlPlane: {
* local: {
* nodeLocation: "us-central1-edge-example-edgesite",
* nodeCount: 1,
* machineFilter: "machine-name",
* sharedDeploymentPolicy: "ALLOWED",
* },
* },
* });
* const defaultNodePool = new gcp.edgecontainer.NodePool("default", {
* name: "nodepool-1",
* cluster: cluster.name,
* location: "us-central1",
* nodeLocation: "us-central1-edge-example-edgesite",
* nodeCount: 3,
* });
* ```
*
* ## Import
*
* NodePool can be imported using any of these accepted formats:
*
* * `projects/{{project}}/locations/{{location}}/clusters/{{cluster}}/nodePools/{{name}}`
*
* * `{{project}}/{{location}}/{{cluster}}/{{name}}`
*
* * `{{location}}/{{cluster}}/{{name}}`
*
* When using the `pulumi import` command, NodePool can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:edgecontainer/nodePool:NodePool default projects/{{project}}/locations/{{location}}/clusters/{{cluster}}/nodePools/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:edgecontainer/nodePool:NodePool default {{project}}/{{location}}/{{cluster}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:edgecontainer/nodePool:NodePool default {{location}}/{{cluster}}/{{name}}
* ```
*/
class NodePool extends pulumi.CustomResource {
/**
* Get an existing NodePool 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 NodePool(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of NodePool. 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'] === NodePool.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["cluster"] = state ? state.cluster : undefined;
resourceInputs["createTime"] = state ? state.createTime : undefined;
resourceInputs["effectiveLabels"] = state ? state.effectiveLabels : undefined;
resourceInputs["labels"] = state ? state.labels : undefined;
resourceInputs["localDiskEncryption"] = state ? state.localDiskEncryption : undefined;
resourceInputs["location"] = state ? state.location : undefined;
resourceInputs["machineFilter"] = state ? state.machineFilter : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["nodeConfig"] = state ? state.nodeConfig : undefined;
resourceInputs["nodeCount"] = state ? state.nodeCount : undefined;
resourceInputs["nodeLocation"] = state ? state.nodeLocation : undefined;
resourceInputs["nodeVersion"] = state ? state.nodeVersion : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["pulumiLabels"] = state ? state.pulumiLabels : undefined;
resourceInputs["updateTime"] = state ? state.updateTime : undefined;
}
else {
const args = argsOrState;
if ((!args || args.cluster === undefined) && !opts.urn) {
throw new Error("Missing required property 'cluster'");
}
if ((!args || args.location === undefined) && !opts.urn) {
throw new Error("Missing required property 'location'");
}
if ((!args || args.nodeCount === undefined) && !opts.urn) {
throw new Error("Missing required property 'nodeCount'");
}
if ((!args || args.nodeLocation === undefined) && !opts.urn) {
throw new Error("Missing required property 'nodeLocation'");
}
resourceInputs["cluster"] = args ? args.cluster : undefined;
resourceInputs["labels"] = args ? args.labels : undefined;
resourceInputs["localDiskEncryption"] = args ? args.localDiskEncryption : undefined;
resourceInputs["location"] = args ? args.location : undefined;
resourceInputs["machineFilter"] = args ? args.machineFilter : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["nodeConfig"] = args ? args.nodeConfig : undefined;
resourceInputs["nodeCount"] = args ? args.nodeCount : undefined;
resourceInputs["nodeLocation"] = args ? args.nodeLocation : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["createTime"] = undefined /*out*/;
resourceInputs["effectiveLabels"] = undefined /*out*/;
resourceInputs["nodeVersion"] = undefined /*out*/;
resourceInputs["pulumiLabels"] = undefined /*out*/;
resourceInputs["updateTime"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(NodePool.__pulumiType, name, resourceInputs, opts);
}
}
exports.NodePool = NodePool;
/** @internal */
NodePool.__pulumiType = 'gcp:edgecontainer/nodePool:NodePool';
//# sourceMappingURL=nodePool.js.map