upjet
upjet copied to clipboard
add json encoded debug logging of diff detected instead of GoString to ensure readability
Description of your changes
This change will provide debug logging in json format instead of go string. This will help when debugging why changes are not affected as this may be the only way you can figure out the different quirks of the cloud provider APIs.
This will remove type information from the output logs, but it will be parsable.
Fixes #
I have:
- [x] Read and followed Upjet's contribution process.
- [x] Run
make reviewableto ensure this PR is ready for review. - [ ] Added
backport release-x.ylabels to auto-backport this PR if necessary.
How has this code been tested
Printed out the new format during test run.
2025-02-28T17:39:20+01:00 DEBUG provider-aws Diff detected
{"instanceDiff": "{\"attributes\":
{\"name\":
{\"Old\":\"example2\",
\"New\":\"example\",
\"NewComputed\":false,
\"NewRemoved\":false,
\"NewExtra\":null,
\"RequiresNew\":false,
\"Sensitive\":false,
\"Type\":0}},
\"destroy\":false,
\"destroyTainted\":false,
\"destroyDeposed\":false}"}
2025-02-28T17:40:28+01:00 DEBUG provider-aws Diff detected
{"instanceDiff": "*terraform.InstanceDiff{mu:sync.Mutex{state:0, sema:0x0}, Attributes:map[string]*terraform.ResourceAttrDiff{
\"name\":*terraform.ResourceAttrDiff{
Old:\"example2\", New:\"example\",
NewComputed:false, NewRemoved:false,
NewExtra:interface {}(nil), RequiresNew:false,
Sensitive:false, Type:0x0}}, Destroy:false,
DestroyDeposed:false, DestroyTainted:false,
RawConfig:cty.NilVal, RawState:cty.NilVal,
RawPlan:cty.NilVal, Meta:map[string]interface {}(nil)}"}
@larhauga can you update this PR based on the feedback on needing an else clause?
@larhauga can you update this PR based on the feedback on needing an else clause?
Sorry for the delay! Added the else clause now :)