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

Avoiding validation error: client with id <id> does not exist in keycloak_openid_client_default_scopes #738

Closed
kherock opened this issue Sep 23, 2022 · 1 comment · Fixed by #841

Comments

@kherock
Copy link
Contributor

kherock commented Sep 23, 2022

Hi, I have a sandbox environment that allows a mix of clients managed by terraform and some manually provisioned resources. Occasionally, a client managed by Terraform gets deleted accidentally. Typically, Terraform will figure out that a resource was deleted while refreshing the state and offer to recreate it. However, for the keycloak_openid_client_default_scopes and keycloak_openid_client_optional_scopes resources, the missing client causes validation to fail during plan:

╷
│ Error: validation error: client with id <internal id> does not exist
│ 
│   with keycloak_openid_client_default_scopes.my_client,
│   on main.tf line 27, in resource "keycloak_openid_client_default_scopes" "my_client":
│   27: resource "keycloak_openid_client_default_scopes" "my_client" {
│ 

Currently, the workaround is to use terraform state rm on the client scopes before running terraform apply again. Could we update the provider to accept missing state as valid and allow the scope associations to be recreated?

@kherock
Copy link
Contributor Author

kherock commented May 8, 2023

@mrparkers is something that could be fixed in an upcoming release? I'm not super familiar with Go, but it seemed like this has a somewhat simple fix. If I contributed a PR I would need help putting a test case together, if that's needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant