@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
148 lines • 6.83 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.GlobalCluster = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages an DocumentDB Global Cluster. A global cluster consists of one primary region and up to five read-only secondary regions. You issue write operations directly to the primary cluster in the primary region and Amazon DocumentDB automatically replicates the data to the secondary regions using dedicated infrastructure.
*
* More information about DocumentDB Global Clusters can be found in the [DocumentDB Developer Guide](https://docs.aws.amazon.com/documentdb/latest/developerguide/global-clusters.html).
*
* ## Example Usage
*
* ### New DocumentDB Global Cluster
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.docdb.GlobalCluster("example", {
* globalClusterIdentifier: "global-test",
* engine: "docdb",
* engineVersion: "4.0.0",
* });
* const primary = new aws.docdb.Cluster("primary", {
* engine: example.engine,
* engineVersion: example.engineVersion,
* clusterIdentifier: "test-primary-cluster",
* masterUsername: "username",
* masterPassword: "somepass123",
* globalClusterIdentifier: example.id,
* dbSubnetGroupName: "default",
* });
* const primaryClusterInstance = new aws.docdb.ClusterInstance("primary", {
* engine: example.engine,
* identifier: "test-primary-cluster-instance",
* clusterIdentifier: primary.id,
* instanceClass: "db.r5.large",
* });
* const secondary = new aws.docdb.Cluster("secondary", {
* engine: example.engine,
* engineVersion: example.engineVersion,
* clusterIdentifier: "test-secondary-cluster",
* globalClusterIdentifier: example.id,
* dbSubnetGroupName: "default",
* }, {
* dependsOn: [primary],
* });
* const secondaryClusterInstance = new aws.docdb.ClusterInstance("secondary", {
* engine: example.engine,
* identifier: "test-secondary-cluster-instance",
* clusterIdentifier: secondary.id,
* instanceClass: "db.r5.large",
* }, {
* dependsOn: [primaryClusterInstance],
* });
* ```
*
* ### New Global Cluster From Existing DB Cluster
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.docdb.Cluster("example", {});
* const exampleGlobalCluster = new aws.docdb.GlobalCluster("example", {
* globalClusterIdentifier: "example",
* sourceDbClusterIdentifier: example.arn,
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import `aws_docdb_global_cluster` using the Global Cluster identifier. For example:
*
* ```sh
* $ pulumi import aws:docdb/globalCluster:GlobalCluster example example
* ```
* Certain resource arguments, like `source_db_cluster_identifier`, do not have an API method for reading the information after creation. If the argument is set in the Pulumi program on an imported resource, Pulumi will always show a difference. To workaround this behavior, either omit the argument from the Pulumi program or use `ignore_changes` to hide the difference. For example:
*/
class GlobalCluster extends pulumi.CustomResource {
/**
* Get an existing GlobalCluster 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 GlobalCluster(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of GlobalCluster. 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'] === GlobalCluster.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["arn"] = state?.arn;
resourceInputs["databaseName"] = state?.databaseName;
resourceInputs["deletionProtection"] = state?.deletionProtection;
resourceInputs["engine"] = state?.engine;
resourceInputs["engineVersion"] = state?.engineVersion;
resourceInputs["globalClusterIdentifier"] = state?.globalClusterIdentifier;
resourceInputs["globalClusterMembers"] = state?.globalClusterMembers;
resourceInputs["globalClusterResourceId"] = state?.globalClusterResourceId;
resourceInputs["region"] = state?.region;
resourceInputs["sourceDbClusterIdentifier"] = state?.sourceDbClusterIdentifier;
resourceInputs["status"] = state?.status;
resourceInputs["storageEncrypted"] = state?.storageEncrypted;
}
else {
const args = argsOrState;
if (args?.globalClusterIdentifier === undefined && !opts.urn) {
throw new Error("Missing required property 'globalClusterIdentifier'");
}
resourceInputs["databaseName"] = args?.databaseName;
resourceInputs["deletionProtection"] = args?.deletionProtection;
resourceInputs["engine"] = args?.engine;
resourceInputs["engineVersion"] = args?.engineVersion;
resourceInputs["globalClusterIdentifier"] = args?.globalClusterIdentifier;
resourceInputs["region"] = args?.region;
resourceInputs["sourceDbClusterIdentifier"] = args?.sourceDbClusterIdentifier;
resourceInputs["storageEncrypted"] = args?.storageEncrypted;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["globalClusterMembers"] = undefined /*out*/;
resourceInputs["globalClusterResourceId"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(GlobalCluster.__pulumiType, name, resourceInputs, opts);
}
}
exports.GlobalCluster = GlobalCluster;
/** @internal */
GlobalCluster.__pulumiType = 'aws:docdb/globalCluster:GlobalCluster';
//# sourceMappingURL=globalCluster.js.map