UNPKG

@pulumi/gcp

Version:

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

373 lines • 16.2 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.Instance = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * A Google Cloud Redis instance. * * To get more information about Instance, see: * * * [API documentation](https://cloud.google.com/memorystore/docs/redis/reference/rest/v1/projects.locations.instances) * * How-to Guides * * [Official Documentation](https://cloud.google.com/memorystore/docs/redis/) * * ## Example Usage * * ### Redis Instance Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const cache = new gcp.redis.Instance("cache", { * name: "memory-cache", * memorySizeGb: 1, * deletionProtection: false, * }); * ``` * ### Redis Instance Full * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * // This example assumes this network already exists. * // The API creates a tenant network per network authorized for a * // Redis instance and that network is not deleted when the user-created * // network (authorized_network) is deleted, so this prevents issues * // with tenant network quota. * // If this network hasn't been created and you are using this example in your * // config, add an additional network resource or change * // this from "data"to "resource" * const redis_network = gcp.compute.getNetwork({ * name: "redis-test-network", * }); * const cache = new gcp.redis.Instance("cache", { * name: "ha-memory-cache", * tier: "STANDARD_HA", * memorySizeGb: 1, * locationId: "us-central1-a", * alternativeLocationId: "us-central1-f", * authorizedNetwork: redis_network.then(redis_network => redis_network.id), * redisVersion: "REDIS_7_2", * displayName: "Test Instance", * reservedIpRange: "192.168.0.0/29", * labels: { * my_key: "my_val", * other_key: "other_val", * }, * maintenancePolicy: { * weeklyMaintenanceWindows: [{ * day: "TUESDAY", * startTime: { * hours: 0, * minutes: 30, * seconds: 0, * nanos: 0, * }, * }], * }, * }); * ``` * ### Redis Instance Full With Persistence Config * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const cache_persis = new gcp.redis.Instance("cache-persis", { * name: "ha-memory-cache-persis", * tier: "STANDARD_HA", * memorySizeGb: 1, * locationId: "us-central1-a", * alternativeLocationId: "us-central1-f", * persistenceConfig: { * persistenceMode: "RDB", * rdbSnapshotPeriod: "TWELVE_HOURS", * }, * }); * ``` * ### Redis Instance Private Service * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * // This example assumes this network already exists. * // The API creates a tenant network per network authorized for a * // Redis instance and that network is not deleted when the user-created * // network (authorized_network) is deleted, so this prevents issues * // with tenant network quota. * // If this network hasn't been created and you are using this example in your * // config, add an additional network resource or change * // this from "data"to "resource" * const redis_network = new gcp.compute.Network("redis-network", {name: "redis-test-network"}); * const serviceRange = new gcp.compute.GlobalAddress("service_range", { * name: "address", * purpose: "VPC_PEERING", * addressType: "INTERNAL", * prefixLength: 16, * network: redis_network.id, * }); * const privateServiceConnection = new gcp.servicenetworking.Connection("private_service_connection", { * network: redis_network.id, * service: "servicenetworking.googleapis.com", * reservedPeeringRanges: [serviceRange.name], * }); * const cache = new gcp.redis.Instance("cache", { * name: "private-cache", * tier: "STANDARD_HA", * memorySizeGb: 1, * locationId: "us-central1-a", * alternativeLocationId: "us-central1-f", * authorizedNetwork: redis_network.id, * connectMode: "PRIVATE_SERVICE_ACCESS", * redisVersion: "REDIS_7_2", * displayName: "Test Instance", * }, { * dependsOn: [privateServiceConnection], * }); * ``` * ### Redis Instance Mrr * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * // This example assumes this network already exists. * // The API creates a tenant network per network authorized for a * // Redis instance and that network is not deleted when the user-created * // network (authorized_network) is deleted, so this prevents issues * // with tenant network quota. * // If this network hasn't been created and you are using this example in your * // config, add an additional network resource or change * // this from "data"to "resource" * const redis_network = gcp.compute.getNetwork({ * name: "redis-test-network", * }); * const cache = new gcp.redis.Instance("cache", { * name: "mrr-memory-cache", * tier: "STANDARD_HA", * memorySizeGb: 5, * locationId: "us-central1-a", * alternativeLocationId: "us-central1-f", * authorizedNetwork: redis_network.then(redis_network => redis_network.id), * redisVersion: "REDIS_7_2", * displayName: "Test Instance", * replicaCount: 5, * readReplicasMode: "READ_REPLICAS_ENABLED", * labels: { * my_key: "my_val", * other_key: "other_val", * }, * }); * ``` * ### Redis Instance Cmek * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const redisKeyring = new gcp.kms.KeyRing("redis_keyring", { * name: "redis-keyring", * location: "us-central1", * }); * const redisKey = new gcp.kms.CryptoKey("redis_key", { * name: "redis-key", * keyRing: redisKeyring.id, * }); * // This example assumes this network already exists. * // The API creates a tenant network per network authorized for a * // Redis instance and that network is not deleted when the user-created * // network (authorized_network) is deleted, so this prevents issues * // with tenant network quota. * // If this network hasn't been created and you are using this example in your * // config, add an additional network resource or change * // this from "data"to "resource" * const redis_network = gcp.compute.getNetwork({ * name: "redis-test-network", * }); * const cache = new gcp.redis.Instance("cache", { * name: "cmek-memory-cache", * tier: "STANDARD_HA", * memorySizeGb: 1, * locationId: "us-central1-a", * alternativeLocationId: "us-central1-f", * authorizedNetwork: redis_network.then(redis_network => redis_network.id), * redisVersion: "REDIS_7_2", * displayName: "Test Instance", * labels: { * my_key: "my_val", * other_key: "other_val", * }, * customerManagedKey: redisKey.id, * }); * ``` * * ## Import * * Instance can be imported using any of these accepted formats: * * * `projects/{{project}}/locations/{{region}}/instances/{{name}}` * * `{{project}}/{{region}}/{{name}}` * * `{{region}}/{{name}}` * * `{{name}}` * * When using the `pulumi import` command, Instance can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:redis/instance:Instance default projects/{{project}}/locations/{{region}}/instances/{{name}} * $ pulumi import gcp:redis/instance:Instance default {{project}}/{{region}}/{{name}} * $ pulumi import gcp:redis/instance:Instance default {{region}}/{{name}} * $ pulumi import gcp:redis/instance:Instance default {{name}} * ``` */ class Instance extends pulumi.CustomResource { /** * Get an existing Instance 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 Instance(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'gcp:redis/instance:Instance'; /** * Returns true if the given object is an instance of Instance. 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'] === Instance.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["alternativeLocationId"] = state?.alternativeLocationId; resourceInputs["authEnabled"] = state?.authEnabled; resourceInputs["authString"] = state?.authString; resourceInputs["authorizedNetwork"] = state?.authorizedNetwork; resourceInputs["connectMode"] = state?.connectMode; resourceInputs["createTime"] = state?.createTime; resourceInputs["currentLocationId"] = state?.currentLocationId; resourceInputs["customerManagedKey"] = state?.customerManagedKey; resourceInputs["deletionPolicy"] = state?.deletionPolicy; resourceInputs["deletionProtection"] = state?.deletionProtection; resourceInputs["displayName"] = state?.displayName; resourceInputs["effectiveLabels"] = state?.effectiveLabels; resourceInputs["effectiveReservedIpRange"] = state?.effectiveReservedIpRange; resourceInputs["host"] = state?.host; resourceInputs["labels"] = state?.labels; resourceInputs["locationId"] = state?.locationId; resourceInputs["maintenancePolicy"] = state?.maintenancePolicy; resourceInputs["maintenanceSchedules"] = state?.maintenanceSchedules; resourceInputs["maintenanceVersion"] = state?.maintenanceVersion; resourceInputs["memorySizeGb"] = state?.memorySizeGb; resourceInputs["name"] = state?.name; resourceInputs["nodes"] = state?.nodes; resourceInputs["persistenceConfig"] = state?.persistenceConfig; resourceInputs["persistenceIamIdentity"] = state?.persistenceIamIdentity; resourceInputs["port"] = state?.port; resourceInputs["project"] = state?.project; resourceInputs["pulumiLabels"] = state?.pulumiLabels; resourceInputs["readEndpoint"] = state?.readEndpoint; resourceInputs["readEndpointPort"] = state?.readEndpointPort; resourceInputs["readReplicasMode"] = state?.readReplicasMode; resourceInputs["redisConfigs"] = state?.redisConfigs; resourceInputs["redisVersion"] = state?.redisVersion; resourceInputs["region"] = state?.region; resourceInputs["replicaCount"] = state?.replicaCount; resourceInputs["reservedIpRange"] = state?.reservedIpRange; resourceInputs["secondaryIpRange"] = state?.secondaryIpRange; resourceInputs["serverCaCerts"] = state?.serverCaCerts; resourceInputs["tier"] = state?.tier; resourceInputs["transitEncryptionMode"] = state?.transitEncryptionMode; } else { const args = argsOrState; if (args?.memorySizeGb === undefined && !opts.urn) { throw new Error("Missing required property 'memorySizeGb'"); } resourceInputs["alternativeLocationId"] = args?.alternativeLocationId; resourceInputs["authEnabled"] = args?.authEnabled; resourceInputs["authorizedNetwork"] = args?.authorizedNetwork; resourceInputs["connectMode"] = args?.connectMode; resourceInputs["customerManagedKey"] = args?.customerManagedKey; resourceInputs["deletionPolicy"] = args?.deletionPolicy; resourceInputs["deletionProtection"] = args?.deletionProtection; resourceInputs["displayName"] = args?.displayName; resourceInputs["labels"] = args?.labels; resourceInputs["locationId"] = args?.locationId; resourceInputs["maintenancePolicy"] = args?.maintenancePolicy; resourceInputs["maintenanceVersion"] = args?.maintenanceVersion; resourceInputs["memorySizeGb"] = args?.memorySizeGb; resourceInputs["name"] = args?.name; resourceInputs["persistenceConfig"] = args?.persistenceConfig; resourceInputs["project"] = args?.project; resourceInputs["readReplicasMode"] = args?.readReplicasMode; resourceInputs["redisConfigs"] = args?.redisConfigs; resourceInputs["redisVersion"] = args?.redisVersion; resourceInputs["region"] = args?.region; resourceInputs["replicaCount"] = args?.replicaCount; resourceInputs["reservedIpRange"] = args?.reservedIpRange; resourceInputs["secondaryIpRange"] = args?.secondaryIpRange; resourceInputs["tier"] = args?.tier; resourceInputs["transitEncryptionMode"] = args?.transitEncryptionMode; resourceInputs["authString"] = undefined /*out*/; resourceInputs["createTime"] = undefined /*out*/; resourceInputs["currentLocationId"] = undefined /*out*/; resourceInputs["effectiveLabels"] = undefined /*out*/; resourceInputs["effectiveReservedIpRange"] = undefined /*out*/; resourceInputs["host"] = undefined /*out*/; resourceInputs["maintenanceSchedules"] = undefined /*out*/; resourceInputs["nodes"] = undefined /*out*/; resourceInputs["persistenceIamIdentity"] = undefined /*out*/; resourceInputs["port"] = undefined /*out*/; resourceInputs["pulumiLabels"] = undefined /*out*/; resourceInputs["readEndpoint"] = undefined /*out*/; resourceInputs["readEndpointPort"] = undefined /*out*/; resourceInputs["serverCaCerts"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["authString", "effectiveLabels", "pulumiLabels"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(Instance.__pulumiType, name, resourceInputs, opts); } } exports.Instance = Instance; //# sourceMappingURL=instance.js.map