Skip to content

Conversation

@Emyrk
Copy link
Contributor

@Emyrk Emyrk commented Oct 27, 2025

Terraform init json logs to include millisecond precision. Following the trend of other logs.

Example output:

{"@level":"info","@message":"Terraform 1.13.3","@module":"terraform.ui","@timestamp":"2025-10-27T12:48:29.576675-05:00","terraform":"1.13.3","type":"version","ui":"1.2"}
{"@level":"info","@message":"Initializing the backend...","@module":"terraform.ui","@timestamp":"2025-10-27T17:48:29Z","message_code":"initializing_backend_message","type":"init_output"}

The timestamps for init_output omit milliseconds.

Target Release

1.15.x

CHANGELOG entry

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

Terraform init json logs omit millisecond precision included in
other logs
@hashicorp-cla-app
Copy link

hashicorp-cla-app bot commented Oct 27, 2025

CLA assistant check
All committers have signed the CLA.

@hashicorp-cla-app
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.

@Emyrk Emyrk marked this pull request as ready for review October 27, 2025 18:27
@Emyrk Emyrk requested a review from a team as a code owner October 27, 2025 18:27
Emyrk added a commit to coder/coder that referenced this pull request Oct 28, 2025
This uses the `terraform init -json` logs to add more visibility into
the `init` phase of `plan`. The `init` logs omit `ms` precision, so we
have to use `time.Now()` 😢

Open TF PR: hashicorp/terraform#37818
@SarahFrench
Copy link
Member

Hi @Emyrk, thank you for identifying this inconsistency and proposing a fix! I'm asking around internally about whether this would be a breaking change for our systems that consume these logs, and once I know more I'll report back.

@Emyrk
Copy link
Contributor Author

Emyrk commented Oct 31, 2025

Hi @Emyrk, thank you for identifying this inconsistency and proposing a fix! I'm asking around internally about whether this would be a breaking change for our systems that consume these logs, and once I know more I'll report back.

Thank you! Feel free to take over this PR or open a new one. These are logs I was attempting to use, but without the ms precision, the value was removed. Since many init operations take <1s.

@SarahFrench
Copy link
Member

Thanks for bearing with me on this! Given the tests here and some internal conversations with people who work on HCP Terraform I'm happy to go ahead and merge this. Thanks again 🚀

@SarahFrench SarahFrench enabled auto-merge (squash) November 21, 2025 19:20
@SarahFrench SarahFrench merged commit 3df28c3 into hashicorp:main Nov 21, 2025
15 checks passed
SarahFrench pushed a commit that referenced this pull request Nov 21, 2025
…ecision (#37818)

* fix: terraform init log timestamps include millisecond precision

* docs: add changelog entry
@Emyrk
Copy link
Contributor Author

Emyrk commented Nov 21, 2025

@SarahFrench thank you!

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.

2 participants