Closed eMCeee89 closed 3 years ago
One finding regarding the issue:
data
instead of stringData
and you encode values using b64encode filter, then the issue will not appear hence module behaves as expectedSince the k8s module is generic, in check mode it sees that what the user wants is stringData
with content, and what is there is data
with different content, and so it assumes that this is a real change and reports that the resource will change (which should be correct for pretty much any other resource).
We can just special case secrets in check mode here to make it work correctly, we just need to change stringData
to data
and base64 encode the values before running the diff
@eMCeee89 Could you please check if #343 works for you and let us know? Thanks.
needs_info
resolved_by_pr #343
SUMMARY
When k8s module is used for Kubernetes Secret (state=present) with a check_mode enabled, then it always returns changed: True. Without check_mode, the very same manifest returns changed: False. Please note this issue only applies to Secret resource type, ConfigMap resource returns expected results.
ISSUE TYPE
COMPONENT NAME
community.kubernetes.k8s
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
Centos 8.2.2004
STEPS TO REPRODUCE
EXPECTED RESULTS
Having check_mode enabled, it should return empty diff when there is no change to be applied and change result set to False.
ACTUAL RESULTS
When check_mode is enabled, it always returns changed: True result even though there is no change to be applied.