Skip to content

terraform init log timestamps include millisecond precision#37818

Merged
SarahFrench merged 2 commits intohashicorp:mainfrom
Emyrk:stevenmasley/log_ms_precision
Nov 21, 2025
Merged

terraform init log timestamps include millisecond precision#37818
SarahFrench merged 2 commits intohashicorp:mainfrom
Emyrk:stevenmasley/log_ms_precision

Conversation

@Emyrk
Copy link
Copy Markdown
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
Copy Markdown

hashicorp-cla-app bot commented Oct 27, 2025

CLA assistant check
All committers have signed the CLA.

@hashicorp-cla-app
Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

Emyrk commented Nov 21, 2025

@SarahFrench thank you!

@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 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants