Skip to content

Conversation

uristernik
Copy link

Fixes #37433

Target Release

1.14.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 actually fixes what is described in the docs https://developer.hashicorp.com/terraform/internals/debugging

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

@uristernik uristernik requested a review from a team as a code owner August 13, 2025 12:33
Copy link

hashicorp-cla-app bot commented Aug 13, 2025

CLA assistant check
All committers have signed the CLA.

Copy link

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes

Have you signed the CLA already but the status is still pending? Recheck it.

@crw crw added the bug label Aug 13, 2025
@crw
Copy link
Contributor

crw commented Aug 15, 2025

Thanks for this submission, I will raise it in triage.

@uristernik
Copy link
Author

@crw any chance we can expedite this? can I help somehow?

@crw
Copy link
Contributor

crw commented Aug 27, 2025

Hi @uristernik, this PR is unlikely (but not impossible) to be reviewed due to making an already complicated situation more complicated. For reference here is an old RFC for provider logging: hashicorp/terraform-plugin-sdk#695, and here is a relevant comment on the PR that implemented TF_LOG=JSON: #27850

my assumption was that we wouldn't make any support guarantees around this at all except that JSON was a valid log level that would output structured logs at a TRACE level. This would make it hard for provider developers to use jq or custom tooling to parse logs, but that wasn't really the intended user experience.

This seems to be the intended implementation. Combining the log format with the log level did not help matters.

That said, I am going to try to get a final answer as to whether this PR would be considered or not, as it may not make things worse, just different.

@uristernik
Copy link
Author

@crw Thanks for taking the time to review this and for considering the request.

To elaborate on our use case: we’ve built a CLI tool similar to the one the PR author mentioned. This tool parses logs and extracts insights, and provider logs are particularly valuable for us since we manage fairly large workspaces. At this scale, we often run into API throttling issues, and with this tool we can profile requests and optimize them more effectively.

Currently, we’re working with log files of around ~800Mi. By leveraging provider logs, we can cut that size down significantly, which makes storage more efficient and profiling much faster.

From my perspective, this PR doesn’t alter existing behavior - it simply extends the expected behavior to all logging subsystems, which I believe was the original intent. This comment seems to support that interpretation: #35298 (comment)

Terraform effectively treats the log level json as meaning “trace but in JSON format”. You can set TF_LOG_CORE=json to get just the Terraform Core logs as “trace but in JSON format”.

Thanks again, LMK what do you think 🙏

@uristernik
Copy link
Author

gentle ping @crw 🙏

@crw
Copy link
Contributor

crw commented Sep 3, 2025

Hi @uristernik, apologies, I do not have an update. I raised this comment to the team, there was a bit of a confluence of interest due to the coincidental revival of this thread: https://discuss.hashicorp.com/t/tf-log-provider-name-does-not-work/39963. However, given the relative close timing to HashiConf deadlines, I would be surprised if this gets picked up for review in the near future. I think it is worth keeping open as this logging conundrum may be revisited later, but I leave it in your hands if you want to keep this open. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provider logs with JSON don't work
2 participants