UNPKG

@pulumi/gcp

Version:

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

359 lines • 15.2 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 * * ### Alloydb Cluster Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const defaultNetwork = new gcp.compute.Network("default", {name: "alloydb-cluster"}); * const _default = new gcp.alloydb.Cluster("default", { * clusterId: "alloydb-cluster", * location: "us-central1", * networkConfig: { * network: defaultNetwork.id, * }, * }); * const project = gcp.organizations.getProject({}); * ``` * ### Alloydb Cluster Before Upgrade * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const defaultNetwork = new gcp.compute.Network("default", {name: "alloydb-network"}); * const defaultCluster = new gcp.alloydb.Cluster("default", { * clusterId: "alloydb-cluster", * location: "us-central1", * networkConfig: { * network: defaultNetwork.id, * }, * databaseVersion: "POSTGRES_14", * initialUser: { * password: "alloydb-cluster", * }, * }); * const privateIpAlloc = new gcp.compute.GlobalAddress("private_ip_alloc", { * name: "alloydb-cluster", * addressType: "INTERNAL", * purpose: "VPC_PEERING", * prefixLength: 16, * network: defaultNetwork.id, * }); * const vpcConnection = new gcp.servicenetworking.Connection("vpc_connection", { * network: defaultNetwork.id, * service: "servicenetworking.googleapis.com", * reservedPeeringRanges: [privateIpAlloc.name], * }); * const _default = new gcp.alloydb.Instance("default", { * cluster: defaultCluster.name, * instanceId: "alloydb-instance", * instanceType: "PRIMARY", * machineConfig: { * cpuCount: 2, * }, * }, { * dependsOn: [vpcConnection], * }); * const project = gcp.organizations.getProject({}); * ``` * ### Alloydb Cluster After Upgrade * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const defaultNetwork = new gcp.compute.Network("default", {name: "alloydb-network"}); * const defaultCluster = new gcp.alloydb.Cluster("default", { * clusterId: "alloydb-cluster", * location: "us-central1", * networkConfig: { * network: defaultNetwork.id, * }, * databaseVersion: "POSTGRES_15", * initialUser: { * password: "alloydb-cluster", * }, * }); * const privateIpAlloc = new gcp.compute.GlobalAddress("private_ip_alloc", { * name: "alloydb-cluster", * addressType: "INTERNAL", * purpose: "VPC_PEERING", * prefixLength: 16, * network: defaultNetwork.id, * }); * const vpcConnection = new gcp.servicenetworking.Connection("vpc_connection", { * network: defaultNetwork.id, * service: "servicenetworking.googleapis.com", * reservedPeeringRanges: [privateIpAlloc.name], * }); * const _default = new gcp.alloydb.Instance("default", { * cluster: defaultCluster.name, * instanceId: "alloydb-instance", * instanceType: "PRIMARY", * machineConfig: { * cpuCount: 2, * }, * }, { * dependsOn: [vpcConnection], * }); * const project = gcp.organizations.getProject({}); * ``` * ### Alloydb Cluster Full * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const _default = new gcp.compute.Network("default", {name: "alloydb-cluster-full"}); * const full = new gcp.alloydb.Cluster("full", { * clusterId: "alloydb-cluster-full", * location: "us-central1", * networkConfig: { * network: _default.id, * }, * databaseVersion: "POSTGRES_15", * initialUser: { * user: "alloydb-cluster-full", * password: "alloydb-cluster-full", * }, * continuousBackupConfig: { * enabled: true, * recoveryWindowDays: 14, * }, * automatedBackupPolicy: { * location: "us-central1", * backupWindow: "1800s", * enabled: true, * weeklySchedule: { * daysOfWeeks: ["MONDAY"], * startTimes: [{ * hours: 23, * minutes: 0, * seconds: 0, * nanos: 0, * }], * }, * quantityBasedRetention: { * count: 1, * }, * labels: { * test: "alloydb-cluster-full", * }, * }, * labels: { * test: "alloydb-cluster-full", * }, * }); * const project = gcp.organizations.getProject({}); * ``` * ### Alloydb Secondary Cluster Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const _default = new gcp.compute.Network("default", {name: "alloydb-secondary-cluster"}); * const primary = new gcp.alloydb.Cluster("primary", { * clusterId: "alloydb-primary-cluster", * location: "us-central1", * networkConfig: { * network: _default.id, * }, * }); * const privateIpAlloc = new gcp.compute.GlobalAddress("private_ip_alloc", { * name: "alloydb-secondary-cluster", * addressType: "INTERNAL", * purpose: "VPC_PEERING", * prefixLength: 16, * network: _default.id, * }); * const vpcConnection = new gcp.servicenetworking.Connection("vpc_connection", { * network: _default.id, * service: "servicenetworking.googleapis.com", * reservedPeeringRanges: [privateIpAlloc.name], * }); * const primaryInstance = new gcp.alloydb.Instance("primary", { * cluster: primary.name, * instanceId: "alloydb-primary-instance", * instanceType: "PRIMARY", * machineConfig: { * cpuCount: 2, * }, * }, { * dependsOn: [vpcConnection], * }); * const secondary = new gcp.alloydb.Cluster("secondary", { * clusterId: "alloydb-secondary-cluster", * location: "us-east1", * networkConfig: { * network: _default.id, * }, * clusterType: "SECONDARY", * continuousBackupConfig: { * enabled: false, * }, * secondaryConfig: { * primaryClusterName: primary.name, * }, * }, { * dependsOn: [primaryInstance], * }); * const project = gcp.organizations.getProject({}); * ``` * * ## Import * * Cluster can be imported using any of these accepted formats: * * * `projects/{{project}}/locations/{{location}}/clusters/{{cluster_id}}` * * * `{{project}}/{{location}}/{{cluster_id}}` * * * `{{location}}/{{cluster_id}}` * * * `{{cluster_id}}` * * When using the `pulumi import` command, Cluster can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:alloydb/cluster:Cluster default projects/{{project}}/locations/{{location}}/clusters/{{cluster_id}} * ``` * * ```sh * $ pulumi import gcp:alloydb/cluster:Cluster default {{project}}/{{location}}/{{cluster_id}} * ``` * * ```sh * $ pulumi import gcp:alloydb/cluster:Cluster default {{location}}/{{cluster_id}} * ``` * * ```sh * $ pulumi import gcp:alloydb/cluster:Cluster default {{cluster_id}} * ``` */ 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["annotations"] = state ? state.annotations : undefined; resourceInputs["automatedBackupPolicy"] = state ? state.automatedBackupPolicy : undefined; resourceInputs["backupSources"] = state ? state.backupSources : undefined; resourceInputs["clusterId"] = state ? state.clusterId : undefined; resourceInputs["clusterType"] = state ? state.clusterType : undefined; resourceInputs["continuousBackupConfig"] = state ? state.continuousBackupConfig : undefined; resourceInputs["continuousBackupInfos"] = state ? state.continuousBackupInfos : undefined; resourceInputs["databaseVersion"] = state ? state.databaseVersion : undefined; resourceInputs["deletionPolicy"] = state ? state.deletionPolicy : undefined; resourceInputs["displayName"] = state ? state.displayName : undefined; resourceInputs["effectiveAnnotations"] = state ? state.effectiveAnnotations : undefined; resourceInputs["effectiveLabels"] = state ? state.effectiveLabels : undefined; resourceInputs["encryptionConfig"] = state ? state.encryptionConfig : undefined; resourceInputs["encryptionInfos"] = state ? state.encryptionInfos : undefined; resourceInputs["etag"] = state ? state.etag : undefined; resourceInputs["initialUser"] = state ? state.initialUser : undefined; resourceInputs["labels"] = state ? state.labels : undefined; resourceInputs["location"] = state ? state.location : undefined; resourceInputs["maintenanceUpdatePolicy"] = state ? state.maintenanceUpdatePolicy : undefined; resourceInputs["migrationSources"] = state ? state.migrationSources : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["networkConfig"] = state ? state.networkConfig : undefined; resourceInputs["project"] = state ? state.project : undefined; resourceInputs["pscConfig"] = state ? state.pscConfig : undefined; resourceInputs["pulumiLabels"] = state ? state.pulumiLabels : undefined; resourceInputs["reconciling"] = state ? state.reconciling : undefined; resourceInputs["restoreBackupSource"] = state ? state.restoreBackupSource : undefined; resourceInputs["restoreContinuousBackupSource"] = state ? state.restoreContinuousBackupSource : undefined; resourceInputs["secondaryConfig"] = state ? state.secondaryConfig : undefined; resourceInputs["skipAwaitMajorVersionUpgrade"] = state ? state.skipAwaitMajorVersionUpgrade : undefined; resourceInputs["state"] = state ? state.state : undefined; resourceInputs["subscriptionType"] = state ? state.subscriptionType : undefined; resourceInputs["trialMetadatas"] = state ? state.trialMetadatas : undefined; resourceInputs["uid"] = state ? state.uid : undefined; } else { const args = argsOrState; if ((!args || args.clusterId === undefined) && !opts.urn) { throw new Error("Missing required property 'clusterId'"); } if ((!args || args.location === undefined) && !opts.urn) { throw new Error("Missing required property 'location'"); } resourceInputs["annotations"] = args ? args.annotations : undefined; resourceInputs["automatedBackupPolicy"] = args ? args.automatedBackupPolicy : undefined; resourceInputs["clusterId"] = args ? args.clusterId : undefined; resourceInputs["clusterType"] = args ? args.clusterType : undefined; resourceInputs["continuousBackupConfig"] = args ? args.continuousBackupConfig : undefined; resourceInputs["databaseVersion"] = args ? args.databaseVersion : undefined; resourceInputs["deletionPolicy"] = args ? args.deletionPolicy : undefined; resourceInputs["displayName"] = args ? args.displayName : undefined; resourceInputs["encryptionConfig"] = args ? args.encryptionConfig : undefined; resourceInputs["etag"] = args ? args.etag : undefined; resourceInputs["initialUser"] = args ? args.initialUser : undefined; resourceInputs["labels"] = args ? args.labels : undefined; resourceInputs["location"] = args ? args.location : undefined; resourceInputs["maintenanceUpdatePolicy"] = args ? args.maintenanceUpdatePolicy : undefined; resourceInputs["networkConfig"] = args ? args.networkConfig : undefined; resourceInputs["project"] = args ? args.project : undefined; resourceInputs["pscConfig"] = args ? args.pscConfig : undefined; resourceInputs["restoreBackupSource"] = args ? args.restoreBackupSource : undefined; resourceInputs["restoreContinuousBackupSource"] = args ? args.restoreContinuousBackupSource : undefined; resourceInputs["secondaryConfig"] = args ? args.secondaryConfig : undefined; resourceInputs["skipAwaitMajorVersionUpgrade"] = args ? args.skipAwaitMajorVersionUpgrade : undefined; resourceInputs["subscriptionType"] = args ? args.subscriptionType : undefined; resourceInputs["backupSources"] = undefined /*out*/; resourceInputs["continuousBackupInfos"] = undefined /*out*/; resourceInputs["effectiveAnnotations"] = undefined /*out*/; resourceInputs["effectiveLabels"] = undefined /*out*/; resourceInputs["encryptionInfos"] = undefined /*out*/; resourceInputs["migrationSources"] = undefined /*out*/; resourceInputs["name"] = undefined /*out*/; resourceInputs["pulumiLabels"] = undefined /*out*/; resourceInputs["reconciling"] = undefined /*out*/; resourceInputs["state"] = undefined /*out*/; resourceInputs["trialMetadatas"] = undefined /*out*/; resourceInputs["uid"] = 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:alloydb/cluster:Cluster'; //# sourceMappingURL=cluster.js.map