Skip to content

Make the JSON view for init commands use defaults from the hclog package#37840

Merged
SarahFrench merged 4 commits intomainfrom
sarah/make-init-json-output-use-defaults
Nov 24, 2025
Merged

Make the JSON view for init commands use defaults from the hclog package#37840
SarahFrench merged 4 commits intomainfrom
sarah/make-init-json-output-use-defaults

Conversation

@SarahFrench
Copy link
Copy Markdown
Member

@SarahFrench SarahFrench commented Oct 29, 2025

Related to #37818

The logs from init include timestamps in format time.RFC3339 while other JSON logs use hclog.TimeFormat format.

This discrepancy is due to the logging implementation in #34886 avoiding hclog and instead printing a JSON string to the view's streams. If hclog was used directly then the calling code would not need to set a value for the timestamp and influence its format.

We can't get context from participants in the original PR to know why printing a JSON string was chosen and what limitations that might have been attempting to overcome. This PR assumes that there weren't any limitations and it was just unfamiliarity with hclog, which may or may not be true.

Regardless of why logging was implemented like that, making a change in the timestamp format may affect any systems consuming the logs, and at a minimum would require:

  • Checking that there's no breaking change in HCP Terraform.
  • Checking for required updates to terraform-exec and terraform-json.

These concerns have been addressed, see #37818 (comment)

Target Release

1.15.x

Rollback Plan

  • If a change needs to be reverted, we will roll out an update to the code within 7 days.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

CHANGELOG entry

  • This change is user-facing and I added a changelog entry.
  • This change is not user-facing.

@SarahFrench SarahFrench force-pushed the sarah/make-init-json-output-use-defaults branch 2 times, most recently from ed34b97 to 113c455 Compare October 30, 2025 09:27
@SarahFrench SarahFrench added the no-changelog-needed Add this to your PR if the change does not require a changelog entry label Nov 21, 2025
@SarahFrench SarahFrench marked this pull request as ready for review November 21, 2025 19:25
@SarahFrench SarahFrench requested a review from a team as a code owner November 21, 2025 19:25
@SarahFrench SarahFrench requested a review from a team November 21, 2025 19:25
@SarahFrench SarahFrench enabled auto-merge (squash) November 21, 2025 19:27
@SarahFrench SarahFrench force-pushed the sarah/make-init-json-output-use-defaults branch 2 times, most recently from 519dfbb to 27e0fd6 Compare November 21, 2025 19:29
Copy link
Copy Markdown
Contributor

@mildwonkey mildwonkey left a comment

Choose a reason for hiding this comment

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

👍🏻 really nice investigative / proof-of-non-breakage work associated with this!

@SarahFrench SarahFrench merged commit 1a54777 into main Nov 24, 2025
9 checks passed
@SarahFrench SarahFrench deleted the sarah/make-init-json-output-use-defaults branch November 24, 2025 13:21
@github-actions
Copy link
Copy Markdown
Contributor

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

no-changelog-needed Add this to your PR if the change does not require a changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants