-
Notifications
You must be signed in to change notification settings - Fork 9.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
allow ignore_changes to reference any map key #26421
Conversation
8e50e42
to
e18a7a1
Compare
Codecov Report
|
e18a7a1
to
87f7c05
Compare
I unfortunately don't have enough time left today for a deep review of this, but just wanted to quickly note that this changes the documented behavior of |
Thank you, I forgot we documented that caveat of the implementation. I'll add the doc changes to his PR too. |
d98f4ed
to
0ecf38b
Compare
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.
👍 the real-world use case for this makes lots of sense to me!
There are situations when a user may want to keep or exclude a map key using `ignore_changes` which may not be listed directly in the configuration. This didn't work previously because the transformation always started off with the configuration, and would never encounter a key if it was only present in the prior value.
We can remove the caveat about changing map elements. Add a little more text about the intended use case for ignore_changes, as the common case of fixing erroneous provider behavior should not be the primary motivation for the maintenance of this feature.
0ecf38b
to
82793f8
Compare
Just rebased in some comment changes which I thought I would help with review. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
This change will allow specifying a
map["key"]
path inignore_changes
that may not exist in the config or the prior value. This allows users to prevent a single map element from changing to or from being unset.This didn't work previously because the transformation always started off with the configuration, and would never encounter a key if it was not present in the configuration. We also couldn't retain the absence of a value, since the lookup wouldn't find the key in the prior value.
The following configuration will now prevent the "unwanted" value from showing up in the plan if it is not originally present in the prior state.
The following example will now prevent the "wanted" value from being removed if it exists the the prior state, but is removed from the configuration
While these examples use map literals for clarity, this feature would normally be used when the map is derived from another source, and not manipulated directly in the resource configuration. This also allows users in some cases to work around misbehaving legacy providers that have altered the state in conflict with the configuration.