I am trying to create a read replica of an rds database in a different region via terraform. I am able to achieve via the AWS console, however when applying through Terraform (0.14.10) the apply fails with the following:
Error: Error creating DB Instance: InvalidParameterCombination: The DB instance and EC2 security group are in different VPCs. The DB instance is in vpc-xxx and the EC2 security group is in vpc-yyy
TF block:
resource "aws_db_instance" "replica" {
count = var.enable_peering_read_replica ? 1 : 0
name = db-replica
identifier = db-replica
replicate_source_db = source-db
instance_class = "db.t3.small"
apply_immediately = true
publicly_accessible = false
skip_final_snapshot = true
vpc_security_group_ids = [aws_security_group.peering_sg.id]
}
For the replicate_source_db I have used the arn and the db name, but still get the same error.