5.0 KiB
layout | page_title | sidebar_current | description |
---|---|---|---|
aws | AWS: aws_rds_cluster | docs-aws-resource-rds-cluster | Provides an RDS Cluster Resource |
aws_rds_cluster
Provides an RDS Cluster Resource. A Cluster Resource defines attributes that are applied to the entire cluster of RDS Cluster Instances. Use the RDS Cluster resource and RDS Cluster Instances to create and use Amazon Aurora, a MySQL-compatible database engine.
For more information on Amazon Aurora, see Aurora on Amazon RDS in the Amazon RDS User Guide.
Changes to a RDS Cluster can occur when you manually change a
parameter, such as port
, and are reflected in the next maintenance
window. Because of this, Terraform may report a difference in it's planning
phase because a modification has not yet taken place. You can use the
apply_immediately
flag to instruct the service to apply the change immediately
(see documentation below).
~> Note: using apply_immediately
can result in a
brief downtime as the server reboots. See the AWS Docs on RDS Maintenance
for more information.
Example Usage
resource "aws_rds_cluster" "default" {
cluster_identifier = "aurora-cluster-demo"
availability_zones = ["us-west-2a","us-west-2b","us-west-2c"]
database_name = "mydb"
master_username = "foo"
master_password = "bar"
backup_retention_period = 5
preferred_backup_window = "07:00-09:00"
}
~> NOTE: RDS Clusters resources that are created without any matching RDS Cluster Instances do not currently display in the AWS Console.
Argument Reference
For more detailed documentation about each argument, refer to the AWS official documentation.
The following arguments are supported:
cluster_identifier
- (Required) The Cluster Identifier. Must be a lower case string.database_name
- (Optional) The name for your database of up to 8 alpha-numeric characters. If you do not provide a name, Amazon RDS will not create a database in the DB cluster you are creatingmaster_password
- (Required) Password for the master DB user. Note that this may show up in logs, and it will be stored in the state filemaster_username
- (Required) Username for the master DB userfinal_snapshot_identifier
- (Optional) The name of your final DB snapshot when this DB cluster is deleted. If omitted, no final snapshot will be made.availability_zones
- (Optional) A list of EC2 Availability Zones that instances in the DB cluster can be created inbackup_retention_period
- (Optional) The days to retain backups for. Default 1preferred_backup_window
- (Optional) The daily time range during which automated backups are created if automated backups are enabled using the BackupRetentionPeriod parameter. Default: A 30-minute window selected at random from an 8-hour block of time per region. e.g. 04:00-09:00preferred_maintenance_window
- (Optional) The weekly time range during which system maintenance can occur, in (UTC) e.g. wed:04:00-wed:04:30port
- (Optional) The port on which the DB accepts connectionsvpc_security_group_ids
- (Optional) List of VPC security groups to associate with the Clusterapply_immediately
- (Optional) Specifies whether any cluster modifications are applied immediately, or during the next maintenance window. Default isfalse
. See Amazon RDS Documentation for more information.db_subnet_group_name
- (Optional) A DB subnet group to associate with this DB instance.
Attributes Reference
The following attributes are exported:
id
- The RDS Cluster Identifiercluster_identifier
- The RDS Cluster Identifiercluster_members
– List of RDS Instances that are a part of this clusteraddress
- The address of the RDS instance.allocated_storage
- The amount of allocated storageavailability_zones
- The availability zone of the instancebackup_retention_period
- The backup retention periodpreferred_backup_window
- The backup windowpreferred_maintenance_window
- The maintenance windowendpoint
- The primary, writeable connection endpointengine
- The database engineengine_version
- The database engine versionmaintenance_window
- The instance maintenance windowdatabase_name
- The database nameport
- The database portstatus
- The RDS instance statususername
- The master username for the databasestorage_encrypted
- Specifies whether the DB instance is encryptedpreferred_backup_window
- The daily time range during which the backups happen