@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
389 lines (388 loc) • 21.3 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "../types/input";
import * as outputs from "../types/output";
/**
* Manages an RDS Global Cluster, which is an Aurora global database spread across multiple regions. The global database contains a single primary cluster with read-write capability, and a read-only secondary cluster that receives data from the primary cluster through high-speed replication performed by the Aurora storage subsystem.
*
* More information about Aurora global databases can be found in the [Aurora User Guide](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-global-database.html#aurora-global-database-creating).
*
* ## Example Usage
*
* ### New MySQL Global Cluster
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.rds.GlobalCluster("example", {
* globalClusterIdentifier: "global-test",
* engine: "aurora",
* engineVersion: "5.6.mysql_aurora.1.22.2",
* databaseName: "example_db",
* });
* const primary = new aws.rds.Cluster("primary", {
* engine: example.engine,
* engineVersion: example.engineVersion,
* clusterIdentifier: "test-primary-cluster",
* masterUsername: "username",
* masterPassword: "somepass123",
* databaseName: "example_db",
* globalClusterIdentifier: example.id,
* dbSubnetGroupName: "default",
* });
* const primaryClusterInstance = new aws.rds.ClusterInstance("primary", {
* engine: example.engine.apply((x) => aws.rds.EngineType[x]),
* engineVersion: example.engineVersion,
* identifier: "test-primary-cluster-instance",
* clusterIdentifier: primary.id,
* instanceClass: aws.rds.InstanceType.R4_Large,
* dbSubnetGroupName: "default",
* });
* const secondary = new aws.rds.Cluster("secondary", {
* engine: example.engine,
* engineVersion: example.engineVersion,
* clusterIdentifier: "test-secondary-cluster",
* globalClusterIdentifier: example.id,
* dbSubnetGroupName: "default",
* }, {
* dependsOn: [primaryClusterInstance],
* });
* const secondaryClusterInstance = new aws.rds.ClusterInstance("secondary", {
* engine: example.engine.apply((x) => aws.rds.EngineType[x]),
* engineVersion: example.engineVersion,
* identifier: "test-secondary-cluster-instance",
* clusterIdentifier: secondary.id,
* instanceClass: aws.rds.InstanceType.R4_Large,
* dbSubnetGroupName: "default",
* });
* ```
*
* ### New PostgreSQL Global Cluster
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.rds.GlobalCluster("example", {
* globalClusterIdentifier: "global-test",
* engine: "aurora-postgresql",
* engineVersion: "11.9",
* databaseName: "example_db",
* });
* const primary = new aws.rds.Cluster("primary", {
* engine: example.engine,
* engineVersion: example.engineVersion,
* clusterIdentifier: "test-primary-cluster",
* masterUsername: "username",
* masterPassword: "somepass123",
* databaseName: "example_db",
* globalClusterIdentifier: example.id,
* dbSubnetGroupName: "default",
* });
* const primaryClusterInstance = new aws.rds.ClusterInstance("primary", {
* engine: example.engine.apply((x) => aws.rds.EngineType[x]),
* engineVersion: example.engineVersion,
* identifier: "test-primary-cluster-instance",
* clusterIdentifier: primary.id,
* instanceClass: aws.rds.InstanceType.R4_Large,
* dbSubnetGroupName: "default",
* });
* const secondary = new aws.rds.Cluster("secondary", {
* engine: example.engine,
* engineVersion: example.engineVersion,
* clusterIdentifier: "test-secondary-cluster",
* globalClusterIdentifier: example.id,
* skipFinalSnapshot: true,
* dbSubnetGroupName: "default",
* }, {
* dependsOn: [primaryClusterInstance],
* });
* const secondaryClusterInstance = new aws.rds.ClusterInstance("secondary", {
* engine: example.engine.apply((x) => aws.rds.EngineType[x]),
* engineVersion: example.engineVersion,
* identifier: "test-secondary-cluster-instance",
* clusterIdentifier: secondary.id,
* instanceClass: aws.rds.InstanceType.R4_Large,
* dbSubnetGroupName: "default",
* });
* ```
*
* ### New Global Cluster From Existing DB Cluster
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.rds.Cluster("example", {});
* const exampleGlobalCluster = new aws.rds.GlobalCluster("example", {
* forceDestroy: true,
* globalClusterIdentifier: "example",
* sourceDbClusterIdentifier: example.arn,
* });
* ```
*
* ### Upgrading Engine Versions
*
* When you upgrade the version of an `aws.rds.GlobalCluster`, the provider will attempt to in-place upgrade the engine versions of all associated clusters. Since the `aws.rds.Cluster` resource is being updated through the `aws.rds.GlobalCluster`, you are likely to get an error (`Provider produced inconsistent final plan`). To avoid this, use the `lifecycle` `ignoreChanges` meta argument as shown below on the `aws.rds.Cluster`.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.rds.GlobalCluster("example", {
* globalClusterIdentifier: "kyivkharkiv",
* engine: "aurora-mysql",
* engineVersion: "5.7.mysql_aurora.2.07.5",
* });
* const primary = new aws.rds.Cluster("primary", {
* allowMajorVersionUpgrade: true,
* applyImmediately: true,
* clusterIdentifier: "odessadnipro",
* databaseName: "totoro",
* engine: example.engine,
* engineVersion: example.engineVersion,
* globalClusterIdentifier: example.id,
* masterPassword: "satsukimae",
* masterUsername: "maesatsuki",
* skipFinalSnapshot: true,
* });
* const primaryClusterInstance = new aws.rds.ClusterInstance("primary", {
* applyImmediately: true,
* clusterIdentifier: primary.id,
* engine: primary.engine.apply((x) => aws.rds.EngineType[x]),
* engineVersion: primary.engineVersion,
* identifier: "donetsklviv",
* instanceClass: aws.rds.InstanceType.R4_Large,
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import `aws_rds_global_cluster` using the RDS Global Cluster identifier. For example:
*
* ```sh
* $ pulumi import aws:rds/globalCluster:GlobalCluster example example
* ```
* Certain resource arguments, like `force_destroy`, only exist within this provider. If the argument is set in the the provider configuration on an imported resource, This provider will show a difference on the first plan after import to update the state value. This change is safe to apply immediately so the state matches the desired configuration.
*
* 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:
*/
export declare 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: string, id: pulumi.Input<pulumi.ID>, state?: GlobalClusterState, opts?: pulumi.CustomResourceOptions): GlobalCluster;
/**
* 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: any): obj is GlobalCluster;
/**
* RDS Global Cluster Amazon Resource Name (ARN).
*/
readonly arn: pulumi.Output<string>;
/**
* Name for an automatically created database on cluster creation. Pulumi will only perform drift detection if a configuration value is provided.
*/
readonly databaseName: pulumi.Output<string>;
/**
* If the Global Cluster should have deletion protection enabled. The database can't be deleted when this value is set to `true`. The default is `false`.
*/
readonly deletionProtection: pulumi.Output<boolean | undefined>;
/**
* Writer endpoint for the new global database cluster. This endpoint always points to the writer DB instance in the current primary cluster.
*/
readonly endpoint: pulumi.Output<string>;
/**
* Name of the database engine to be used for this DB cluster. The provider will only perform drift detection if a configuration value is provided. Valid values: `aurora`, `aurora-mysql`, `aurora-postgresql`. Defaults to `aurora`. Conflicts with `sourceDbClusterIdentifier`.
*/
readonly engine: pulumi.Output<string>;
/**
* The life cycle type for this DB instance. This setting applies only to Aurora PostgreSQL-based global databases. Valid values are `open-source-rds-extended-support`, `open-source-rds-extended-support-disabled`. Default value is `open-source-rds-extended-support`. [Using Amazon RDS Extended Support]: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/extended-support.html
*/
readonly engineLifecycleSupport: pulumi.Output<string>;
/**
* Engine version of the Aurora global database. The `engine`, `engineVersion`, and `instanceClass` (on the `aws.rds.ClusterInstance`) must together support global databases. See [Using Amazon Aurora global databases](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-global-database.html) for more information. By upgrading the engine version, the provider will upgrade cluster members. **NOTE:** To avoid an `inconsistent final plan` error while upgrading, use the `lifecycle` `ignoreChanges` for `engineVersion` meta argument on the associated `aws.rds.Cluster` resource as shown above in Upgrading Engine Versions example.
*/
readonly engineVersion: pulumi.Output<string>;
readonly engineVersionActual: pulumi.Output<string>;
/**
* Enable to remove DB Cluster members from Global Cluster on destroy. Required with `sourceDbClusterIdentifier`.
*/
readonly forceDestroy: pulumi.Output<boolean | undefined>;
/**
* Global cluster identifier.
*/
readonly globalClusterIdentifier: pulumi.Output<string>;
/**
* Set of objects containing Global Cluster members.
*/
readonly globalClusterMembers: pulumi.Output<outputs.rds.GlobalClusterGlobalClusterMember[]>;
/**
* AWS Region-unique, immutable identifier for the global database cluster. This identifier is found in AWS CloudTrail log entries whenever the AWS KMS key for the DB cluster is accessed.
*/
readonly globalClusterResourceId: pulumi.Output<string>;
/**
* Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
*/
readonly region: pulumi.Output<string>;
/**
* Amazon Resource Name (ARN) to use as the primary DB Cluster of the Global Cluster on creation. The provider cannot perform drift detection of this value. **NOTE:** After initial creation, this argument can be removed and replaced with `engine` and `engineVersion`. This allows upgrading the engine version of the Global Cluster.
*/
readonly sourceDbClusterIdentifier: pulumi.Output<string>;
/**
* Specifies whether the DB cluster is encrypted. The default is `false` unless `sourceDbClusterIdentifier` is specified and encrypted. The provider will only perform drift detection if a configuration value is provided.
*/
readonly storageEncrypted: pulumi.Output<boolean>;
/**
* A map of tags to assign to the DB cluster. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
*/
readonly tags: pulumi.Output<{
[key: string]: string;
} | undefined>;
/**
* Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
*/
readonly tagsAll: pulumi.Output<{
[key: string]: string;
}>;
/**
* Create a GlobalCluster resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: GlobalClusterArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering GlobalCluster resources.
*/
export interface GlobalClusterState {
/**
* RDS Global Cluster Amazon Resource Name (ARN).
*/
arn?: pulumi.Input<string>;
/**
* Name for an automatically created database on cluster creation. Pulumi will only perform drift detection if a configuration value is provided.
*/
databaseName?: pulumi.Input<string>;
/**
* If the Global Cluster should have deletion protection enabled. The database can't be deleted when this value is set to `true`. The default is `false`.
*/
deletionProtection?: pulumi.Input<boolean>;
/**
* Writer endpoint for the new global database cluster. This endpoint always points to the writer DB instance in the current primary cluster.
*/
endpoint?: pulumi.Input<string>;
/**
* Name of the database engine to be used for this DB cluster. The provider will only perform drift detection if a configuration value is provided. Valid values: `aurora`, `aurora-mysql`, `aurora-postgresql`. Defaults to `aurora`. Conflicts with `sourceDbClusterIdentifier`.
*/
engine?: pulumi.Input<string>;
/**
* The life cycle type for this DB instance. This setting applies only to Aurora PostgreSQL-based global databases. Valid values are `open-source-rds-extended-support`, `open-source-rds-extended-support-disabled`. Default value is `open-source-rds-extended-support`. [Using Amazon RDS Extended Support]: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/extended-support.html
*/
engineLifecycleSupport?: pulumi.Input<string>;
/**
* Engine version of the Aurora global database. The `engine`, `engineVersion`, and `instanceClass` (on the `aws.rds.ClusterInstance`) must together support global databases. See [Using Amazon Aurora global databases](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-global-database.html) for more information. By upgrading the engine version, the provider will upgrade cluster members. **NOTE:** To avoid an `inconsistent final plan` error while upgrading, use the `lifecycle` `ignoreChanges` for `engineVersion` meta argument on the associated `aws.rds.Cluster` resource as shown above in Upgrading Engine Versions example.
*/
engineVersion?: pulumi.Input<string>;
engineVersionActual?: pulumi.Input<string>;
/**
* Enable to remove DB Cluster members from Global Cluster on destroy. Required with `sourceDbClusterIdentifier`.
*/
forceDestroy?: pulumi.Input<boolean>;
/**
* Global cluster identifier.
*/
globalClusterIdentifier?: pulumi.Input<string>;
/**
* Set of objects containing Global Cluster members.
*/
globalClusterMembers?: pulumi.Input<pulumi.Input<inputs.rds.GlobalClusterGlobalClusterMember>[]>;
/**
* AWS Region-unique, immutable identifier for the global database cluster. This identifier is found in AWS CloudTrail log entries whenever the AWS KMS key for the DB cluster is accessed.
*/
globalClusterResourceId?: pulumi.Input<string>;
/**
* Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
*/
region?: pulumi.Input<string>;
/**
* Amazon Resource Name (ARN) to use as the primary DB Cluster of the Global Cluster on creation. The provider cannot perform drift detection of this value. **NOTE:** After initial creation, this argument can be removed and replaced with `engine` and `engineVersion`. This allows upgrading the engine version of the Global Cluster.
*/
sourceDbClusterIdentifier?: pulumi.Input<string>;
/**
* Specifies whether the DB cluster is encrypted. The default is `false` unless `sourceDbClusterIdentifier` is specified and encrypted. The provider will only perform drift detection if a configuration value is provided.
*/
storageEncrypted?: pulumi.Input<boolean>;
/**
* A map of tags to assign to the DB cluster. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
*/
tags?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
*/
tagsAll?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
}
/**
* The set of arguments for constructing a GlobalCluster resource.
*/
export interface GlobalClusterArgs {
/**
* Name for an automatically created database on cluster creation. Pulumi will only perform drift detection if a configuration value is provided.
*/
databaseName?: pulumi.Input<string>;
/**
* If the Global Cluster should have deletion protection enabled. The database can't be deleted when this value is set to `true`. The default is `false`.
*/
deletionProtection?: pulumi.Input<boolean>;
/**
* Name of the database engine to be used for this DB cluster. The provider will only perform drift detection if a configuration value is provided. Valid values: `aurora`, `aurora-mysql`, `aurora-postgresql`. Defaults to `aurora`. Conflicts with `sourceDbClusterIdentifier`.
*/
engine?: pulumi.Input<string>;
/**
* The life cycle type for this DB instance. This setting applies only to Aurora PostgreSQL-based global databases. Valid values are `open-source-rds-extended-support`, `open-source-rds-extended-support-disabled`. Default value is `open-source-rds-extended-support`. [Using Amazon RDS Extended Support]: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/extended-support.html
*/
engineLifecycleSupport?: pulumi.Input<string>;
/**
* Engine version of the Aurora global database. The `engine`, `engineVersion`, and `instanceClass` (on the `aws.rds.ClusterInstance`) must together support global databases. See [Using Amazon Aurora global databases](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-global-database.html) for more information. By upgrading the engine version, the provider will upgrade cluster members. **NOTE:** To avoid an `inconsistent final plan` error while upgrading, use the `lifecycle` `ignoreChanges` for `engineVersion` meta argument on the associated `aws.rds.Cluster` resource as shown above in Upgrading Engine Versions example.
*/
engineVersion?: pulumi.Input<string>;
/**
* Enable to remove DB Cluster members from Global Cluster on destroy. Required with `sourceDbClusterIdentifier`.
*/
forceDestroy?: pulumi.Input<boolean>;
/**
* Global cluster identifier.
*/
globalClusterIdentifier: pulumi.Input<string>;
/**
* Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
*/
region?: pulumi.Input<string>;
/**
* Amazon Resource Name (ARN) to use as the primary DB Cluster of the Global Cluster on creation. The provider cannot perform drift detection of this value. **NOTE:** After initial creation, this argument can be removed and replaced with `engine` and `engineVersion`. This allows upgrading the engine version of the Global Cluster.
*/
sourceDbClusterIdentifier?: pulumi.Input<string>;
/**
* Specifies whether the DB cluster is encrypted. The default is `false` unless `sourceDbClusterIdentifier` is specified and encrypted. The provider will only perform drift detection if a configuration value is provided.
*/
storageEncrypted?: pulumi.Input<boolean>;
/**
* A map of tags to assign to the DB cluster. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
*/
tags?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
}