From 3df28c31019d76ac17bcfc5e2ee3304fff58c0fe Mon Sep 17 00:00:00 2001 From: Steven Masley Date: Fri, 21 Nov 2025 13:24:03 -0600 Subject: [PATCH] fix: Make `terraform init` JSON log timestamps include millisecond precision (#37818) * fix: terraform init log timestamps include millisecond precision * docs: add changelog entry --- .changes/v1.15/ENHANCEMENTS-20251027-132238.yaml | 5 +++++ internal/command/views/init.go | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changes/v1.15/ENHANCEMENTS-20251027-132238.yaml diff --git a/.changes/v1.15/ENHANCEMENTS-20251027-132238.yaml b/.changes/v1.15/ENHANCEMENTS-20251027-132238.yaml new file mode 100644 index 0000000000..7c4d0af699 --- /dev/null +++ b/.changes/v1.15/ENHANCEMENTS-20251027-132238.yaml @@ -0,0 +1,5 @@ +kind: ENHANCEMENTS +body: terraform init log timestamps include millisecond precision +time: 2025-10-27T13:22:38.714891768-05:00 +custom: + Issue: "37818" diff --git a/internal/command/views/init.go b/internal/command/views/init.go index 4a633ce69b..5556ef67fc 100644 --- a/internal/command/views/init.go +++ b/internal/command/views/init.go @@ -9,6 +9,7 @@ import ( "strings" "time" + "github.com/hashicorp/go-hclog" "github.com/hashicorp/terraform/internal/command/arguments" "github.com/hashicorp/terraform/internal/tfdiags" ) @@ -97,7 +98,7 @@ func (v *InitJSON) Output(messageCode InitMessageCode, params ...any) { return } - current_timestamp := time.Now().UTC().Format(time.RFC3339) + current_timestamp := time.Now().UTC().Format(hclog.TimeFormat) json_data := map[string]string{ "@level": "info", "@message": preppedMessage,