-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed
Labels
bugAddresses a defect in current functionality.Addresses a defect in current functionality.service/rdsIssues and PRs that pertain to the rds service.Issues and PRs that pertain to the rds service.
Milestone
Description
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Terraform Version
Terraform v0.11.10
+ provider.aws v1.50.0
Affected Resource(s)
*provider.aws v1.50.0
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}"
sox_compliant = "${var.sox_compliant}"
}
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}"
sox_compliant = "${var.sox_compliant}"
}
Expected Behavior
Running terraofrm destroy
should destroy everything including both RDS clusters and their VPCs
Actual Behavior
Destroy works on the primary cluster but fails on the secondary cluster
Do you really want to destroy all resources?
Terraform will destroy all your managed infrastructure, as shown above.
There is no undo. Only 'yes' will be accepted to confirm.
Enter a value: yes
module.rds-cluster-vpc-2.aws_rds_cluster_instance.rds_cluster_instance[2]: Destroying... (ID: rdstest-2-dev)
Releasing state lock. This may take a few moments...
Error: Error applying plan:
3 error(s) occurred:
* module.vpc-1-jump.output.public_ip: element: element() may not be used with an empty list in:
${var.create == false ? "" : element(aws_instance.jumpbox.*.public_ip,0)}
* module.vpc-2-jump.output.public_ip: element: element() may not be used with an empty list in:
${var.create == false ? "" : element(aws_instance.jumpbox.*.public_ip,0)}
* module.rds-cluster-vpc-2.aws_rds_cluster_instance.rds_cluster_instance[2] (destroy): 1 error(s) occurred:
* aws_rds_cluster_instance.rds_cluster_instance.2: InvalidDBClusterStateFault: Cannot delete the last instance of the read replica DB cluster. Promote the DB cluster to a standalone DB cluster in order to delete it.
status code: 400, request id: 456e5bf2-656a-4e22-84d7-49565db5976c
Steps to Reproduce
terraform apply
terraform destroy
References
See #6672 for a related issue regarding trying to terraform cross region aurora replica clusters.
tekbuddha, sandroacoelho, Nitika-Saini, SathyaBhat, ryno75 and 22 more
Metadata
Metadata
Assignees
Labels
bugAddresses a defect in current functionality.Addresses a defect in current functionality.service/rdsIssues and PRs that pertain to the rds service.Issues and PRs that pertain to the rds service.