This repository has been archived by the owner on Jun 17, 2024. It is now read-only.
[WIP] Suppress diff for configuration
items in case they are not set
#66
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.
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 to fix #56