mrparkers / terraform-provider-keycloak

Terraform provider for Keycloak
https://registry.terraform.io/providers/mrparkers/keycloak/latest/docs
MIT License
607 stars 295 forks source link

fix: avoid validation errors during plan for missing realm and openid client resources #841

Closed kherock closed 1 year ago

kherock commented 1 year ago

Fixes #738

This brings the 404 handling of missing OpenID clients in line with the implementation for missing SAML clients when resolving client scopes. Basically, the validation of the 404 response was occurring too early, and the read context was throwing instead of return a blank ID via the handleNotFound handler.

This also includes a similar fix for generic_role_mapper resources.

The way that I tested these fixes was to configure a realm using these resource types, and run terraform refresh after manually deleting the realm.

kherock commented 1 year ago

I don't think I can fix the test error showing in CI without splitting the *Reconcile methods into separate create and update functions. Only the create function is supposed to show the expected validation error.

kherock commented 1 year ago

I was able to restore the original message! Would really appreciate a review on this one

kherock commented 1 year ago

@mrparkers sorry to be a bother, but could this be looked at soon?

mrparkers commented 1 year ago

Sorry, I meant to get to this before the latest release, but it slipped my mind.

This LGTM, I'll merge after tests pass and cut a release today.