UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

452 lines • 16.3 kB
"use strict"; // *** 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")); /** * A cluster in a private cloud. * * To get more information about Cluster, see: * * * [API documentation](https://cloud.google.com/vmware-engine/docs/reference/rest/v1/projects.locations.privateClouds.clusters) * * ## Example Usage * * ### Vmware Engine Cluster Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const cluster_nw = new gcp.vmwareengine.Network("cluster-nw", { * name: "pc-nw", * type: "STANDARD", * location: "global", * description: "PC network description.", * }); * const cluster_pc = new gcp.vmwareengine.PrivateCloud("cluster-pc", { * location: "us-west1-a", * name: "sample-pc", * description: "Sample test PC.", * networkConfig: { * managementCidr: "192.168.30.0/24", * vmwareEngineNetwork: cluster_nw.id, * }, * managementCluster: { * clusterId: "sample-mgmt-cluster", * nodeTypeConfigs: [{ * nodeTypeId: "standard-72", * nodeCount: 3, * }], * }, * }); * const vmw_engine_ext_cluster = new gcp.vmwareengine.Cluster("vmw-engine-ext-cluster", { * name: "ext-cluster", * parent: cluster_pc.id, * nodeTypeConfigs: [{ * nodeTypeId: "standard-72", * nodeCount: 3, * }], * }); * ``` * ### Vmware Engine Cluster Full * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const cluster_nw = new gcp.vmwareengine.Network("cluster-nw", { * name: "pc-nw", * type: "STANDARD", * location: "global", * description: "PC network description.", * }); * const cluster_pc = new gcp.vmwareengine.PrivateCloud("cluster-pc", { * location: "us-west1-a", * name: "sample-pc", * description: "Sample test PC.", * networkConfig: { * managementCidr: "192.168.30.0/24", * vmwareEngineNetwork: cluster_nw.id, * }, * managementCluster: { * clusterId: "sample-mgmt-cluster", * nodeTypeConfigs: [{ * nodeTypeId: "standard-72", * nodeCount: 3, * customCoreCount: 32, * }], * }, * }); * const vmw_ext_cluster = new gcp.vmwareengine.Cluster("vmw-ext-cluster", { * name: "ext-cluster", * parent: cluster_pc.id, * nodeTypeConfigs: [{ * nodeTypeId: "standard-72", * nodeCount: 3, * customCoreCount: 32, * }], * autoscalingSettings: { * autoscalingPolicies: [{ * autoscalePolicyId: "autoscaling-policy", * nodeTypeId: "standard-72", * scaleOutSize: 1, * cpuThresholds: { * scaleOut: 80, * scaleIn: 15, * }, * consumedMemoryThresholds: { * scaleOut: 75, * scaleIn: 20, * }, * storageThresholds: { * scaleOut: 80, * scaleIn: 20, * }, * }], * minClusterNodeCount: 3, * maxClusterNodeCount: 8, * coolDownPeriod: "1800s", * }, * }); * ``` * ### Vmware Engine Cluster Nfs Datastore Filestore * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * import * as std from "@pulumi/std"; * * // Use this network for filestore instance * const fsNetwork = gcp.compute.getNetwork({ * name: "filestore_nw", * }); * // Create a filestore instance with delete protection enabled * //### Use ip range of private cloud service subnet in the 'nfs_export_options' * const testInstance = new gcp.filestore.Instance("test_instance", { * name: "test-fs-filestore", * location: "", * tier: "ZONAL", * deletionProtectionEnabled: "yes" === "true", * fileShares: { * capacityGb: 1024, * name: "share101", * nfsExportOptions: [{ * ipRanges: ["10.0.0.0/24"], * }], * }, * networks: [{ * network: fsNetwork.then(fsNetwork => fsNetwork.id), * modes: ["MODE_IPV4"], * connectMode: "PRIVATE_SERVICE_ACCESS", * }], * }); * const cluster_nw = new gcp.vmwareengine.Network("cluster-nw", { * name: "pc-nw", * type: "STANDARD", * location: "global", * description: "PC network description.", * }); * const cluster_pc = new gcp.vmwareengine.PrivateCloud("cluster-pc", { * location: "", * name: "sample-pc", * description: "Sample test PC.", * networkConfig: { * managementCidr: "192.168.30.0/24", * vmwareEngineNetwork: cluster_nw.id, * }, * managementCluster: { * clusterId: "sample-mgmt-cluster", * nodeTypeConfigs: [{ * nodeTypeId: "standard-72", * nodeCount: 3, * customCoreCount: 32, * }], * }, * }); * // Update service subnet * //### Service subnet is used by nfs datastore mounts * //### ip_cidr_range configured on subnet must also be allowed in filestore instance's 'nfs_export_options' * const cluster_pc_subnet = new gcp.vmwareengine.Subnet("cluster-pc-subnet", { * name: "service-1", * parent: cluster_pc.id, * ipCidrRange: "10.0.0.0/24", * }); * // Read network peering * //### This peering is created by filestore instance * const snPeering = fsNetwork.then(fsNetwork => gcp.compute.getNetworkPeering({ * name: "servicenetworking-googleapis-com", * network: fsNetwork.id, * })); * // Create vmware engine network peering * //## vmware network peering is required for filestore mount on cluster * const psaNetworkPeering = new gcp.vmwareengine.NetworkPeering("psa_network_peering", { * name: "tf-test-psa-network-peering", * description: "test description", * vmwareEngineNetwork: cluster_nw.id, * peerNetwork: snPeering.then(snPeering => std.trimprefix({ * input: snPeering.peerNetwork, * prefix: "https://www.googleapis.com/compute/v1", * })).then(invoke => invoke.result), * peerNetworkType: "PRIVATE_SERVICES_ACCESS", * }); * const testFsDatastore = new gcp.vmwareengine.Datastore("test_fs_datastore", { * name: "ext-fs-datastore", * location: "", * description: "test description", * nfsDatastore: { * googleFileService: { * filestoreInstance: testInstance.id, * }, * }, * }); * const vmw_ext_cluster = new gcp.vmwareengine.Cluster("vmw-ext-cluster", { * name: "ext-cluster", * parent: cluster_pc.id, * nodeTypeConfigs: [{ * nodeTypeId: "standard-72", * nodeCount: 3, * }], * datastoreMountConfigs: [{ * datastore: testFsDatastore.id, * datastoreNetwork: { * subnet: cluster_pc_subnet.id, * connectionCount: 4, * mtu: 1500, * }, * nfsVersion: "NFS_V3", * accessMode: "READ_WRITE", * ignoreColocation: false, * }], * }, { * dependsOn: [psaNetworkPeering], * }); * ``` * ### Vmware Engine Cluster Nfs Datastore Netapp * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * import * as std from "@pulumi/std"; * * // Use this network for netapp volume * const npNetwork = gcp.compute.getNetwork({ * name: "netapp_nw", * }); * const cluster_nw = new gcp.vmwareengine.Network("cluster-nw", { * name: "pc-nw", * type: "STANDARD", * location: "global", * description: "PC network description.", * }); * // Read network peering * //### This peering is created by netapp volume * const snPeering = npNetwork.then(npNetwork => gcp.compute.getNetworkPeering({ * name: "sn-netapp-prod", * network: npNetwork.id, * })); * // Create vmware engine network peering * //### vmware network peering is required for netapp mount on cluster * const gcnvNetworkPeering = new gcp.vmwareengine.NetworkPeering("gcnv_network_peering", { * name: "tf-test-gcnv-network-peering", * description: "test description", * vmwareEngineNetwork: cluster_nw.id, * peerNetwork: snPeering.then(snPeering => std.trimprefix({ * input: snPeering.peerNetwork, * prefix: "https://www.googleapis.com/compute/v1", * })).then(invoke => invoke.result), * peerNetworkType: "GOOGLE_CLOUD_NETAPP_VOLUMES", * }); * const cluster_pc = new gcp.vmwareengine.PrivateCloud("cluster-pc", { * location: "", * name: "sample-pc", * description: "Sample test PC.", * networkConfig: { * managementCidr: "192.168.30.0/24", * vmwareEngineNetwork: cluster_nw.id, * }, * managementCluster: { * clusterId: "sample-mgmt-cluster", * nodeTypeConfigs: [{ * nodeTypeId: "standard-72", * nodeCount: 3, * customCoreCount: 32, * }], * }, * }); * // Update service subnet * //### Service subnet is used by nfs datastore mounts * //### ip_cidr_range configured on subnet must also be allowed in in netapp volumes's 'export_policy' * const cluster_pc_subnet = new gcp.vmwareengine.Subnet("cluster-pc-subnet", { * name: "service-1", * parent: cluster_pc.id, * ipCidrRange: "10.0.0.0/24", * }); * const _default = new gcp.netapp.StoragePool("default", { * name: "tf-test-test-pool", * location: "us-west1", * serviceLevel: "PREMIUM", * capacityGib: "2048", * network: npNetwork.then(npNetwork => npNetwork.id), * }); * // Create a netapp volume with delete protection enabled * //## Use ip range of private cloud service subnet in the 'export_policy' * const testVolume = new gcp.netapp.Volume("test_volume", { * location: "us-west1", * name: "tf-test-test-volume", * capacityGib: "100", * shareName: "tf-test-test-volume", * storagePool: _default.name, * protocols: ["NFSV3"], * exportPolicy: { * rules: [{ * accessType: "READ_WRITE", * allowedClients: "10.0.0.0/24", * hasRootAccess: "true", * kerberos5ReadOnly: false, * kerberos5ReadWrite: false, * kerberos5iReadOnly: false, * kerberos5iReadWrite: false, * kerberos5pReadOnly: false, * kerberos5pReadWrite: false, * nfsv3: true, * nfsv4: false, * }], * }, * restrictedActions: ["DELETE"], * }); * const testFsDatastore = new gcp.vmwareengine.Datastore("test_fs_datastore", { * name: "ext-fs-datastore", * location: "us-west1", * description: "example google_file_service.netapp datastore.", * nfsDatastore: { * googleFileService: { * netappVolume: testVolume.id, * }, * }, * }); * const vmw_ext_cluster = new gcp.vmwareengine.Cluster("vmw-ext-cluster", { * name: "ext-cluster", * parent: cluster_pc.id, * nodeTypeConfigs: [{ * nodeTypeId: "standard-72", * nodeCount: 3, * }], * datastoreMountConfigs: [{ * datastore: testFsDatastore.id, * datastoreNetwork: { * subnet: cluster_pc_subnet.id, * connectionCount: 4, * mtu: 1500, * }, * nfsVersion: "NFS_V3", * accessMode: "READ_WRITE", * ignoreColocation: true, * }], * }, { * dependsOn: [gcnvNetworkPeering], * }); * ``` * * ## Import * * Cluster can be imported using any of these accepted formats: * * * `{{parent}}/clusters/{{name}}` * * When using the `pulumi import` command, Cluster can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:vmwareengine/cluster:Cluster default {{parent}}/clusters/{{name}} * ``` */ 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:vmwareengine/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["autoscalingSettings"] = state?.autoscalingSettings; resourceInputs["createTime"] = state?.createTime; resourceInputs["datastoreMountConfigs"] = state?.datastoreMountConfigs; resourceInputs["deletionPolicy"] = state?.deletionPolicy; resourceInputs["management"] = state?.management; resourceInputs["name"] = state?.name; resourceInputs["nodeTypeConfigs"] = state?.nodeTypeConfigs; resourceInputs["parent"] = state?.parent; resourceInputs["state"] = state?.state; resourceInputs["uid"] = state?.uid; resourceInputs["updateTime"] = state?.updateTime; } else { const args = argsOrState; if (args?.parent === undefined && !opts.urn) { throw new Error("Missing required property 'parent'"); } resourceInputs["autoscalingSettings"] = args?.autoscalingSettings; resourceInputs["datastoreMountConfigs"] = args?.datastoreMountConfigs; resourceInputs["deletionPolicy"] = args?.deletionPolicy; resourceInputs["name"] = args?.name; resourceInputs["nodeTypeConfigs"] = args?.nodeTypeConfigs; resourceInputs["parent"] = args?.parent; resourceInputs["createTime"] = undefined /*out*/; resourceInputs["management"] = undefined /*out*/; resourceInputs["state"] = undefined /*out*/; resourceInputs["uid"] = undefined /*out*/; resourceInputs["updateTime"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Cluster.__pulumiType, name, resourceInputs, opts); } } exports.Cluster = Cluster; //# sourceMappingURL=cluster.js.map