You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After the first destroy I get the error: could not delete role role_name: pq: role "role_name" cannot be dropped because some objects depend on it
However, the terragrunt/terraform output of the first execution says that the postgresql_default_privileges resource has been successfully destroyed: postgresql_default_privileges.airflow_ro: Destruction complete after 5s
Actually the second attempt just destroy postgresql_role.airflow_ro, that was the only resource left by the first attempt.
Steps to Reproduce
Create a deployment with a postgresql_role and postgresql_default_privileges that assigns some default privileges to the role.
Destroy the deployment
Important Factoids
We only use terraform with terragrunt.
The text was updated successfully, but these errors were encountered:
Sorry for the late reply, if you still have this issue, it's not a provider bug but you simply need to configure dependencies between resources correctly in your code.
In your code example, you provide role name in postgresql_default_privileges directly with the variable where you should actually reference the postgresql_role resource instead (same for database, owner, etc...) , e.g.:
Thanks to that, Terraform will now that your postgresql_default_privileges depends on the other resources and will destroy it before trying to destroy the roles & database.
Also, you don't need to define the depends_on for the database anymore.
I allow myself to close this issue but feel free to open it back if needed.
Hi there,
I added default privileges on a schema for a specific role.
Now I need to execute
terragrunt destroy
twice to really destroy the deployment.Thanks,
Nicola
Terraform Version
1.6.5
Affected Resource(s)
Terraform Configuration Files
Expected Behavior
First
terragrunt destroy
successfulActual Behavior
After the first destroy I get the error:
could not delete role role_name: pq: role "role_name" cannot be dropped because some objects depend on it
However, the terragrunt/terraform output of the first execution says that the
postgresql_default_privileges
resource has been successfully destroyed:postgresql_default_privileges.airflow_ro: Destruction complete after 5s
Actually the second attempt just destroy
postgresql_role.airflow_ro
, that was the only resource left by the first attempt.Steps to Reproduce
postgresql_role
andpostgresql_default_privileges
that assigns some default privileges to the role.Important Factoids
We only use terraform with terragrunt.
The text was updated successfully, but these errors were encountered: