-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
keycloak_user_federation: add module argument that allows excluding bindCredential
from update check
#8898
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @fgruenbauer
Thank you for the contribution! Please add a changelog fragment.
Other than that, it does LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution!
- Set to V(true) to exclude O(config.bindCredential) when comparing the before state with the desired state to | ||
determine wether an update is required. | ||
type: bool | ||
default: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, how about using a string state with two states (choices) instead of a boolean? Then it is possible to later add more options, if for example the API is changed to allow other ways to handle this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, sounds good. I'm not sure about the naming though.
Maybe
bind_credential_handling:
description:
- The value of the config parameter O(config.bindCredential) is redacted in the Keycloak responses. There is currently no way to get the actual value. Comparing the redacted value with the desired value always evaluates to not equal. This also means the before and desired states are never equal if the parameter is set.
- Set to V(exclude_from_update_check) to exclude O(config.bindCredential) when comparing the before state with the desired state to determine whether an update is required.
type: str
default: include_in_update_check
choices:
- include_in_update_check
- exclude_from_update_check
(- get_cleartext_value)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would probably adjust the option name a bit - maybe bind_credential_update_mode
? - and simplify the choices: never
(instead of exclude
), always
(instead of update
). WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the option name, but i'm not sure about never
. So far the PR only removes the parameter from the update check not the actual update. If there are other changes the parameter would still get updated, so never seems kind of misleading i think. We could adjust the PR accordingly though. I think this would also make a bindCredential update more predictable, either do an update or not. Comparing the redacted value is kind of meaningless. If there is a way to get the actual value later we could then add on_change
.
Or maybe skip_check
to exclude from the update check, but still leave it in the update.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, never
isn't the best name. How about only_indirect
? I think it's a bit easier to understand than skip_check
. (I could also be wrong/biased though :) )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, I think we got a winner. I will adjust the PR.
I'll merge the beginning of next week if nobody objects. |
Backport to stable-9: 💚 backport PR created✅ Backport PR branch: Backported as #8999 🤖 @patchback |
@fgruenbauer @russoz thanks! |
…module argument that allows excluding `bindCredential` from update check (#8999) keycloak_user_federation: add module argument that allows excluding `bindCredential` from update check (#8898) * add module argument that allows excluding `bindCredential` from update check * add changelog fragment * change option name to `bind_credential_update_mode` and change type to str (cherry picked from commit 3b109ab) Co-authored-by: fgruenbauer <gruenbauer@b1-systems.de>
…bindCredential` from update check (ansible-collections#8898) * add module argument that allows excluding `bindCredential` from update check * add changelog fragment * change option name to `bind_credential_update_mode` and change type to str
SUMMARY
Keycloak redacts the value of the parameter
bindCredential
(ldap admin password) in its responses, which makes diff and change detection difficult. The desired and the before/existing value can never really be equal unlessbindCredential
is set to**********
or both are not set at all. This leads to the module always making an update if a value is set forbindCredential
. The module might still returnchanged = false
, because after an update the module compares before and after state. In check modechanged
is alwaystrue
but the diff empty, because the parameter is overwritten in the sanitize function.The added module argument would allow users to exclude the
bindCredential
parameter when comparing before and desired state. This would prevent unnecessary updates and check mode always havingchanged = true
.ISSUE TYPE
COMPONENT NAME
keycloak_user_federation
ADDITIONAL INFORMATION
bindCredential
value