This repository was archived by the owner on Jun 17, 2024. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork33
[WIP] Suppress diff forconfiguration
items in case they are not set#66
Open
marratj wants to merge3 commits intovmware-archive:mainChoose a base branch fromgfkse:marratj-suppress-diff-for-resource-configuration
base:main
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
Open
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
configuration
items in case they are not setconfiguration
items in case they are not setOne thing I currently have in the However, that would mean for certain configurations where one would want to intentionally change a custom property from a set value to an empty value that this would also not produce a diff and therefore not trigger a change. Any ideas on how to handle those cases? |
@Prativa20 any thoughts on this? |
Signed-off-by: Marcel Juhnke <marcel.juhnke@gfk.com>
ebe9ec2
tocedb1fe
CompareSign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading.Please reload this page.
When there is a Deployment with resource configurations for VMs that contain more or different custom properties within the
configuration
map, each time whenterraform plan
is run, there is a diff produced that completely removes theconfiguration
block withinresource_configuration
and adds a new one with only the values provided in thevra7_deployment
TF resource.This seems to be because
resource_configuration
is aTypeSet
in the Resource Schema.That means, each time the hash calculated from the settings in the state is not identical to the one in the resource config, Terraform treats it as a different
resource_configuration
and wants to remove the existing block from the state and put in only the values in the config.For this, I propose to change this to
TypeList
. However, this would depend on the vRA7 API returning thecontent[]
in theResourceView
response always in the same order (which I'm not 100 % sure of right now).After changing the Type to List, we also add a
DiffSuppressFunc
to theconfiguration
Element that checks if a custom property from the state needs to be included in the diff.If it set in the state, but NOT in the resource config, we ignore the diff. This is because often there are quite a lot of custom properties returned for a VM that are set on vRA side and are not of interest to the resource configuration in the first place.
Aims tofix#56