@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
384 lines • 22.1 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.Cluster = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* Manages a Google Kubernetes Engine (GKE) cluster.
*
* To get more information about GKE clusters, see:
* * [The API reference](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters)
* * How-to guides
* * [GKE overview](https://cloud.google.com/kubernetes-engine/docs/concepts/kubernetes-engine-overview)
* * [About cluster configuration choices](https://cloud.google.com/kubernetes-engine/docs/concepts/types-of-clusters)
*
* > On version 5.0.0+ of the provider, you must explicitly set `deletionProtection = false`
* and run `pulumi up` to write the field to state in order to destroy a cluster.
*
* > All arguments and attributes (including certificate outputs) will be stored in the raw state as
* plaintext. Read more about sensitive data in state.
*
* ## Example Usage
*
* ### With A Separately Managed Node Pool (Recommended)
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const _default = new gcp.serviceaccount.Account("default", {
* accountId: "service-account-id",
* displayName: "Service Account",
* });
* const primary = new gcp.container.Cluster("primary", {
* name: "my-gke-cluster",
* location: "us-central1",
* removeDefaultNodePool: true,
* initialNodeCount: 1,
* });
* const primaryPreemptibleNodes = new gcp.container.NodePool("primary_preemptible_nodes", {
* name: "my-node-pool",
* location: "us-central1",
* cluster: primary.name,
* nodeCount: 1,
* nodeConfig: {
* preemptible: true,
* machineType: "e2-medium",
* serviceAccount: _default.email,
* oauthScopes: ["https://www.googleapis.com/auth/cloud-platform"],
* },
* });
* ```
*
* > **Note:** It is recommended that node pools be created and managed as separate resources as in the example above.
* This allows node pools to be added and removed without recreating the cluster. Node pools defined directly in the
* `gcp.container.Cluster` resource cannot be removed without re-creating the cluster.
*
* ### With The Default Node Pool
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const _default = new gcp.serviceaccount.Account("default", {
* accountId: "service-account-id",
* displayName: "Service Account",
* });
* const primary = new gcp.container.Cluster("primary", {
* name: "marcellus-wallace",
* location: "us-central1-a",
* initialNodeCount: 3,
* nodeConfig: {
* serviceAccount: _default.email,
* oauthScopes: ["https://www.googleapis.com/auth/cloud-platform"],
* labels: {
* foo: "bar",
* },
* tags: [
* "foo",
* "bar",
* ],
* },
* });
* ```
*
* ### Autopilot
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const _default = new gcp.serviceaccount.Account("default", {
* accountId: "service-account-id",
* displayName: "Service Account",
* });
* const primary = new gcp.container.Cluster("primary", {
* name: "marcellus-wallace",
* location: "us-central1-a",
* enableAutopilot: true,
* });
* ```
*
* ## Import
*
* GKE clusters can be imported using the `project` , `location`, and `name`. If the project is omitted, the default
* provider value will be used. Examples:
*
* * `projects/{{project_id}}/locations/{{location}}/clusters/{{cluster_id}}`
* * `{{project_id}}/{{location}}/{{cluster_id}}`
* * `{{location}}/{{cluster_id}}`
*
* When using the `pulumi import` command, GKE clusters can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:container/cluster:Cluster default projects/{{project_id}}/locations/{{location}}/clusters/{{cluster_id}}
*
* $ pulumi import gcp:container/cluster:Cluster default {{project_id}}/{{location}}/{{cluster_id}}
*
* $ pulumi import gcp:container/cluster:Cluster default {{location}}/{{cluster_id}}
* ```
*
* > **Note:** This resource has several fields that control Terraform-specific behavior and aren't present in the API. If they are set in config and you import a cluster, Terraform may need to perform an update immediately after import. Most of these updates should be no-ops but some may modify your cluster if the imported state differs.
*
* For example, the following fields will show diffs if set in config:
*
* - `minMasterVersion`
* - `removeDefaultNodePool`
*/
class Cluster extends pulumi.CustomResource {
/**
* Get an existing Cluster 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 Cluster(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'gcp:container/cluster:Cluster';
/**
* Returns true if the given object is an instance of Cluster. 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'] === Cluster.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["addonsConfig"] = state?.addonsConfig;
resourceInputs["allowNetAdmin"] = state?.allowNetAdmin;
resourceInputs["anonymousAuthenticationConfig"] = state?.anonymousAuthenticationConfig;
resourceInputs["authenticatorGroupsConfig"] = state?.authenticatorGroupsConfig;
resourceInputs["autopilotClusterPolicyConfig"] = state?.autopilotClusterPolicyConfig;
resourceInputs["autopilotPrivilegedAdmissions"] = state?.autopilotPrivilegedAdmissions;
resourceInputs["binaryAuthorization"] = state?.binaryAuthorization;
resourceInputs["clusterAutoscaling"] = state?.clusterAutoscaling;
resourceInputs["clusterIpv4Cidr"] = state?.clusterIpv4Cidr;
resourceInputs["clusterTelemetry"] = state?.clusterTelemetry;
resourceInputs["confidentialNodes"] = state?.confidentialNodes;
resourceInputs["controlPlaneEndpointsConfig"] = state?.controlPlaneEndpointsConfig;
resourceInputs["costManagementConfig"] = state?.costManagementConfig;
resourceInputs["databaseEncryption"] = state?.databaseEncryption;
resourceInputs["datapathProvider"] = state?.datapathProvider;
resourceInputs["defaultMaxPodsPerNode"] = state?.defaultMaxPodsPerNode;
resourceInputs["defaultSnatStatus"] = state?.defaultSnatStatus;
resourceInputs["deletionPolicy"] = state?.deletionPolicy;
resourceInputs["deletionProtection"] = state?.deletionProtection;
resourceInputs["description"] = state?.description;
resourceInputs["disableL4LbFirewallReconciliation"] = state?.disableL4LbFirewallReconciliation;
resourceInputs["dnsConfig"] = state?.dnsConfig;
resourceInputs["effectiveLabels"] = state?.effectiveLabels;
resourceInputs["enableAutopilot"] = state?.enableAutopilot;
resourceInputs["enableCiliumClusterwideNetworkPolicy"] = state?.enableCiliumClusterwideNetworkPolicy;
resourceInputs["enableFqdnNetworkPolicy"] = state?.enableFqdnNetworkPolicy;
resourceInputs["enableIntranodeVisibility"] = state?.enableIntranodeVisibility;
resourceInputs["enableK8sBetaApis"] = state?.enableK8sBetaApis;
resourceInputs["enableKubernetesAlpha"] = state?.enableKubernetesAlpha;
resourceInputs["enableL4IlbSubsetting"] = state?.enableL4IlbSubsetting;
resourceInputs["enableLegacyAbac"] = state?.enableLegacyAbac;
resourceInputs["enableMultiNetworking"] = state?.enableMultiNetworking;
resourceInputs["enableShieldedNodes"] = state?.enableShieldedNodes;
resourceInputs["enableTpu"] = state?.enableTpu;
resourceInputs["endpoint"] = state?.endpoint;
resourceInputs["enterpriseConfig"] = state?.enterpriseConfig;
resourceInputs["fleet"] = state?.fleet;
resourceInputs["gatewayApiConfig"] = state?.gatewayApiConfig;
resourceInputs["gkeAutoUpgradeConfig"] = state?.gkeAutoUpgradeConfig;
resourceInputs["identityServiceConfig"] = state?.identityServiceConfig;
resourceInputs["inTransitEncryptionConfig"] = state?.inTransitEncryptionConfig;
resourceInputs["initialNodeCount"] = state?.initialNodeCount;
resourceInputs["ipAllocationPolicy"] = state?.ipAllocationPolicy;
resourceInputs["labelFingerprint"] = state?.labelFingerprint;
resourceInputs["location"] = state?.location;
resourceInputs["loggingConfig"] = state?.loggingConfig;
resourceInputs["loggingService"] = state?.loggingService;
resourceInputs["maintenancePolicy"] = state?.maintenancePolicy;
resourceInputs["managedMachineLearningDiagnosticsConfig"] = state?.managedMachineLearningDiagnosticsConfig;
resourceInputs["managedOpentelemetryConfig"] = state?.managedOpentelemetryConfig;
resourceInputs["masterAuth"] = state?.masterAuth;
resourceInputs["masterAuthorizedNetworksConfig"] = state?.masterAuthorizedNetworksConfig;
resourceInputs["masterVersion"] = state?.masterVersion;
resourceInputs["meshCertificates"] = state?.meshCertificates;
resourceInputs["minMasterVersion"] = state?.minMasterVersion;
resourceInputs["monitoringConfig"] = state?.monitoringConfig;
resourceInputs["monitoringService"] = state?.monitoringService;
resourceInputs["name"] = state?.name;
resourceInputs["network"] = state?.network;
resourceInputs["networkPerformanceConfig"] = state?.networkPerformanceConfig;
resourceInputs["networkPolicy"] = state?.networkPolicy;
resourceInputs["networkingMode"] = state?.networkingMode;
resourceInputs["nodeConfig"] = state?.nodeConfig;
resourceInputs["nodeLocations"] = state?.nodeLocations;
resourceInputs["nodePoolAutoConfig"] = state?.nodePoolAutoConfig;
resourceInputs["nodePoolDefaults"] = state?.nodePoolDefaults;
resourceInputs["nodePools"] = state?.nodePools;
resourceInputs["nodeVersion"] = state?.nodeVersion;
resourceInputs["notificationConfig"] = state?.notificationConfig;
resourceInputs["operation"] = state?.operation;
resourceInputs["podAutoscaling"] = state?.podAutoscaling;
resourceInputs["podSecurityPolicyConfig"] = state?.podSecurityPolicyConfig;
resourceInputs["privateClusterConfig"] = state?.privateClusterConfig;
resourceInputs["privateIpv6GoogleAccess"] = state?.privateIpv6GoogleAccess;
resourceInputs["project"] = state?.project;
resourceInputs["protectConfig"] = state?.protectConfig;
resourceInputs["pulumiLabels"] = state?.pulumiLabels;
resourceInputs["rbacBindingConfig"] = state?.rbacBindingConfig;
resourceInputs["releaseChannel"] = state?.releaseChannel;
resourceInputs["removeDefaultNodePool"] = state?.removeDefaultNodePool;
resourceInputs["resourceLabels"] = state?.resourceLabels;
resourceInputs["resourceUsageExportConfig"] = state?.resourceUsageExportConfig;
resourceInputs["secretManagerConfig"] = state?.secretManagerConfig;
resourceInputs["secretSyncConfig"] = state?.secretSyncConfig;
resourceInputs["securityPostureConfig"] = state?.securityPostureConfig;
resourceInputs["selfLink"] = state?.selfLink;
resourceInputs["serviceExternalIpsConfig"] = state?.serviceExternalIpsConfig;
resourceInputs["servicesIpv4Cidr"] = state?.servicesIpv4Cidr;
resourceInputs["subnetwork"] = state?.subnetwork;
resourceInputs["tpuConfig"] = state?.tpuConfig;
resourceInputs["tpuIpv4CidrBlock"] = state?.tpuIpv4CidrBlock;
resourceInputs["userManagedKeysConfig"] = state?.userManagedKeysConfig;
resourceInputs["verticalPodAutoscaling"] = state?.verticalPodAutoscaling;
resourceInputs["workloadAltsConfig"] = state?.workloadAltsConfig;
resourceInputs["workloadIdentityConfig"] = state?.workloadIdentityConfig;
}
else {
const args = argsOrState;
resourceInputs["addonsConfig"] = args?.addonsConfig;
resourceInputs["allowNetAdmin"] = args?.allowNetAdmin;
resourceInputs["anonymousAuthenticationConfig"] = args?.anonymousAuthenticationConfig;
resourceInputs["authenticatorGroupsConfig"] = args?.authenticatorGroupsConfig;
resourceInputs["autopilotClusterPolicyConfig"] = args?.autopilotClusterPolicyConfig;
resourceInputs["autopilotPrivilegedAdmissions"] = args?.autopilotPrivilegedAdmissions;
resourceInputs["binaryAuthorization"] = args?.binaryAuthorization;
resourceInputs["clusterAutoscaling"] = args?.clusterAutoscaling;
resourceInputs["clusterIpv4Cidr"] = args?.clusterIpv4Cidr;
resourceInputs["clusterTelemetry"] = args?.clusterTelemetry;
resourceInputs["confidentialNodes"] = args?.confidentialNodes;
resourceInputs["controlPlaneEndpointsConfig"] = args?.controlPlaneEndpointsConfig;
resourceInputs["costManagementConfig"] = args?.costManagementConfig;
resourceInputs["databaseEncryption"] = args?.databaseEncryption;
resourceInputs["datapathProvider"] = args?.datapathProvider;
resourceInputs["defaultMaxPodsPerNode"] = args?.defaultMaxPodsPerNode;
resourceInputs["defaultSnatStatus"] = args?.defaultSnatStatus;
resourceInputs["deletionPolicy"] = args?.deletionPolicy;
resourceInputs["deletionProtection"] = args?.deletionProtection;
resourceInputs["description"] = args?.description;
resourceInputs["disableL4LbFirewallReconciliation"] = args?.disableL4LbFirewallReconciliation;
resourceInputs["dnsConfig"] = args?.dnsConfig;
resourceInputs["enableAutopilot"] = args?.enableAutopilot;
resourceInputs["enableCiliumClusterwideNetworkPolicy"] = args?.enableCiliumClusterwideNetworkPolicy;
resourceInputs["enableFqdnNetworkPolicy"] = args?.enableFqdnNetworkPolicy;
resourceInputs["enableIntranodeVisibility"] = args?.enableIntranodeVisibility;
resourceInputs["enableK8sBetaApis"] = args?.enableK8sBetaApis;
resourceInputs["enableKubernetesAlpha"] = args?.enableKubernetesAlpha;
resourceInputs["enableL4IlbSubsetting"] = args?.enableL4IlbSubsetting;
resourceInputs["enableLegacyAbac"] = args?.enableLegacyAbac;
resourceInputs["enableMultiNetworking"] = args?.enableMultiNetworking;
resourceInputs["enableShieldedNodes"] = args?.enableShieldedNodes;
resourceInputs["enableTpu"] = args?.enableTpu;
resourceInputs["enterpriseConfig"] = args?.enterpriseConfig;
resourceInputs["fleet"] = args?.fleet;
resourceInputs["gatewayApiConfig"] = args?.gatewayApiConfig;
resourceInputs["gkeAutoUpgradeConfig"] = args?.gkeAutoUpgradeConfig;
resourceInputs["identityServiceConfig"] = args?.identityServiceConfig;
resourceInputs["inTransitEncryptionConfig"] = args?.inTransitEncryptionConfig;
resourceInputs["initialNodeCount"] = args?.initialNodeCount;
resourceInputs["ipAllocationPolicy"] = args?.ipAllocationPolicy;
resourceInputs["location"] = args?.location;
resourceInputs["loggingConfig"] = args?.loggingConfig;
resourceInputs["loggingService"] = args?.loggingService;
resourceInputs["maintenancePolicy"] = args?.maintenancePolicy;
resourceInputs["managedMachineLearningDiagnosticsConfig"] = args?.managedMachineLearningDiagnosticsConfig;
resourceInputs["managedOpentelemetryConfig"] = args?.managedOpentelemetryConfig;
resourceInputs["masterAuth"] = args?.masterAuth;
resourceInputs["masterAuthorizedNetworksConfig"] = args?.masterAuthorizedNetworksConfig;
resourceInputs["meshCertificates"] = args?.meshCertificates;
resourceInputs["minMasterVersion"] = args?.minMasterVersion;
resourceInputs["monitoringConfig"] = args?.monitoringConfig;
resourceInputs["monitoringService"] = args?.monitoringService;
resourceInputs["name"] = args?.name;
resourceInputs["network"] = args?.network;
resourceInputs["networkPerformanceConfig"] = args?.networkPerformanceConfig;
resourceInputs["networkPolicy"] = args?.networkPolicy;
resourceInputs["networkingMode"] = args?.networkingMode;
resourceInputs["nodeConfig"] = args?.nodeConfig;
resourceInputs["nodeLocations"] = args?.nodeLocations;
resourceInputs["nodePoolAutoConfig"] = args?.nodePoolAutoConfig;
resourceInputs["nodePoolDefaults"] = args?.nodePoolDefaults;
resourceInputs["nodePools"] = args?.nodePools;
resourceInputs["nodeVersion"] = args?.nodeVersion;
resourceInputs["notificationConfig"] = args?.notificationConfig;
resourceInputs["podAutoscaling"] = args?.podAutoscaling;
resourceInputs["podSecurityPolicyConfig"] = args?.podSecurityPolicyConfig;
resourceInputs["privateClusterConfig"] = args?.privateClusterConfig;
resourceInputs["privateIpv6GoogleAccess"] = args?.privateIpv6GoogleAccess;
resourceInputs["project"] = args?.project;
resourceInputs["protectConfig"] = args?.protectConfig;
resourceInputs["rbacBindingConfig"] = args?.rbacBindingConfig;
resourceInputs["releaseChannel"] = args?.releaseChannel;
resourceInputs["removeDefaultNodePool"] = args?.removeDefaultNodePool;
resourceInputs["resourceLabels"] = args?.resourceLabels;
resourceInputs["resourceUsageExportConfig"] = args?.resourceUsageExportConfig;
resourceInputs["secretManagerConfig"] = args?.secretManagerConfig;
resourceInputs["secretSyncConfig"] = args?.secretSyncConfig;
resourceInputs["securityPostureConfig"] = args?.securityPostureConfig;
resourceInputs["serviceExternalIpsConfig"] = args?.serviceExternalIpsConfig;
resourceInputs["subnetwork"] = args?.subnetwork;
resourceInputs["tpuConfig"] = args?.tpuConfig;
resourceInputs["userManagedKeysConfig"] = args?.userManagedKeysConfig;
resourceInputs["verticalPodAutoscaling"] = args?.verticalPodAutoscaling;
resourceInputs["workloadAltsConfig"] = args?.workloadAltsConfig;
resourceInputs["workloadIdentityConfig"] = args?.workloadIdentityConfig;
resourceInputs["effectiveLabels"] = undefined /*out*/;
resourceInputs["endpoint"] = undefined /*out*/;
resourceInputs["labelFingerprint"] = undefined /*out*/;
resourceInputs["masterVersion"] = undefined /*out*/;
resourceInputs["operation"] = undefined /*out*/;
resourceInputs["pulumiLabels"] = undefined /*out*/;
resourceInputs["selfLink"] = undefined /*out*/;
resourceInputs["servicesIpv4Cidr"] = undefined /*out*/;
resourceInputs["tpuIpv4CidrBlock"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(Cluster.__pulumiType, name, resourceInputs, opts);
}
}
exports.Cluster = Cluster;
//# sourceMappingURL=cluster.js.map