Skip to content

Latest commit

 

History

History

rds

This module will create an RDS Cluster with an optional RDS Proxy to manage connections.

Requirements

No requirements.

Providers

Name Version
aws n/a
random n/a

Modules

No modules.

Resources

Name Type
aws_cloudwatch_log_group.log_exports resource
aws_cloudwatch_log_group.proxy resource
aws_db_event_subscription.rds_sg_events_alerts resource
aws_db_proxy.proxy resource
aws_db_proxy_default_target_group.this resource
aws_db_proxy_target.target resource
aws_db_subnet_group.rds resource
aws_iam_policy.read_connection_string resource
aws_iam_role.rds_proxy resource
aws_iam_role_policy_attachment.read_connection_string resource
aws_rds_cluster.cluster resource
aws_rds_cluster_instance.instances resource
aws_secretsmanager_secret.connection_string resource
aws_secretsmanager_secret.proxy_connection_string resource
aws_secretsmanager_secret_version.connection_string resource
aws_secretsmanager_secret_version.proxy_connection_string resource
aws_security_group.rds resource
aws_security_group_rule.rds_egress resource
aws_security_group_rule.rds_ingress resource
random_string.random resource
aws_iam_policy_document.assume_role data source
aws_iam_policy_document.read_connection_string data source
aws_region.current data source

Inputs

Name Description Type Default Required
allow_major_version_upgrade (Optional, default 'false') This flag allows RDS to perform a major engine upgrade.
Please Note: This could break things so make sure you know that your code is compatible with the new features in this version.
bool false no
backtrack_window (Optional, defaults to 72 hours) The number of days to retain a backtrack. Set to 0 to disable backtracking. This is only valid for the aurora-mysql engine type. number 259200 no
backup_retention_period (Required) The amount of days to keep backups for. number n/a yes
billing_tag_key (Optional, default 'CostCentre') The name of the billing tag string "CostCentre" no
billing_tag_value (Required) The value of the billing tag string n/a yes
cloudwatch_log_exports_retention_in_days (Optional, default 7) The number of days to store exported database logs in the CloudWatch log group. number 7 no
database_name (Required) The name of the database to be created inside the cluster. string n/a yes
db_cluster_parameter_group_name (Optional, no default) Name of DB cluster parameter group to associate with this DB cluster. string null no
enabled_cloudwatch_logs_exports (Optional, default empty list) The database log types to export to CloudWatch. Valid values are audit, error, general, slowquery, postgresql. list(string) [] no
engine (Optional, defaults 'aurora-postgresql') The database engine to use. Valid values are 'aurora-postgresql' and 'aurora-mysql' string "aurora-postgresql" no
engine_version (Required) The database version to use. Engine version is contingent on instance_class see this list of supported combinations string n/a yes
iam_database_authentication_enabled (Optional, default 'false') Enable IAM database authentication for the RDS cluster. bool false no
instance_class (Optional, default 'db.t3.medium') The type of EC2 instance to run this on. string "db.t3.medium" no
instances (Optional, default '3') The number of RDS Cluster instances to create, defaults to HA mode. number 3 no
name (Required) The name of the db also used for other identifiers string n/a yes
password (Required) The password for the admin user for the db string n/a yes
performance_insights_enabled (Optional, default 'true') This flag enables performance insights for the RDS cluster instances. bool true no
preferred_backup_window (Required) The time you want your DB to be backedup. Takes the format "07:00-09:00" string n/a yes
preferred_maintenance_window (Optional) The UTC time you want your DB to be maintained. Takes the format "wed:06:00-wed:07:00" string "sun:06:00-sun:07:00" no
prevent_cluster_deletion (Optional, default 'true') This flag prevents deletion of the RDS cluster.
Please Note: We cannot prevent deletion of RDS instances in the module, we recommend you add lifecycle { prevent_deletion = true } to the module to prevent instance deletion
bool true no
proxy_debug_logging (Optional, default 'false') Allows the proxy to log debug information.
Please Note: This will include all sql commands and potential sensitive information
bool false no
proxy_log_retention_in_days (Optional, default '14') The number of days to retain the proxy logs in cloudwatch number 14 no
proxy_secret_auth_arns (Optional, default none) A list of secret ARNs that contain authentication credentials for the proxy. View the aws_secretsmanager_secret_version.connection_string resource for the secret format. Note that these must be database users that already exist. list(string) [] no
security_group_ids (Optional, default '[]') A list of additional security group IDs to associate with the RDS cluster. list(string) [] no
security_group_notifications_topic_arn (Optional) The SNS topic ARN to send notifications about security group changes to. string "" no
serverless_max_capacity (Optional) The maximum capacity of the Aurora serverless cluster (0.5 to 128 in increments of 0.5) number 0 no
serverless_min_capacity (Optional) The minimum capacity of the Aurora serverless cluster (0.5 to 128 in increments of 0.5) number 0 no
skip_final_snapshot (Optional, default 'false') This flag determines if a final database snapshot it taken before the cluster is deleted. bool false no
snapshot_identifier (Optional, no default) The name or ARN of the DB cluster snapshot to create the cluster from. string null no
subnet_ids (Required) The name of the subnet the DB has to stay in set(string) n/a yes
upgrade_immediately (Optional, default false) Apply database engine upgrades immediately. bool false no
use_proxy (Optional, default 'true') This flag determines if an RDS proxy should be created for the cluster. bool true no
username (Required) The username for the admin user for the db string n/a yes
vpc_id (Required) The vpc to run the cluster and related infrastructure in string n/a yes

Outputs

Name Description
cluster_security_group_arn The RDS cluster security group ID.
cluster_security_group_id The RDS cluster security group ID.
proxy_connection_string_arn The ARN for the connection string to the RDS proxy.
proxy_connection_string_value The string value of the RDS proxy connection string. This includes the username and password.
proxy_endpoint The RDS proxy read/write connection endpoint.
proxy_security_group_arn The RDS proxy security group ARN.
proxy_security_group_id The RDS proxy security group ID.
rds_cluster_arn The ARN of the RDS cluster.
rds_cluster_endpoint RDS cluster read/write connection endpoint.
rds_cluster_id The ID of the RDS cluster.