Awesome
<!-- markdownlint-disable --><a href="https://cpco.io/homepage"><img src="https://github.com/cloudposse/terraform-aws-rds-cluster/blob/main/.github/banner.png?raw=true" alt="Project Banner"/></a><br/> <p align="right"> <a href="https://github.com/cloudposse/terraform-aws-rds-cluster/releases/latest"><img src="https://img.shields.io/github/release/cloudposse/terraform-aws-rds-cluster.svg?style=for-the-badge" alt="Latest Release"/></a><a href="https://github.com/cloudposse/terraform-aws-rds-cluster/commits"><img src="https://img.shields.io/github/last-commit/cloudposse/terraform-aws-rds-cluster.svg?style=for-the-badge" alt="Last Updated"/></a><a href="https://slack.cloudposse.com"><img src="https://slack.cloudposse.com/for-the-badge.svg" alt="Slack Community"/></a></p>
<!-- markdownlint-restore --> <!-- ** DO NOT EDIT THIS FILE ** ** This file was automatically generated by the `cloudposse/build-harness`. ** 1) Make all changes to `README.yaml` ** 2) Run `make init` (you only need to do this once) ** 3) Run`make readme` to rebuild this file. ** ** (We maintain HUNDREDS of open source projects. This is how we maintain our sanity.) ** -->Terraform module to provision an RDS Aurora
cluster for MySQL or Postgres.
Supports Amazon Aurora Serverless.
[!TIP]
π½ Use Atmos with Terraform
Cloud Posse uses
<details> <summary><strong>Watch demo of using Atmos with Terraform</strong></summary> <img src="https://github.com/cloudposse/atmos/blob/main/docs/demo.gif?raw=true"/><br/> <i>Example of running <a href="https://atmos.tools"><code>atmos</code></a> to manage infrastructure from our <a href="https://atmos.tools/quick-start/">Quick Start</a> tutorial.</i> </detalis>atmos
to easily orchestrate multiple environments using Terraform. <br/> Works with Github Actions, Atlantis, or Spacelift.
Usage
For a complete example, see examples/complete.
For automated tests of the complete example using bats and Terratest (which tests and deploys the example on AWS), see test.
module "rds_cluster_aurora_postgres" {
source = "cloudposse/rds-cluster/aws"
# Cloud Posse recommends pinning every module to a specific version
# version = "x.x.x"
name = "postgres"
engine = "aurora-postgresql"
cluster_family = "aurora-postgresql9.6"
# 1 writer, 1 reader
cluster_size = 2
# 1 writer, 3 reader
# cluster_size = 4
# 1 writer, 5 reader
# cluster_size = 6
namespace = "eg"
stage = "dev"
admin_user = "admin1"
admin_password = "Test123456789"
db_name = "dbname"
db_port = 5432
instance_type = "db.r4.large"
vpc_id = "vpc-xxxxxxxx"
security_groups = ["sg-xxxxxxxx"]
subnets = ["subnet-xxxxxxxx", "subnet-xxxxxxxx"]
zone_id = "Zxxxxxxxx"
}
module "rds_cluster_aurora_mysql_serverless" {
source = "cloudposse/rds-cluster/aws"
# Cloud Posse recommends pinning every module to a specific version
# version = "x.x.x"
namespace = "eg"
stage = "dev"
name = "db"
engine = "aurora"
engine_mode = "serverless"
cluster_family = "aurora5.6"
cluster_size = 0
admin_user = "admin1"
admin_password = "Test123456789"
db_name = "dbname"
db_port = 3306
instance_type = "db.t2.small"
vpc_id = "vpc-xxxxxxxx"
security_groups = ["sg-xxxxxxxx"]
subnets = ["subnet-xxxxxxxx", "subnet-xxxxxxxx"]
zone_id = "Zxxxxxxxx"
enable_http_endpoint = true
scaling_configuration = [
{
auto_pause = true
max_capacity = 256
min_capacity = 2
seconds_until_auto_pause = 300
}
]
}
Serverless Aurora 2.07.1 MySQL 5.7
module "rds_cluster_aurora_mysql_serverless" {
source = "cloudposse/rds-cluster/aws"
# Cloud Posse recommends pinning every module to a specific version
# version = "x.x.x"
namespace = "eg"
stage = "dev"
name = "db"
engine = "aurora-mysql"
engine_mode = "serverless"
engine_version = "5.7.mysql_aurora.2.07.1"
cluster_family = "aurora-mysql5.7"
cluster_size = 0
admin_user = "admin1"
admin_password = "Test123456789"
db_name = "dbname"
db_port = 3306
vpc_id = "vpc-xxxxxxxx"
security_groups = ["sg-xxxxxxxx"]
subnets = ["subnet-xxxxxxxx", "subnet-xxxxxxxx"]
zone_id = "Zxxxxxxxx"
enable_http_endpoint = true
scaling_configuration = [
{
auto_pause = true
max_capacity = 16
min_capacity = 1
seconds_until_auto_pause = 300
timeout_action = "ForceApplyCapacityChange"
}
]
}
module "rds_cluster_aurora_mysql" {
source = "cloudposse/rds-cluster/aws"
# Cloud Posse recommends pinning every module to a specific version
# version = "x.x.x"
engine = "aurora"
cluster_family = "aurora-mysql5.7"
cluster_size = 2
namespace = "eg"
stage = "dev"
name = "db"
admin_user = "admin1"
admin_password = "Test123456789"
db_name = "dbname"
instance_type = "db.t2.small"
vpc_id = "vpc-xxxxxxx"
security_groups = ["sg-xxxxxxxx"]
subnets = ["subnet-xxxxxxxx", "subnet-xxxxxxxx"]
zone_id = "Zxxxxxxxx"
cluster_parameters = [
{
name = "character_set_client"
value = "utf8"
},
{
name = "character_set_connection"
value = "utf8"
},
{
name = "character_set_database"
value = "utf8"
},
{
name = "character_set_results"
value = "utf8"
},
{
name = "character_set_server"
value = "utf8"
},
{
name = "collation_connection"
value = "utf8_bin"
},
{
name = "collation_server"
value = "utf8_bin"
},
{
name = "lower_case_table_names"
value = "1"
apply_method = "pending-reboot"
},
{
name = "skip-character-set-client-handshake"
value = "1"
apply_method = "pending-reboot"
}
]
}
# create IAM role for monitoring
resource "aws_iam_role" "enhanced_monitoring" {
name = "rds-cluster-example-1"
assume_role_policy = data.aws_iam_policy_document.enhanced_monitoring.json
}
# Attach Amazon's managed policy for RDS enhanced monitoring
resource "aws_iam_role_policy_attachment" "enhanced_monitoring" {
role = aws_iam_role.enhanced_monitoring.name
policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonRDSEnhancedMonitoringRole"
}
# allow rds to assume this role
data "aws_iam_policy_document" "enhanced_monitoring" {
statement {
actions = [
"sts:AssumeRole",
]
effect = "Allow"
principals {
type = "Service"
identifiers = ["monitoring.rds.amazonaws.com"]
}
}
}
module "rds_cluster_aurora_postgres" {
source = "cloudposse/rds-cluster/aws"
# Cloud Posse recommends pinning every module to a specific version
# version = "x.x.x"
engine = "aurora-postgresql"
cluster_family = "aurora-postgresql9.6"
cluster_size = 2
namespace = "eg"
stage = "dev"
name = "db"
admin_user = "admin1"
admin_password = "Test123456789"
db_name = "dbname"
db_port = 5432
instance_type = "db.r4.large"
vpc_id = "vpc-xxxxxxx"
security_groups = ["sg-xxxxxxxx"]
subnets = ["subnet-xxxxxxxx", "subnet-xxxxxxxx"]
zone_id = "Zxxxxxxxx"
# enable monitoring every 30 seconds
rds_monitoring_interval = 30
# reference iam role created above
rds_monitoring_role_arn = aws_iam_role.enhanced_monitoring.arn
}
[!IMPORTANT] In Cloud Posse's examples, we avoid pinning modules to specific versions to prevent discrepancies between the documentation and the latest released versions. However, for your own projects, we strongly advise pinning each module to the exact version you're using. This practice ensures the stability of your infrastructure. Additionally, we recommend implementing a systematic approach for updating versions to avoid unexpected changes.
Examples
Review the complete example to see how to use this module.
<!-- markdownlint-disable -->Makefile Targets
Available targets:
help Help screen
help/all Display help for all targets
help/short This help short screen
lint Lint terraform code
<!-- markdownlint-restore -->
<!-- markdownlint-disable -->
Requirements
Name | Version |
---|---|
<a name="requirement_terraform"></a> terraform | >= 1.0.0 |
<a name="requirement_aws"></a> aws | >= 4.23.0 |
<a name="requirement_null"></a> null | >= 2.0 |
<a name="requirement_random"></a> random | >= 2.0 |
Providers
Name | Version |
---|---|
<a name="provider_aws"></a> aws | >= 4.23.0 |
<a name="provider_random"></a> random | >= 2.0 |
Modules
Name | Source | Version |
---|---|---|
<a name="module_dns_master"></a> dns_master | cloudposse/route53-cluster-hostname/aws | 0.13.0 |
<a name="module_dns_replicas"></a> dns_replicas | cloudposse/route53-cluster-hostname/aws | 0.13.0 |
<a name="module_enhanced_monitoring_label"></a> enhanced_monitoring_label | cloudposse/label/null | 0.25.0 |
<a name="module_rds_identifier"></a> rds_identifier | cloudposse/label/null | 0.25.0 |
<a name="module_this"></a> this | cloudposse/label/null | 0.25.0 |
Resources
Inputs
Name | Description | Type | Default | Required |
---|---|---|---|---|
<a name="input_activity_stream_enabled"></a> activity_stream_enabled | Whether to enable Activity Streams | bool | false | no |
<a name="input_activity_stream_kms_key_id"></a> activity_stream_kms_key_id | The ARN for the KMS key to encrypt Activity Stream Data data. When specifying activity_stream_kms_key_id , activity_stream_enabled needs to be set to true | string | "" | no |
<a name="input_activity_stream_mode"></a> activity_stream_mode | The mode for the Activity Streams. async and sync are supported. Defaults to async | string | "async" | no |
<a name="input_additional_tag_map"></a> additional_tag_map | Additional key-value pairs to add to each map in tags_as_list_of_maps . Not added to tags or id .<br/>This is for some rare cases where resources want additional configuration of tags<br/>and therefore take a list of maps with tag key, value, and additional configuration. | map(string) | {} | no |
<a name="input_admin_password"></a> admin_password | Password for the master DB user. Ignored if snapshot_identifier or replication_source_identifier is provided | string | "" | no |
<a name="input_admin_user"></a> admin_user | Username for the master DB user. Ignored if snapshot_identifier or replication_source_identifier is provided | string | "admin" | no |
<a name="input_admin_user_secret_kms_key_id"></a> admin_user_secret_kms_key_id | Amazon Web Services KMS key identifier is the key ARN, key ID, alias ARN, or alias name for the KMS key.<br/>To use a KMS key in a different Amazon Web Services account, specify the key ARN or alias ARN.<br/>If not specified, the default KMS key for your Amazon Web Services account is used. | string | null | no |
<a name="input_allocated_storage"></a> allocated_storage | The allocated storage in GBs | number | null | no |
<a name="input_allow_major_version_upgrade"></a> allow_major_version_upgrade | Enable to allow major engine version upgrades when changing engine versions. Defaults to false. | bool | false | no |
<a name="input_allowed_cidr_blocks"></a> allowed_cidr_blocks | List of CIDR blocks allowed to access the cluster | list(string) | [] | no |
<a name="input_allowed_ipv6_cidr_blocks"></a> allowed_ipv6_cidr_blocks | List of IPv6 CIDR blocks allowed to access the cluster | list(string) | [] | no |
<a name="input_apply_immediately"></a> apply_immediately | Specifies whether any cluster modifications are applied immediately, or during the next maintenance window | bool | true | no |
<a name="input_attributes"></a> attributes | ID element. Additional attributes (e.g. workers or cluster ) to add to id ,<br/>in the order they appear in the list. New attributes are appended to the<br/>end of the list. The elements of the list are joined by the delimiter <br/>and treated as a single ID element. | list(string) | [] | no |
<a name="input_auto_minor_version_upgrade"></a> auto_minor_version_upgrade | Indicates that minor engine upgrades will be applied automatically to the DB instance during the maintenance window | bool | true | no |
<a name="input_autoscaling_enabled"></a> autoscaling_enabled | Whether to enable cluster autoscaling | bool | false | no |
<a name="input_autoscaling_max_capacity"></a> autoscaling_max_capacity | Maximum number of instances to be maintained by the autoscaler | number | 5 | no |
<a name="input_autoscaling_min_capacity"></a> autoscaling_min_capacity | Minimum number of instances to be maintained by the autoscaler | number | 1 | no |
<a name="input_autoscaling_policy_type"></a> autoscaling_policy_type | Autoscaling policy type. TargetTrackingScaling and StepScaling are supported | string | "TargetTrackingScaling" | no |
<a name="input_autoscaling_scale_in_cooldown"></a> autoscaling_scale_in_cooldown | The amount of time, in seconds, after a scaling activity completes and before the next scaling down activity can start. Default is 300s | number | 300 | no |
<a name="input_autoscaling_scale_out_cooldown"></a> autoscaling_scale_out_cooldown | The amount of time, in seconds, after a scaling activity completes and before the next scaling up activity can start. Default is 300s | number | 300 | no |
<a name="input_autoscaling_target_metrics"></a> autoscaling_target_metrics | The metrics type to use. If this value isn't provided the default is CPU utilization | string | "RDSReaderAverageCPUUtilization" | no |
<a name="input_autoscaling_target_value"></a> autoscaling_target_value | The target value to scale with respect to target metrics | number | 75 | no |
<a name="input_backtrack_window"></a> backtrack_window | The target backtrack window, in seconds. Only available for aurora engine currently. Must be between 0 and 259200 (72 hours) | number | 0 | no |
<a name="input_backup_window"></a> backup_window | Daily time range during which the backups happen | string | "07:00-09:00" | no |
<a name="input_ca_cert_identifier"></a> ca_cert_identifier | The identifier of the CA certificate for the DB instance | string | null | no |
<a name="input_cluster_dns_name"></a> cluster_dns_name | Name of the cluster CNAME record to create in the parent DNS zone specified by zone_id . If left empty, the name will be auto-asigned using the format master.var.name | string | "" | no |
<a name="input_cluster_family"></a> cluster_family | The family of the DB cluster parameter group | string | "aurora5.6" | no |
<a name="input_cluster_identifier"></a> cluster_identifier | The RDS Cluster Identifier. Will use generated label ID if not supplied | string | "" | no |
<a name="input_cluster_parameters"></a> cluster_parameters | List of DB cluster parameters to apply | <pre>list(object({<br/> apply_method = string<br/> name = string<br/> value = string<br/> }))</pre> | [] | no |
<a name="input_cluster_size"></a> cluster_size | Number of DB instances to create in the cluster | number | 2 | no |
<a name="input_cluster_type"></a> cluster_type | Either regional or global .<br/>If regional will be created as a normal, standalone DB.<br/>If global , will be made part of a Global cluster (requires global_cluster_identifier ). | string | "regional" | no |
<a name="input_context"></a> context | Single object for setting entire context at once.<br/>See description of individual variables for details.<br/>Leave string and numeric variables as null to use default value.<br/>Individual variable settings (non-null) override settings in context object,<br/>except for attributes, tags, and additional_tag_map, which are merged. | any | <pre>{<br/> "additional_tag_map": {},<br/> "attributes": [],<br/> "delimiter": null,<br/> "descriptor_formats": {},<br/> "enabled": true,<br/> "environment": null,<br/> "id_length_limit": null,<br/> "label_key_case": null,<br/> "label_order": [],<br/> "label_value_case": null,<br/> "labels_as_tags": [<br/> "unset"<br/> ],<br/> "name": null,<br/> "namespace": null,<br/> "regex_replace_chars": null,<br/> "stage": null,<br/> "tags": {},<br/> "tenant": null<br/>}</pre> | no |
<a name="input_copy_tags_to_snapshot"></a> copy_tags_to_snapshot | Copy tags to backup snapshots | bool | false | no |
<a name="input_db_cluster_instance_class"></a> db_cluster_instance_class | This setting is required to create a provisioned Multi-AZ DB cluster | string | null | no |
<a name="input_db_name"></a> db_name | Database name (default is not to create a database) | string | "" | no |
<a name="input_db_parameter_group_name"></a> db_parameter_group_name | The name to give to the created aws_db_parameter_group resource.<br/>If omitted, the module will generate a name. | string | "" | no |
<a name="input_db_port"></a> db_port | Database port | number | 3306 | no |
<a name="input_deletion_protection"></a> deletion_protection | If the DB instance should have deletion protection enabled | bool | false | no |
<a name="input_delimiter"></a> delimiter | Delimiter to be used between ID elements.<br/>Defaults to - (hyphen). Set to "" to use no delimiter at all. | string | null | no |
<a name="input_descriptor_formats"></a> descriptor_formats | Describe additional descriptors to be output in the descriptors output map.<br/>Map of maps. Keys are names of descriptors. Values are maps of the form<br/>{<br/> format = string<br/> labels = list(string)<br/>} <br/>(Type is any so the map values can later be enhanced to provide additional options.)<br/>format is a Terraform format string to be passed to the format() function.<br/>labels is a list of labels, in order, to pass to format() function.<br/>Label values will be normalized before being passed to format() so they will be<br/>identical to how they appear in id .<br/>Default is {} (descriptors output will be empty). | any | {} | no |
<a name="input_egress_enabled"></a> egress_enabled | Whether or not to apply the egress security group rule to default security group, defaults to true | bool | true | no |
<a name="input_enable_global_write_forwarding"></a> enable_global_write_forwarding | Set to true , to forward writes to an associated global cluster. | bool | null | no |
<a name="input_enable_http_endpoint"></a> enable_http_endpoint | Enable HTTP endpoint (data API). Only valid when engine_mode is set to serverless | bool | false | no |
<a name="input_enable_local_write_forwarding"></a> enable_local_write_forwarding | Set to true , to forward writes sent to a reader to the writer instance. | bool | null | no |
<a name="input_enabled"></a> enabled | Set to false to prevent the module from creating any resources | bool | null | no |
<a name="input_enabled_cloudwatch_logs_exports"></a> enabled_cloudwatch_logs_exports | List of log types to export to cloudwatch. The following log types are supported: audit, error, general, slowquery | list(string) | [] | no |
<a name="input_engine"></a> engine | The name of the database engine to be used for this DB cluster. Valid values: aurora , aurora-mysql , aurora-postgresql | string | "aurora" | no |
<a name="input_engine_mode"></a> engine_mode | The database engine mode. Valid values: parallelquery , provisioned , serverless | string | "provisioned" | no |
<a name="input_engine_version"></a> engine_version | The version of the database engine to use. See aws rds describe-db-engine-versions | string | "" | no |
<a name="input_enhanced_monitoring_attributes"></a> enhanced_monitoring_attributes | The attributes for the enhanced monitoring IAM role | list(string) | <pre>[<br/> "enhanced-monitoring"<br/>]</pre> | no |
<a name="input_enhanced_monitoring_role_enabled"></a> enhanced_monitoring_role_enabled | A boolean flag to enable/disable the creation of the enhanced monitoring IAM role. If set to false , the module will not create a new role and will use rds_monitoring_role_arn for enhanced monitoring | bool | false | no |
<a name="input_environment"></a> environment | ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' | string | null | no |
<a name="input_global_cluster_identifier"></a> global_cluster_identifier | ID of the Aurora global cluster | string | "" | no |
<a name="input_iam_database_authentication_enabled"></a> iam_database_authentication_enabled | Specifies whether or mappings of AWS Identity and Access Management (IAM) accounts to database accounts is enabled | bool | false | no |
<a name="input_iam_roles"></a> iam_roles | Iam roles for the Aurora cluster | list(string) | [] | no |
<a name="input_id_length_limit"></a> id_length_limit | Limit id to this many characters (minimum 6).<br/>Set to 0 for unlimited length.<br/>Set to null for keep the existing setting, which defaults to 0 .<br/>Does not affect id_full . | number | null | no |
<a name="input_instance_availability_zone"></a> instance_availability_zone | Optional parameter to place cluster instances in a specific availability zone. If left empty, will place randomly | string | "" | no |
<a name="input_instance_parameters"></a> instance_parameters | List of DB instance parameters to apply | <pre>list(object({<br/> apply_method = string<br/> name = string<br/> value = string<br/> }))</pre> | [] | no |
<a name="input_instance_type"></a> instance_type | Instance type to use | string | "db.t2.small" | no |
<a name="input_intra_security_group_traffic_enabled"></a> intra_security_group_traffic_enabled | Whether to allow traffic between resources inside the database's security group. | bool | false | no |
<a name="input_iops"></a> iops | The amount of provisioned IOPS. Setting this implies a storage_type of 'io1'. This setting is required to create a Multi-AZ DB cluster. Check TF docs for values based on db engine | number | null | no |
<a name="input_kms_key_arn"></a> kms_key_arn | The ARN for the KMS encryption key. When specifying kms_key_arn , storage_encrypted needs to be set to true | string | "" | no |
<a name="input_label_key_case"></a> label_key_case | Controls the letter case of the tags keys (label names) for tags generated by this module.<br/>Does not affect keys of tags passed in via the tags input.<br/>Possible values: lower , title , upper .<br/>Default value: title . | string | null | no |
<a name="input_label_order"></a> label_order | The order in which the labels (ID elements) appear in the id .<br/>Defaults to ["namespace", "environment", "stage", "name", "attributes"].<br/>You can omit any of the 6 labels ("tenant" is the 6th), but at least one must be present. | list(string) | null | no |
<a name="input_label_value_case"></a> label_value_case | Controls the letter case of ID elements (labels) as included in id ,<br/>set as tag values, and output by this module individually.<br/>Does not affect values of tags passed in via the tags input.<br/>Possible values: lower , title , upper and none (no transformation).<br/>Set this to title and set delimiter to "" to yield Pascal Case IDs.<br/>Default value: lower . | string | null | no |
<a name="input_labels_as_tags"></a> labels_as_tags | Set of labels (ID elements) to include as tags in the tags output.<br/>Default is to include all labels.<br/>Tags with empty values will not be included in the tags output.<br/>Set to [] to suppress all generated tags.<br/>Notes:<br/> The value of the name tag, if included, will be the id , not the name .<br/> Unlike other null-label inputs, the initial setting of labels_as_tags cannot be<br/> changed in later chained modules. Attempts to change it will be silently ignored. | set(string) | <pre>[<br/> "default"<br/>]</pre> | no |
<a name="input_maintenance_window"></a> maintenance_window | Weekly time range during which system maintenance can occur, in UTC | string | "wed:03:00-wed:04:00" | no |
<a name="input_manage_admin_user_password"></a> manage_admin_user_password | Set to true to allow RDS to manage the master user password in Secrets Manager. Cannot be set if master_password is provided | bool | false | no |
<a name="input_name"></a> name | ID element. Usually the component or solution name, e.g. 'app' or 'jenkins'.<br/>This is the only ID element not also included as a tag .<br/>The "name" tag is set to the full id string. There is no tag with the value of the name input. | string | null | no |
<a name="input_namespace"></a> namespace | ID element. Usually an abbreviation of your organization name, e.g. 'eg' or 'cp', to help ensure generated IDs are globally unique | string | null | no |
<a name="input_network_type"></a> network_type | The network type of the cluster. Valid values: IPV4, DUAL. | string | "IPV4" | no |
<a name="input_parameter_group_name_prefix_enabled"></a> parameter_group_name_prefix_enabled | Set to true to use name_prefix to name the cluster and database parameter groups. Set to false to use name instead | bool | true | no |
<a name="input_performance_insights_enabled"></a> performance_insights_enabled | Whether to enable Performance Insights | bool | false | no |
<a name="input_performance_insights_kms_key_id"></a> performance_insights_kms_key_id | The ARN for the KMS key to encrypt Performance Insights data. When specifying performance_insights_kms_key_id , performance_insights_enabled needs to be set to true | string | "" | no |
<a name="input_performance_insights_retention_period"></a> performance_insights_retention_period | Amount of time in days to retain Performance Insights data. Either 7 (7 days) or 731 (2 years) | number | null | no |
<a name="input_publicly_accessible"></a> publicly_accessible | Set to true if you want your cluster to be publicly accessible (such as via QuickSight) | bool | false | no |
<a name="input_rds_cluster_parameter_group_name"></a> rds_cluster_parameter_group_name | The name to give to the created aws_rds_cluster_parameter_group resource.<br/>If omitted, the module will generate a name. | string | "" | no |
<a name="input_rds_monitoring_interval"></a> rds_monitoring_interval | The interval, in seconds, between points when enhanced monitoring metrics are collected for the DB instance. To disable collecting Enhanced Monitoring metrics, specify 0. The default is 0. Valid Values: 0, 1, 5, 10, 15, 30, 60 | number | 0 | no |
<a name="input_rds_monitoring_role_arn"></a> rds_monitoring_role_arn | The ARN for the IAM role that permits RDS to send enhanced monitoring metrics to CloudWatch Logs | string | null | no |
<a name="input_rds_ri_duration"></a> rds_ri_duration | The number of years to reserve the instance. Values can be 1 or 3 (or in seconds, 31536000 or 94608000) | number | 1 | no |
<a name="input_rds_ri_offering_type"></a> rds_ri_offering_type | Offering type of reserved DB instances. Valid values are 'No Upfront', 'Partial Upfront', 'All Upfront'. | string | "" | no |
<a name="input_rds_ri_reservation_id"></a> rds_ri_reservation_id | Customer-specified identifier to track the reservation of the reserved DB instance. | string | null | no |
<a name="input_reader_dns_name"></a> reader_dns_name | Name of the reader endpoint CNAME record to create in the parent DNS zone specified by zone_id . If left empty, the name will be auto-asigned using the format replicas.var.name | string | "" | no |
<a name="input_regex_replace_chars"></a> regex_replace_chars | Terraform regular expression (regex) string.<br/>Characters matching the regex will be removed from the ID elements.<br/>If not set, "/[^a-zA-Z0-9-]/" is used to remove all characters other than hyphens, letters and digits. | string | null | no |
<a name="input_replication_source_identifier"></a> replication_source_identifier | ARN of a source DB cluster or DB instance if this DB cluster is to be created as a Read Replica | string | "" | no |
<a name="input_restore_to_point_in_time"></a> restore_to_point_in_time | List of point-in-time recovery options. Valid parameters are:<br/><br/>source_cluster_identifier <br/> Identifier of the source database cluster from which to restore.<br/>restore_type :<br/> Type of restore to be performed. Valid options are "full-copy" and "copy-on-write".<br/>use_latest_restorable_time :<br/> Set to true to restore the database cluster to the latest restorable backup time. Conflicts with restore_to_time .<br/>restore_to_time :<br/> Date and time in UTC format to restore the database cluster to. Conflicts with use_latest_restorable_time . | <pre>list(object({<br/> source_cluster_identifier = string<br/> restore_type = optional(string, "copy-on-write")<br/> use_latest_restorable_time = optional(bool, true)<br/> restore_to_time = optional(string, null)<br/> }))</pre> | [] | no |
<a name="input_retention_period"></a> retention_period | Number of days to retain backups for | number | 5 | no |
<a name="input_s3_import"></a> s3_import | Restore from a Percona Xtrabackup in S3. The bucket_name is required to be in the same region as the resource. | <pre>object({<br/> bucket_name = string<br/> bucket_prefix = string<br/> ingestion_role = string<br/> source_engine = string<br/> source_engine_version = string<br/> })</pre> | null | no |
<a name="input_scaling_configuration"></a> scaling_configuration | List of nested attributes with scaling properties. Only valid when engine_mode is set to serverless | <pre>list(object({<br/> auto_pause = bool<br/> max_capacity = number<br/> min_capacity = number<br/> seconds_until_auto_pause = number<br/> timeout_action = string<br/> }))</pre> | [] | no |
<a name="input_security_groups"></a> security_groups | List of security groups to be allowed to connect to the DB instance | list(string) | [] | no |
<a name="input_serverlessv2_scaling_configuration"></a> serverlessv2_scaling_configuration | serverlessv2 scaling properties | <pre>object({<br/> min_capacity = number<br/> max_capacity = number<br/> })</pre> | null | no |
<a name="input_skip_final_snapshot"></a> skip_final_snapshot | Determines whether a final DB snapshot is created before the DB cluster is deleted | bool | true | no |
<a name="input_snapshot_identifier"></a> snapshot_identifier | Specifies whether or not to create this cluster from a snapshot | string | null | no |
<a name="input_source_region"></a> source_region | Source Region of primary cluster, needed when using encrypted storage and region replicas | string | "" | no |
<a name="input_stage"></a> stage | ID element. Usually used to indicate role, e.g. 'prod', 'staging', 'source', 'build', 'test', 'deploy', 'release' | string | null | no |
<a name="input_storage_encrypted"></a> storage_encrypted | Specifies whether the DB cluster is encrypted. The default is false for provisioned engine_mode and true for serverless engine_mode | bool | false | no |
<a name="input_storage_type"></a> storage_type | One of 'standard' (magnetic), 'gp2' (general purpose SSD), 'io1' (provisioned IOPS SSD), 'aurora', or 'aurora-iopt1' | string | null | no |
<a name="input_subnet_group_name"></a> subnet_group_name | Database subnet group name. Will use generated label ID if not supplied. | string | "" | no |
<a name="input_subnets"></a> subnets | List of VPC subnet IDs | list(string) | n/a | yes |
<a name="input_tags"></a> tags | Additional tags (e.g. {'BusinessUnit': 'XYZ'} ).<br/>Neither the tag keys nor the tag values will be modified by this module. | map(string) | {} | no |
<a name="input_tenant"></a> tenant | ID element _(Rarely used, not included by default)_. A customer identifier, indicating who this instance of a resource is for | string | null | no |
<a name="input_timeouts_configuration"></a> timeouts_configuration | List of timeout values per action. Only valid actions are create , update and delete | <pre>list(object({<br/> create = string<br/> update = string<br/> delete = string<br/> }))</pre> | [] | no |
<a name="input_use_reserved_instances"></a> use_reserved_instances | WARNING: Observe your plans and applies carefully when using this feature.<br/>It has potential to be very expensive if not used correctly.<br/>Also, it is not clear what happens when the reservation expires.<br/><br/>Whether to use reserved instances. | bool | false | no |
<a name="input_vpc_id"></a> vpc_id | VPC ID to create the cluster in (e.g. vpc-a22222ee ) | string | n/a | yes |
<a name="input_vpc_security_group_ids"></a> vpc_security_group_ids | Additional security group IDs to apply to the cluster, in addition to the provisioned default security group with ingress traffic from existing CIDR blocks and existing security groups | list(string) | [] | no |
<a name="input_zone_id"></a> zone_id | Route53 DNS Zone ID as list of string (0 or 1 items). If empty, no custom DNS name will be published.<br/>If the list contains a single Zone ID, a custom DNS name will be pulished in that zone.<br/>Can also be a plain string, but that use is DEPRECATED because of Terraform issues. | any | [] | no |
Outputs
Name | Description |
---|---|
<a name="output_activity_stream_arn"></a> activity_stream_arn | Activity Stream ARN |
<a name="output_activity_stream_name"></a> activity_stream_name | Activity Stream Name |
<a name="output_arn"></a> arn | Amazon Resource Name (ARN) of the cluster |
<a name="output_cluster_identifier"></a> cluster_identifier | Cluster Identifier |
<a name="output_cluster_resource_id"></a> cluster_resource_id | The region-unique, immutable identifie of the cluster |
<a name="output_cluster_security_groups"></a> cluster_security_groups | Default RDS cluster security groups |
<a name="output_database_name"></a> database_name | Database name |
<a name="output_dbi_resource_ids"></a> dbi_resource_ids | List of the region-unique, immutable identifiers for the DB instances in the cluster |
<a name="output_endpoint"></a> endpoint | The DNS address of the RDS instance |
<a name="output_instance_endpoints"></a> instance_endpoints | List of DNS addresses for the DB instances in the cluster |
<a name="output_master_host"></a> master_host | DB Master hostname |
<a name="output_master_username"></a> master_username | Username for the master DB user |
<a name="output_reader_endpoint"></a> reader_endpoint | A read-only endpoint for the Aurora cluster, automatically load-balanced across replicas |
<a name="output_replicas_host"></a> replicas_host | Replicas hostname |
<a name="output_reserved_instance"></a> reserved_instance | All information about the reserved instance(s) if created. |
<a name="output_security_group_arn"></a> security_group_arn | Security Group ARN |
<a name="output_security_group_id"></a> security_group_id | Security Group ID |
<a name="output_security_group_name"></a> security_group_name | Security Group name |
Related Projects
Check out these related projects.
- terraform-aws-rds - Terraform module to provision AWS RDS instances
- terraform-aws-rds-cloudwatch-sns-alarms - Terraform module that configures important RDS alerts using CloudWatch and sends them to an SNS topic
[!TIP]
Use Terraform Reference Architectures for AWS
Use Cloud Posse's ready-to-go terraform architecture blueprints for AWS to get up and running quickly.
β We build it together with your team.<br/> β Your team owns everything.<br/> β 100% Open Source and backed by fanatical support.<br/>
<a href="https://cpco.io/commercial-support?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-rds-cluster&utm_content=commercial_support"><img alt="Request Quote" src="https://img.shields.io/badge/request%20quote-success.svg?style=for-the-badge"/></a>
<details><summary>π <strong>Learn More</strong></summary> <br/>Cloud Posse is the leading DevOps Accelerator for funded startups and enterprises.
Your team can operate like a pro today.
Ensure that your team succeeds by using Cloud Posse's proven process and turnkey blueprints. Plus, we stick around until you succeed.
Day-0: Your Foundation for Success
- Reference Architecture. You'll get everything you need from the ground up built using 100% infrastructure as code.
- Deployment Strategy. Adopt a proven deployment strategy with GitHub Actions, enabling automated, repeatable, and reliable software releases.
- Site Reliability Engineering. Gain total visibility into your applications and services with Datadog, ensuring high availability and performance.
- Security Baseline. Establish a secure environment from the start, with built-in governance, accountability, and comprehensive audit logs, safeguarding your operations.
- GitOps. Empower your team to manage infrastructure changes confidently and efficiently through Pull Requests, leveraging the full power of GitHub Actions.
<a href="https://cpco.io/commercial-support?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-rds-cluster&utm_content=commercial_support"><img alt="Request Quote" src="https://img.shields.io/badge/request%20quote-success.svg?style=for-the-badge"/></a>
Day-2: Your Operational Mastery
- Training. Equip your team with the knowledge and skills to confidently manage the infrastructure, ensuring long-term success and self-sufficiency.
- Support. Benefit from a seamless communication over Slack with our experts, ensuring you have the support you need, whenever you need it.
- Troubleshooting. Access expert assistance to quickly resolve any operational challenges, minimizing downtime and maintaining business continuity.
- Code Reviews. Enhance your teamβs code quality with our expert feedback, fostering continuous improvement and collaboration.
- Bug Fixes. Rely on our team to troubleshoot and resolve any issues, ensuring your systems run smoothly.
- Migration Assistance. Accelerate your migration process with our dedicated support, minimizing disruption and speeding up time-to-value.
- Customer Workshops. Engage with our team in weekly workshops, gaining insights and strategies to continuously improve and innovate.
<a href="https://cpco.io/commercial-support?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-rds-cluster&utm_content=commercial_support"><img alt="Request Quote" src="https://img.shields.io/badge/request%20quote-success.svg?style=for-the-badge"/></a>
</details>
β¨ Contributing
This project is under active development, and we encourage contributions from our community.
Many thanks to our outstanding contributors:
<a href="https://github.com/cloudposse/terraform-aws-rds-cluster/graphs/contributors"> <img src="https://contrib.rocks/image?repo=cloudposse/terraform-aws-rds-cluster&max=24" /> </a>For π bug reports & feature requests, please use the issue tracker.
In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.
- Review our Code of Conduct and Contributor Guidelines.
- Fork the repo on GitHub
- Clone the project to your own machine
- Commit changes to your own branch
- Push your work back up to your fork
- Submit a Pull Request so that we can review your changes
NOTE: Be sure to merge the latest changes from "upstream" before making a pull request!
π Slack Community
Join our Open Source Community on Slack. It's FREE for everyone! Our "SweetOps" community is where you get to talk with others who share a similar vision for how to rollout and manage infrastructure. This is the best place to talk shop, ask questions, solicit feedback, and work together as a community to build totally sweet infrastructure.
π° Newsletter
Sign up for our newsletter and join 3,000+ DevOps engineers, CTOs, and founders who get insider access to the latest DevOps trends, so you can always stay in the know. Dropped straight into your Inbox every week β and usually a 5-minute read.
π Office Hours <a href="https://cloudposse.com/office-hours?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-rds-cluster&utm_content=office_hours"><img src="https://img.cloudposse.com/fit-in/200x200/https://cloudposse.com/wp-content/uploads/2019/08/Powered-by-Zoom.png" align="right" /></a>
Join us every Wednesday via Zoom for your weekly dose of insider DevOps trends, AWS news and Terraform insights, all sourced from our SweetOps community, plus a live Q&A that you canβt find anywhere else. It's FREE for everyone!
License
<a href="https://opensource.org/licenses/Apache-2.0"><img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg?style=for-the-badge" alt="License"></a>
<details> <summary>Preamble to the Apache License, Version 2.0</summary> <br/> <br/>Complete license is available in the LICENSE
file.
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
</details>
Trademarks
All other trademarks referenced herein are the property of their respective owners.
Copyright Β© 2017-2024 Cloud Posse, LLC
<a href="https://cloudposse.com/readme/footer/link?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-rds-cluster&utm_content=readme_footer_link"><img alt="README footer" src="https://cloudposse.com/readme/footer/img"/></a>
<img alt="Beacon" width="0" src="https://ga-beacon.cloudposse.com/UA-76589703-4/cloudposse/terraform-aws-rds-cluster?pixel&cs=github&cm=readme&an=terraform-aws-rds-cluster"/>