terraform-provider-keycloak icon indicating copy to clipboard operation
terraform-provider-keycloak copied to clipboard

[authz] TF destroy does not work when scope was associated to resources

Open semangard opened this issue 3 years ago • 2 comments

Hello,

a TF destroy raises the following error :


Error: error sending DELETE request to /auth/admin/realms/demo-uma/clients/1b73db47-8694-40fb-a4aa-c6e415db8782/authz/resource-server/scope/f393e83d-119d-4635-9834-e7fcaeb998f4: 400 Bad Request. Response body: {"errorMessage":"Scopes can not be removed while associated with resources."}

Error: error sending DELETE request to /auth/admin/realms/demo-uma/clients/1b73db47-8694-40fb-a4aa-c6e415db8782/authz/resource-server/scope/115016ea-b9eb-4dfe-9fba-21dc0ae1f213: 400 Bad Request. Response body: {"errorMessage":"Scopes can not be removed while associated with resources."}

It looks like the relationship between Authz scopes and Authz ressources is not deleted before deleting the TF ressources thenselves.

semangard avatar Oct 29 '20 13:10 semangard

Workarround was to execute F destroy twice.

semangard avatar Oct 29 '20 13:10 semangard

Could you provide me with some sample HCL that reproduces this?

mrparkers avatar Oct 30 '20 16:10 mrparkers