@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
345 lines • 21.8 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.Cluster = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = 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 secrets in state](https://www.pulumi.com/docs/intro/concepts/programming-model/#secrets).
*
* ## 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}}
* ```
*
* ```sh
* $ pulumi import gcp:container/cluster:Cluster default {{project_id}}/{{location}}/{{cluster_id}}
* ```
*
* ```sh
* $ pulumi import gcp:container/cluster:Cluster default {{location}}/{{cluster_id}}
* ```
*
* For example, the following fields will show diffs if set in config:
*
* - `min_master_version`
*
* - `remove_default_node_pool`
*/
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, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* 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 ? state.addonsConfig : undefined;
resourceInputs["allowNetAdmin"] = state ? state.allowNetAdmin : undefined;
resourceInputs["authenticatorGroupsConfig"] = state ? state.authenticatorGroupsConfig : undefined;
resourceInputs["binaryAuthorization"] = state ? state.binaryAuthorization : undefined;
resourceInputs["clusterAutoscaling"] = state ? state.clusterAutoscaling : undefined;
resourceInputs["clusterIpv4Cidr"] = state ? state.clusterIpv4Cidr : undefined;
resourceInputs["clusterTelemetry"] = state ? state.clusterTelemetry : undefined;
resourceInputs["confidentialNodes"] = state ? state.confidentialNodes : undefined;
resourceInputs["controlPlaneEndpointsConfig"] = state ? state.controlPlaneEndpointsConfig : undefined;
resourceInputs["costManagementConfig"] = state ? state.costManagementConfig : undefined;
resourceInputs["databaseEncryption"] = state ? state.databaseEncryption : undefined;
resourceInputs["datapathProvider"] = state ? state.datapathProvider : undefined;
resourceInputs["defaultMaxPodsPerNode"] = state ? state.defaultMaxPodsPerNode : undefined;
resourceInputs["defaultSnatStatus"] = state ? state.defaultSnatStatus : undefined;
resourceInputs["deletionProtection"] = state ? state.deletionProtection : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["disableL4LbFirewallReconciliation"] = state ? state.disableL4LbFirewallReconciliation : undefined;
resourceInputs["dnsConfig"] = state ? state.dnsConfig : undefined;
resourceInputs["effectiveLabels"] = state ? state.effectiveLabels : undefined;
resourceInputs["enableAutopilot"] = state ? state.enableAutopilot : undefined;
resourceInputs["enableCiliumClusterwideNetworkPolicy"] = state ? state.enableCiliumClusterwideNetworkPolicy : undefined;
resourceInputs["enableFqdnNetworkPolicy"] = state ? state.enableFqdnNetworkPolicy : undefined;
resourceInputs["enableIntranodeVisibility"] = state ? state.enableIntranodeVisibility : undefined;
resourceInputs["enableK8sBetaApis"] = state ? state.enableK8sBetaApis : undefined;
resourceInputs["enableKubernetesAlpha"] = state ? state.enableKubernetesAlpha : undefined;
resourceInputs["enableL4IlbSubsetting"] = state ? state.enableL4IlbSubsetting : undefined;
resourceInputs["enableLegacyAbac"] = state ? state.enableLegacyAbac : undefined;
resourceInputs["enableMultiNetworking"] = state ? state.enableMultiNetworking : undefined;
resourceInputs["enableShieldedNodes"] = state ? state.enableShieldedNodes : undefined;
resourceInputs["enableTpu"] = state ? state.enableTpu : undefined;
resourceInputs["endpoint"] = state ? state.endpoint : undefined;
resourceInputs["enterpriseConfig"] = state ? state.enterpriseConfig : undefined;
resourceInputs["fleet"] = state ? state.fleet : undefined;
resourceInputs["gatewayApiConfig"] = state ? state.gatewayApiConfig : undefined;
resourceInputs["identityServiceConfig"] = state ? state.identityServiceConfig : undefined;
resourceInputs["initialNodeCount"] = state ? state.initialNodeCount : undefined;
resourceInputs["ipAllocationPolicy"] = state ? state.ipAllocationPolicy : undefined;
resourceInputs["labelFingerprint"] = state ? state.labelFingerprint : undefined;
resourceInputs["location"] = state ? state.location : undefined;
resourceInputs["loggingConfig"] = state ? state.loggingConfig : undefined;
resourceInputs["loggingService"] = state ? state.loggingService : undefined;
resourceInputs["maintenancePolicy"] = state ? state.maintenancePolicy : undefined;
resourceInputs["masterAuth"] = state ? state.masterAuth : undefined;
resourceInputs["masterAuthorizedNetworksConfig"] = state ? state.masterAuthorizedNetworksConfig : undefined;
resourceInputs["masterVersion"] = state ? state.masterVersion : undefined;
resourceInputs["meshCertificates"] = state ? state.meshCertificates : undefined;
resourceInputs["minMasterVersion"] = state ? state.minMasterVersion : undefined;
resourceInputs["monitoringConfig"] = state ? state.monitoringConfig : undefined;
resourceInputs["monitoringService"] = state ? state.monitoringService : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["network"] = state ? state.network : undefined;
resourceInputs["networkPolicy"] = state ? state.networkPolicy : undefined;
resourceInputs["networkingMode"] = state ? state.networkingMode : undefined;
resourceInputs["nodeConfig"] = state ? state.nodeConfig : undefined;
resourceInputs["nodeLocations"] = state ? state.nodeLocations : undefined;
resourceInputs["nodePoolAutoConfig"] = state ? state.nodePoolAutoConfig : undefined;
resourceInputs["nodePoolDefaults"] = state ? state.nodePoolDefaults : undefined;
resourceInputs["nodePools"] = state ? state.nodePools : undefined;
resourceInputs["nodeVersion"] = state ? state.nodeVersion : undefined;
resourceInputs["notificationConfig"] = state ? state.notificationConfig : undefined;
resourceInputs["operation"] = state ? state.operation : undefined;
resourceInputs["podAutoscaling"] = state ? state.podAutoscaling : undefined;
resourceInputs["podSecurityPolicyConfig"] = state ? state.podSecurityPolicyConfig : undefined;
resourceInputs["privateClusterConfig"] = state ? state.privateClusterConfig : undefined;
resourceInputs["privateIpv6GoogleAccess"] = state ? state.privateIpv6GoogleAccess : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["protectConfig"] = state ? state.protectConfig : undefined;
resourceInputs["pulumiLabels"] = state ? state.pulumiLabels : undefined;
resourceInputs["releaseChannel"] = state ? state.releaseChannel : undefined;
resourceInputs["removeDefaultNodePool"] = state ? state.removeDefaultNodePool : undefined;
resourceInputs["resourceLabels"] = state ? state.resourceLabels : undefined;
resourceInputs["resourceUsageExportConfig"] = state ? state.resourceUsageExportConfig : undefined;
resourceInputs["secretManagerConfig"] = state ? state.secretManagerConfig : undefined;
resourceInputs["securityPostureConfig"] = state ? state.securityPostureConfig : undefined;
resourceInputs["selfLink"] = state ? state.selfLink : undefined;
resourceInputs["serviceExternalIpsConfig"] = state ? state.serviceExternalIpsConfig : undefined;
resourceInputs["servicesIpv4Cidr"] = state ? state.servicesIpv4Cidr : undefined;
resourceInputs["subnetwork"] = state ? state.subnetwork : undefined;
resourceInputs["tpuConfig"] = state ? state.tpuConfig : undefined;
resourceInputs["tpuIpv4CidrBlock"] = state ? state.tpuIpv4CidrBlock : undefined;
resourceInputs["userManagedKeysConfig"] = state ? state.userManagedKeysConfig : undefined;
resourceInputs["verticalPodAutoscaling"] = state ? state.verticalPodAutoscaling : undefined;
resourceInputs["workloadAltsConfig"] = state ? state.workloadAltsConfig : undefined;
resourceInputs["workloadIdentityConfig"] = state ? state.workloadIdentityConfig : undefined;
}
else {
const args = argsOrState;
resourceInputs["addonsConfig"] = args ? args.addonsConfig : undefined;
resourceInputs["allowNetAdmin"] = args ? args.allowNetAdmin : undefined;
resourceInputs["authenticatorGroupsConfig"] = args ? args.authenticatorGroupsConfig : undefined;
resourceInputs["binaryAuthorization"] = args ? args.binaryAuthorization : undefined;
resourceInputs["clusterAutoscaling"] = args ? args.clusterAutoscaling : undefined;
resourceInputs["clusterIpv4Cidr"] = args ? args.clusterIpv4Cidr : undefined;
resourceInputs["clusterTelemetry"] = args ? args.clusterTelemetry : undefined;
resourceInputs["confidentialNodes"] = args ? args.confidentialNodes : undefined;
resourceInputs["controlPlaneEndpointsConfig"] = args ? args.controlPlaneEndpointsConfig : undefined;
resourceInputs["costManagementConfig"] = args ? args.costManagementConfig : undefined;
resourceInputs["databaseEncryption"] = args ? args.databaseEncryption : undefined;
resourceInputs["datapathProvider"] = args ? args.datapathProvider : undefined;
resourceInputs["defaultMaxPodsPerNode"] = args ? args.defaultMaxPodsPerNode : undefined;
resourceInputs["defaultSnatStatus"] = args ? args.defaultSnatStatus : undefined;
resourceInputs["deletionProtection"] = args ? args.deletionProtection : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["disableL4LbFirewallReconciliation"] = args ? args.disableL4LbFirewallReconciliation : undefined;
resourceInputs["dnsConfig"] = args ? args.dnsConfig : undefined;
resourceInputs["enableAutopilot"] = args ? args.enableAutopilot : undefined;
resourceInputs["enableCiliumClusterwideNetworkPolicy"] = args ? args.enableCiliumClusterwideNetworkPolicy : undefined;
resourceInputs["enableFqdnNetworkPolicy"] = args ? args.enableFqdnNetworkPolicy : undefined;
resourceInputs["enableIntranodeVisibility"] = args ? args.enableIntranodeVisibility : undefined;
resourceInputs["enableK8sBetaApis"] = args ? args.enableK8sBetaApis : undefined;
resourceInputs["enableKubernetesAlpha"] = args ? args.enableKubernetesAlpha : undefined;
resourceInputs["enableL4IlbSubsetting"] = args ? args.enableL4IlbSubsetting : undefined;
resourceInputs["enableLegacyAbac"] = args ? args.enableLegacyAbac : undefined;
resourceInputs["enableMultiNetworking"] = args ? args.enableMultiNetworking : undefined;
resourceInputs["enableShieldedNodes"] = args ? args.enableShieldedNodes : undefined;
resourceInputs["enableTpu"] = args ? args.enableTpu : undefined;
resourceInputs["enterpriseConfig"] = args ? args.enterpriseConfig : undefined;
resourceInputs["fleet"] = args ? args.fleet : undefined;
resourceInputs["gatewayApiConfig"] = args ? args.gatewayApiConfig : undefined;
resourceInputs["identityServiceConfig"] = args ? args.identityServiceConfig : undefined;
resourceInputs["initialNodeCount"] = args ? args.initialNodeCount : undefined;
resourceInputs["ipAllocationPolicy"] = args ? args.ipAllocationPolicy : undefined;
resourceInputs["location"] = args ? args.location : undefined;
resourceInputs["loggingConfig"] = args ? args.loggingConfig : undefined;
resourceInputs["loggingService"] = args ? args.loggingService : undefined;
resourceInputs["maintenancePolicy"] = args ? args.maintenancePolicy : undefined;
resourceInputs["masterAuth"] = args ? args.masterAuth : undefined;
resourceInputs["masterAuthorizedNetworksConfig"] = args ? args.masterAuthorizedNetworksConfig : undefined;
resourceInputs["meshCertificates"] = args ? args.meshCertificates : undefined;
resourceInputs["minMasterVersion"] = args ? args.minMasterVersion : undefined;
resourceInputs["monitoringConfig"] = args ? args.monitoringConfig : undefined;
resourceInputs["monitoringService"] = args ? args.monitoringService : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["network"] = args ? args.network : undefined;
resourceInputs["networkPolicy"] = args ? args.networkPolicy : undefined;
resourceInputs["networkingMode"] = args ? args.networkingMode : undefined;
resourceInputs["nodeConfig"] = args ? args.nodeConfig : undefined;
resourceInputs["nodeLocations"] = args ? args.nodeLocations : undefined;
resourceInputs["nodePoolAutoConfig"] = args ? args.nodePoolAutoConfig : undefined;
resourceInputs["nodePoolDefaults"] = args ? args.nodePoolDefaults : undefined;
resourceInputs["nodePools"] = args ? args.nodePools : undefined;
resourceInputs["nodeVersion"] = args ? args.nodeVersion : undefined;
resourceInputs["notificationConfig"] = args ? args.notificationConfig : undefined;
resourceInputs["podAutoscaling"] = args ? args.podAutoscaling : undefined;
resourceInputs["podSecurityPolicyConfig"] = args ? args.podSecurityPolicyConfig : undefined;
resourceInputs["privateClusterConfig"] = args ? args.privateClusterConfig : undefined;
resourceInputs["privateIpv6GoogleAccess"] = args ? args.privateIpv6GoogleAccess : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["protectConfig"] = args ? args.protectConfig : undefined;
resourceInputs["releaseChannel"] = args ? args.releaseChannel : undefined;
resourceInputs["removeDefaultNodePool"] = args ? args.removeDefaultNodePool : undefined;
resourceInputs["resourceLabels"] = args ? args.resourceLabels : undefined;
resourceInputs["resourceUsageExportConfig"] = args ? args.resourceUsageExportConfig : undefined;
resourceInputs["secretManagerConfig"] = args ? args.secretManagerConfig : undefined;
resourceInputs["securityPostureConfig"] = args ? args.securityPostureConfig : undefined;
resourceInputs["serviceExternalIpsConfig"] = args ? args.serviceExternalIpsConfig : undefined;
resourceInputs["subnetwork"] = args ? args.subnetwork : undefined;
resourceInputs["tpuConfig"] = args ? args.tpuConfig : undefined;
resourceInputs["userManagedKeysConfig"] = args ? args.userManagedKeysConfig : undefined;
resourceInputs["verticalPodAutoscaling"] = args ? args.verticalPodAutoscaling : undefined;
resourceInputs["workloadAltsConfig"] = args ? args.workloadAltsConfig : undefined;
resourceInputs["workloadIdentityConfig"] = args ? args.workloadIdentityConfig : undefined;
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;
/** @internal */
Cluster.__pulumiType = 'gcp:container/cluster:Cluster';
//# sourceMappingURL=cluster.js.map