Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not destroy a db [Error: Cycle: aws_rds_cluster_instance] #505

Open
xzGithu opened this issue Jan 15, 2025 · 0 comments
Open

Can not destroy a db [Error: Cycle: aws_rds_cluster_instance] #505

xzGithu opened this issue Jan 15, 2025 · 0 comments

Comments

@xzGithu
Copy link

xzGithu commented Jan 15, 2025

Terraform Version

Run terraform -v to show the version. If you are not running the latest version of Terraform, please upgrade because your issue may have already been fixed.

terraform 1.1.5

provider version

postgresql = {
source = "cyrilgdn/postgresql"
version = "~> 1.20.0"
}

terraform code

provider "postgresql" {
host = aws_rds_cluster_instance.rio-dev[0].endpoint
username = var.rds_master_username
password = var.rds_master_password

}

resource "postgresql_database" "rio_dbs" {
for_each = toset( var.rds_application_database_names )
name = each.key
owner = var.rds_master_username
}

I set the rds_application_database_names to ['a','b','c'] and the 3 db created, but when I update the variable to ['a','b'] and run the terraform again , I came into such issue
│ Error: Cycle: aws_rds_cluster_instance.rio-dev[0], provider"[registry.terraform.io/cyrilgdn/postgresql"], postgresql_database.rio_dbs["c"] (destroy)

expected result

the db c is destroyed

@xzGithu xzGithu changed the title Can not destroy a db Can not destroy a db [Error: Cycle: aws_rds_cluster_instance] Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant