-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Description
This issue was originally opened by @silviabotros as hashicorp/terraform#19524. It was migrated here as a result of the provider split. The original body of the issue is below.
Terraform Version
Terraform v0.11.10
Terraform Configuration Files
module "rds-cluster-vpc-1" {
source = "../../modules/rds_cluster"
name = "${var.db_name}-rds-cluster-${var.user}"
user = "${var.user}"
availability_zones = ["${data.aws_availability_zones.vpc-1-azs.names[0]}",
"${data.aws_availability_zones.vpc-1-azs.names[1]}",
"${data.aws_availability_zones.vpc-1-azs.names[2]}"
]
rds_final_snapshot_id = "${var.db_name}-final-snapshot-${var.user}"
skip_final_rds_snapshot = true
vpc_id = "${module.vpc-1.vpc_id}"
aws_subnet_ids = ["${module.vpc-1.database_subnets}"]
rds_access_sg = ["${module.vpc-1-jump.security_group_id}"]
providers = {
"aws" = "aws.us-east-1"
}
db_name = "${var.db_name}"
rds_admin_user = "${var.rds_admin_user}"
rds_admin_password = "${var.rds_admin_password}"
port = "${var.port}"
tags = "${local.tags}"
}
module "rds-cluster-vpc-2" {
source = "../../modules/rds_cluster"
name = "${var.db_name}-rds-cluster-${var.user}"
user = "${var.user}"
availability_zones = ["${data.aws_availability_zones.vpc-2-azs.names[0]}",
"${data.aws_availability_zones.vpc-2-azs.names[1]}",
"${data.aws_availability_zones.vpc-2-azs.names[2]}"
]
replication_source_identifier = "${module.rds-cluster-vpc-1.rds_cluster_arn}"
rds_final_snapshot_id = "${var.db_name}-final-snapshot-${var.user}"
skip_final_rds_snapshot = true
vpc_id = "${module.vpc-2.vpc_id}"
aws_subnet_ids = ["${module.vpc-2.database_subnets}"]
rds_access_sg = ["${module.vpc-2-jump.security_group_id}"]
providers = {
"aws" = "aws.us-west-2"
}
db_name = "${var.db_name}"
rds_admin_user = "${var.rds_admin_user}"
rds_admin_password = "${var.rds_admin_password}"
port = "${var.port}"
tags = "${local.tags}"
}
Expected Behavior
Terraform creates primary cluster then the second cluster, using the first one ARN as the replication_source_identifier
Actual Behavior
[2018-11-30T17:29:14Z] * aws_rds_cluster.rds_cluster: error creating RDS cluster: InvalidDBClusterStateFault: Source cluster arn:aws:rds:us-east-1:224182330776:cluster:rdstest-cluster-dev doesn't have a writer instance
[2018-11-30T17:29:14Z] status code: 400, request id: c8e34d9a-d287-496a-9f02-3ca6037a6c80
[2018-11-30T17:29:14Z]
Steps to Reproduce
Create a module that creates an aurora cluster then tries to use its ARN as the replication_source_identifier in a second one
Additional Context
I am creating this to be a reuseable module for my teams to out of the box get an Aurora cluster with a cross region replica cluster. Ideally, I'd like it all to work within terraform but as it behaves now I have to wrap it in a shell script that does phased, separate apply phases as it seems that AWS marks the replication_source_identifier ARN 'ready' before it has an assigned writer OR is inappropriately sending back that state fault when the writer is actually there and available.