hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.83k stars 9.17k forks source link

[Enhancement]: Resource `aws_db_instance` support RDS clusters as a replication source #39270

Open michemache opened 1 month ago

michemache commented 1 month ago

Description

The resource aws_db_instance currently only supports DB instances as a replication source with the argument replicate_source_db.

It would be very useful to also have the ability to create a Read Replica instance from an RDS Multi-AZ DB Cluster.

Affected Resource(s) and/or Data Source(s)

Potential Terraform Configuration

resource "aws_rds_cluster" "example" {
  cluster_identifier        = "example"
  availability_zones        = ["us-west-2a", "us-west-2b", "us-west-2c"]
  engine                    = "postgres"
  db_cluster_instance_class = "db.r6gd.xlarge"
  storage_type              = "gp3"
  allocated_storage         = 20
  iops                      = 3000
  master_username           = "test"
  master_password           = "mustbeeightcharaters"
}

resource "aws_db_instance" "read_replica" {
  replicate_source_db_cluster = aws_rds_cluster.example.cluster_identifier
  identifier                  = "read_replica"
  instance_class              = "db.t3.micro"
  ...
}

References

https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_MultiAZDBCluster_ReadRepl.html#multi-az-db-clusters-create-instance-read-replica

Would you like to implement a fix?

None

github-actions[bot] commented 1 month ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue