UNPKG

@pulumi/gcp

Version:

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

550 lines • 20 kB
"use strict"; // *** 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"); /** * ## Example Usage * * ### Redis Cluster Ha * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const consumerNet = new gcp.compute.Network("consumer_net", { * name: "my-network", * autoCreateSubnetworks: false, * }); * const consumerSubnet = new gcp.compute.Subnetwork("consumer_subnet", { * name: "my-subnet", * ipCidrRange: "10.0.0.248/29", * region: "us-central1", * network: consumerNet.id, * }); * const _default = new gcp.networkconnectivity.ServiceConnectionPolicy("default", { * name: "my-policy", * location: "us-central1", * serviceClass: "gcp-memorystore-redis", * description: "my basic service connection policy", * network: consumerNet.id, * pscConfig: { * subnetworks: [consumerSubnet.id], * }, * }); * const cluster_ha = new gcp.redis.Cluster("cluster-ha", { * name: "ha-cluster", * shardCount: 3, * pscConfigs: [{ * network: consumerNet.id, * }], * region: "us-central1", * replicaCount: 1, * nodeType: "REDIS_SHARED_CORE_NANO", * transitEncryptionMode: "TRANSIT_ENCRYPTION_MODE_DISABLED", * authorizationMode: "AUTH_MODE_DISABLED", * redisConfigs: { * "maxmemory-policy": "volatile-ttl", * }, * deletionProtectionEnabled: true, * zoneDistributionConfig: { * mode: "MULTI_ZONE", * }, * maintenancePolicy: { * weeklyMaintenanceWindows: [{ * day: "MONDAY", * startTime: { * hours: 1, * minutes: 0, * seconds: 0, * nanos: 0, * }, * }], * }, * }, { * dependsOn: [_default], * }); * ``` * ### Redis Cluster Ha Single Zone * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const consumerNet = new gcp.compute.Network("consumer_net", { * name: "my-network", * autoCreateSubnetworks: false, * }); * const consumerSubnet = new gcp.compute.Subnetwork("consumer_subnet", { * name: "my-subnet", * ipCidrRange: "10.0.0.248/29", * region: "us-central1", * network: consumerNet.id, * }); * const _default = new gcp.networkconnectivity.ServiceConnectionPolicy("default", { * name: "my-policy", * location: "us-central1", * serviceClass: "gcp-memorystore-redis", * description: "my basic service connection policy", * network: consumerNet.id, * pscConfig: { * subnetworks: [consumerSubnet.id], * }, * }); * const cluster_ha_single_zone = new gcp.redis.Cluster("cluster-ha-single-zone", { * name: "ha-cluster-single-zone", * shardCount: 3, * pscConfigs: [{ * network: consumerNet.id, * }], * region: "us-central1", * zoneDistributionConfig: { * mode: "SINGLE_ZONE", * zone: "us-central1-f", * }, * maintenancePolicy: { * weeklyMaintenanceWindows: [{ * day: "MONDAY", * startTime: { * hours: 1, * minutes: 0, * seconds: 0, * nanos: 0, * }, * }], * }, * deletionProtectionEnabled: true, * }, { * dependsOn: [_default], * }); * ``` * ### Redis Cluster Secondary * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const consumerNet = new gcp.compute.Network("consumer_net", { * name: "mynetwork", * autoCreateSubnetworks: false, * }); * const primaryClusterConsumerSubnet = new gcp.compute.Subnetwork("primary_cluster_consumer_subnet", { * name: "mysubnet-primary-cluster", * ipCidrRange: "10.0.1.0/29", * region: "us-east1", * network: consumerNet.id, * }); * const primaryClusterRegionScp = new gcp.networkconnectivity.ServiceConnectionPolicy("primary_cluster_region_scp", { * name: "mypolicy-primary-cluster", * location: "us-east1", * serviceClass: "gcp-memorystore-redis", * description: "Primary cluster service connection policy", * network: consumerNet.id, * pscConfig: { * subnetworks: [primaryClusterConsumerSubnet.id], * }, * }); * // Primary cluster * const primaryCluster = new gcp.redis.Cluster("primary_cluster", { * name: "my-primary-cluster", * region: "us-east1", * pscConfigs: [{ * network: consumerNet.id, * }], * authorizationMode: "AUTH_MODE_DISABLED", * transitEncryptionMode: "TRANSIT_ENCRYPTION_MODE_DISABLED", * shardCount: 3, * redisConfigs: { * "maxmemory-policy": "volatile-ttl", * }, * nodeType: "REDIS_HIGHMEM_MEDIUM", * persistenceConfig: { * mode: "RDB", * rdbConfig: { * rdbSnapshotPeriod: "ONE_HOUR", * rdbSnapshotStartTime: "2024-10-02T15:01:23Z", * }, * }, * zoneDistributionConfig: { * mode: "MULTI_ZONE", * }, * replicaCount: 1, * maintenancePolicy: { * weeklyMaintenanceWindows: [{ * day: "MONDAY", * startTime: { * hours: 1, * minutes: 0, * seconds: 0, * nanos: 0, * }, * }], * }, * deletionProtectionEnabled: true, * }, { * dependsOn: [primaryClusterRegionScp], * }); * const secondaryClusterConsumerSubnet = new gcp.compute.Subnetwork("secondary_cluster_consumer_subnet", { * name: "mysubnet-secondary-cluster", * ipCidrRange: "10.0.2.0/29", * region: "europe-west1", * network: consumerNet.id, * }); * const secondaryClusterRegionScp = new gcp.networkconnectivity.ServiceConnectionPolicy("secondary_cluster_region_scp", { * name: "mypolicy-secondary-cluster", * location: "europe-west1", * serviceClass: "gcp-memorystore-redis", * description: "Secondary cluster service connection policy", * network: consumerNet.id, * pscConfig: { * subnetworks: [secondaryClusterConsumerSubnet.id], * }, * }); * // Secondary cluster * const secondaryCluster = new gcp.redis.Cluster("secondary_cluster", { * name: "my-secondary-cluster", * region: "europe-west1", * pscConfigs: [{ * network: consumerNet.id, * }], * authorizationMode: "AUTH_MODE_DISABLED", * transitEncryptionMode: "TRANSIT_ENCRYPTION_MODE_DISABLED", * shardCount: 3, * redisConfigs: { * "maxmemory-policy": "volatile-ttl", * }, * nodeType: "REDIS_HIGHMEM_MEDIUM", * persistenceConfig: { * mode: "RDB", * rdbConfig: { * rdbSnapshotPeriod: "ONE_HOUR", * rdbSnapshotStartTime: "2024-10-02T15:01:23Z", * }, * }, * zoneDistributionConfig: { * mode: "MULTI_ZONE", * }, * replicaCount: 2, * maintenancePolicy: { * weeklyMaintenanceWindows: [{ * day: "WEDNESDAY", * startTime: { * hours: 1, * minutes: 0, * seconds: 0, * nanos: 0, * }, * }], * }, * deletionProtectionEnabled: true, * crossClusterReplicationConfig: { * clusterRole: "SECONDARY", * primaryCluster: { * cluster: primaryCluster.id, * }, * }, * }, { * dependsOn: [secondaryClusterRegionScp], * }); * ``` * ### Redis Cluster Rdb * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const consumerNet = new gcp.compute.Network("consumer_net", { * name: "my-network", * autoCreateSubnetworks: false, * }); * const consumerSubnet = new gcp.compute.Subnetwork("consumer_subnet", { * name: "my-subnet", * ipCidrRange: "10.0.0.248/29", * region: "us-central1", * network: consumerNet.id, * }); * const _default = new gcp.networkconnectivity.ServiceConnectionPolicy("default", { * name: "my-policy", * location: "us-central1", * serviceClass: "gcp-memorystore-redis", * description: "my basic service connection policy", * network: consumerNet.id, * pscConfig: { * subnetworks: [consumerSubnet.id], * }, * }); * const cluster_rdb = new gcp.redis.Cluster("cluster-rdb", { * name: "rdb-cluster", * shardCount: 3, * pscConfigs: [{ * network: consumerNet.id, * }], * region: "us-central1", * replicaCount: 0, * nodeType: "REDIS_SHARED_CORE_NANO", * transitEncryptionMode: "TRANSIT_ENCRYPTION_MODE_DISABLED", * authorizationMode: "AUTH_MODE_DISABLED", * redisConfigs: { * "maxmemory-policy": "volatile-ttl", * }, * deletionProtectionEnabled: true, * zoneDistributionConfig: { * mode: "MULTI_ZONE", * }, * maintenancePolicy: { * weeklyMaintenanceWindows: [{ * day: "MONDAY", * startTime: { * hours: 1, * minutes: 0, * seconds: 0, * nanos: 0, * }, * }], * }, * persistenceConfig: { * mode: "RDB", * rdbConfig: { * rdbSnapshotPeriod: "ONE_HOUR", * rdbSnapshotStartTime: "2024-10-02T15:01:23Z", * }, * }, * }, { * dependsOn: [_default], * }); * ``` * ### Redis Cluster Aof * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const consumerNet = new gcp.compute.Network("consumer_net", { * name: "my-network", * autoCreateSubnetworks: false, * }); * const consumerSubnet = new gcp.compute.Subnetwork("consumer_subnet", { * name: "my-subnet", * ipCidrRange: "10.0.0.248/29", * region: "us-central1", * network: consumerNet.id, * }); * const _default = new gcp.networkconnectivity.ServiceConnectionPolicy("default", { * name: "my-policy", * location: "us-central1", * serviceClass: "gcp-memorystore-redis", * description: "my basic service connection policy", * network: consumerNet.id, * pscConfig: { * subnetworks: [consumerSubnet.id], * }, * }); * const cluster_aof = new gcp.redis.Cluster("cluster-aof", { * name: "aof-cluster", * shardCount: 3, * pscConfigs: [{ * network: consumerNet.id, * }], * region: "us-central1", * replicaCount: 0, * nodeType: "REDIS_SHARED_CORE_NANO", * transitEncryptionMode: "TRANSIT_ENCRYPTION_MODE_DISABLED", * authorizationMode: "AUTH_MODE_DISABLED", * redisConfigs: { * "maxmemory-policy": "volatile-ttl", * }, * deletionProtectionEnabled: true, * zoneDistributionConfig: { * mode: "MULTI_ZONE", * }, * maintenancePolicy: { * weeklyMaintenanceWindows: [{ * day: "MONDAY", * startTime: { * hours: 1, * minutes: 0, * seconds: 0, * nanos: 0, * }, * }], * }, * persistenceConfig: { * mode: "AOF", * aofConfig: { * appendFsync: "EVERYSEC", * }, * }, * }, { * dependsOn: [_default], * }); * ``` * ### Redis Cluster Cmek * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const consumerNet = new gcp.compute.Network("consumer_net", { * name: "my-network", * autoCreateSubnetworks: false, * }); * const consumerSubnet = new gcp.compute.Subnetwork("consumer_subnet", { * name: "my-subnet", * ipCidrRange: "10.0.0.248/29", * region: "us-central1", * network: consumerNet.id, * }); * const _default = new gcp.networkconnectivity.ServiceConnectionPolicy("default", { * name: "my-policy", * location: "us-central1", * serviceClass: "gcp-memorystore-redis", * description: "my basic service connection policy", * network: consumerNet.id, * pscConfig: { * subnetworks: [consumerSubnet.id], * }, * }); * const cluster_cmek = new gcp.redis.Cluster("cluster-cmek", { * name: "cmek-cluster", * shardCount: 3, * pscConfigs: [{ * network: consumerNet.id, * }], * kmsKey: "my-key", * region: "us-central1", * deletionProtectionEnabled: true, * }, { * dependsOn: [_default], * }); * const project = gcp.organizations.getProject({}); * ``` * * ## Import * * Cluster can be imported using any of these accepted formats: * * * `projects/{{project}}/locations/{{region}}/clusters/{{name}}` * * * `{{project}}/{{region}}/{{name}}` * * * `{{region}}/{{name}}` * * * `{{name}}` * * When using the `pulumi import` command, Cluster can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:redis/cluster:Cluster default projects/{{project}}/locations/{{region}}/clusters/{{name}} * ``` * * ```sh * $ pulumi import gcp:redis/cluster:Cluster default {{project}}/{{region}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:redis/cluster:Cluster default {{region}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:redis/cluster:Cluster default {{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, 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["authorizationMode"] = state ? state.authorizationMode : undefined; resourceInputs["automatedBackupConfig"] = state ? state.automatedBackupConfig : undefined; resourceInputs["createTime"] = state ? state.createTime : undefined; resourceInputs["crossClusterReplicationConfig"] = state ? state.crossClusterReplicationConfig : undefined; resourceInputs["deletionProtectionEnabled"] = state ? state.deletionProtectionEnabled : undefined; resourceInputs["discoveryEndpoints"] = state ? state.discoveryEndpoints : undefined; resourceInputs["kmsKey"] = state ? state.kmsKey : undefined; resourceInputs["maintenancePolicy"] = state ? state.maintenancePolicy : undefined; resourceInputs["maintenanceSchedules"] = state ? state.maintenanceSchedules : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["nodeType"] = state ? state.nodeType : undefined; resourceInputs["persistenceConfig"] = state ? state.persistenceConfig : undefined; resourceInputs["preciseSizeGb"] = state ? state.preciseSizeGb : undefined; resourceInputs["project"] = state ? state.project : undefined; resourceInputs["pscConfigs"] = state ? state.pscConfigs : undefined; resourceInputs["pscConnections"] = state ? state.pscConnections : undefined; resourceInputs["pscServiceAttachments"] = state ? state.pscServiceAttachments : undefined; resourceInputs["redisConfigs"] = state ? state.redisConfigs : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["replicaCount"] = state ? state.replicaCount : undefined; resourceInputs["shardCount"] = state ? state.shardCount : undefined; resourceInputs["sizeGb"] = state ? state.sizeGb : undefined; resourceInputs["state"] = state ? state.state : undefined; resourceInputs["stateInfos"] = state ? state.stateInfos : undefined; resourceInputs["transitEncryptionMode"] = state ? state.transitEncryptionMode : undefined; resourceInputs["uid"] = state ? state.uid : undefined; resourceInputs["zoneDistributionConfig"] = state ? state.zoneDistributionConfig : undefined; } else { const args = argsOrState; if ((!args || args.shardCount === undefined) && !opts.urn) { throw new Error("Missing required property 'shardCount'"); } resourceInputs["authorizationMode"] = args ? args.authorizationMode : undefined; resourceInputs["automatedBackupConfig"] = args ? args.automatedBackupConfig : undefined; resourceInputs["crossClusterReplicationConfig"] = args ? args.crossClusterReplicationConfig : undefined; resourceInputs["deletionProtectionEnabled"] = args ? args.deletionProtectionEnabled : undefined; resourceInputs["kmsKey"] = args ? args.kmsKey : undefined; resourceInputs["maintenancePolicy"] = args ? args.maintenancePolicy : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["nodeType"] = args ? args.nodeType : undefined; resourceInputs["persistenceConfig"] = args ? args.persistenceConfig : undefined; resourceInputs["project"] = args ? args.project : undefined; resourceInputs["pscConfigs"] = args ? args.pscConfigs : undefined; resourceInputs["redisConfigs"] = args ? args.redisConfigs : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["replicaCount"] = args ? args.replicaCount : undefined; resourceInputs["shardCount"] = args ? args.shardCount : undefined; resourceInputs["transitEncryptionMode"] = args ? args.transitEncryptionMode : undefined; resourceInputs["zoneDistributionConfig"] = args ? args.zoneDistributionConfig : undefined; resourceInputs["createTime"] = undefined /*out*/; resourceInputs["discoveryEndpoints"] = undefined /*out*/; resourceInputs["maintenanceSchedules"] = undefined /*out*/; resourceInputs["preciseSizeGb"] = undefined /*out*/; resourceInputs["pscConnections"] = undefined /*out*/; resourceInputs["pscServiceAttachments"] = undefined /*out*/; resourceInputs["sizeGb"] = undefined /*out*/; resourceInputs["state"] = undefined /*out*/; resourceInputs["stateInfos"] = undefined /*out*/; resourceInputs["uid"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Cluster.__pulumiType, name, resourceInputs, opts); } } exports.Cluster = Cluster; /** @internal */ Cluster.__pulumiType = 'gcp:redis/cluster:Cluster'; //# sourceMappingURL=cluster.js.map