Skip to content

add json encoded debug logging of diff detected instead of GoString to ensure readability - #474

Open
larhauga wants to merge 1 commit into
crossplane:mainfrom
larhauga:diff-jsonlog
Open

add json encoded debug logging of diff detected instead of GoString to ensure readability#474
larhauga wants to merge 1 commit into
crossplane:mainfrom
larhauga:diff-jsonlog

Conversation

@larhauga

@larhauga larhauga commented Feb 28, 2025

Copy link
Copy Markdown

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:

  • Read and followed Upjet's contribution process.
  • Run make reviewable to ensure this PR is ready for review.
  • Added backport release-x.y labels 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)}"}

@mbbush mbbush left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be a very welcome improvement. Thanks!

Comment thread pkg/controller/external_tfpluginsdk.go Outdated
@stevendborrelli

Copy link
Copy Markdown
Member

@larhauga can you update this PR based on the feedback on needing an else clause?

…o ensure readability

Signed-off-by: Lars Haugan <lars.haugan@sparebank1.no>
@larhauga

Copy link
Copy Markdown
Author

@larhauga can you update this PR based on the feedback on needing an else clause?

Sorry for the delay! Added the else clause now :)

@larhauga
larhauga requested a review from mbbush June 20, 2025 05:23
@jeanduplessis jeanduplessis reopened this Aug 20, 2025
@jonasz-lasut

jonasz-lasut commented Jan 17, 2026

Copy link
Copy Markdown
Collaborator

Are there any blockers to have this feature merged? Would be really useful to have when debugging issues related to upjet-based providers

@Upbound-CLA

Upbound-CLA commented Apr 30, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@Upbound-CLA

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@jonasz-lasut

Copy link
Copy Markdown
Collaborator

Hi @larhauga could you sign the Upbound CLA so we can proceed with this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants