-
Notifications
You must be signed in to change notification settings - Fork 140
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
Diffs are hard to read #367
Comments
I spent some time looking into this. As far as I can work out this kind of behaviour is not currently possible with the current version of terraform. Since nested blocks map directly to terraform's Set type there identity is based on a hash of all atributes on the object. Some possible solutions to this could be:
e.g:
In the example of backends, really we just want to use a hash of the name for set identity. I did manage to make some changes to the provider code to achieve this, but when that hash is equal terraform treats the plan as a noop, so there clearly would need to be some changes to terraform core to support this.
For now I am using |
Here's a script that can be used to nicely format plan diffs (adapted from https://gist.github.com/Integralist/2b4298d4d287376b8a939c4e9eadd693) #!/bin/bash
terraform plan -out=tfplan > /dev/null 2>&1
CHANGES=$(terraform show -json tfplan | jq '.resource_changes[].change')
diff -u <(echo "$CHANGES" | jq '.before' | sed 's/\\n/\n/g') <(echo "$CHANGES" | jq '.after' | sed 's/\\n/\n/g') |
I have the same problem. Is there a plan to improve it? |
👋🏻 @a-suenami there is a new Hashicorp plugin framework (incompatible with their v2 SDK that the Fastly provider uses) and in the new framework HashiCorp recommend moving away from nested blocks to nested attributes. This would be a breaking interface change for the Fastly provider but it might also be something that helps to improve the diff issue reported here (related: #597). Additionally, there is a new 'map' data type with the new framework that might help the diff issue. |
UPDATE: The new HashiCorp framework's See Integralist/terraform-provider-fastly-framework#7 for details. |
Hello, We are fine with implementing that as a breaking change. If you provide steps how to migrate or we can start re-create our resources. |
Terraform Version
Affected Resource(s)
Expected Behavior
What should have happened?
When making a change to attributes in a
backend
block, or a few lines of a customvcl
I would like to see a diff that explained what changed.e.g.
Actual Behavior
What actually happened?
changing any attribute in a block shows it being replaced. This makes it much harder to review the changes being made to the service by looking at the diff.
The user experiance e.g. when looking at the diff in the fastly web UI is much nicer.
I am not totally sure if this is technically possible, but I don't recall this kind of experiance e.g. when using the AWS provider.
Presumably if the blocks were keyed of their name it would be possible to diff the old and the new block in a more useful way than is currently output.
The text was updated successfully, but these errors were encountered: