terraform-provider-postgresql
terraform-provider-postgresql copied to clipboard
Can not destroy a db [Error: Cycle: aws_rds_cluster_instance]
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