Repository navigation
feat: add more detailed init timings in build timeline - #20503
Conversation
| // resourceName maps init message codes to human-readable resource names. | ||
| // This is purely for better readability in the timing spans. | ||
| resourceName = map[initMessageCode]string{ | ||
| initInitializingBackendMessage: "Backend", |
There was a problem hiding this comment.
Can you stick to the existing naming convention which is all lowercase?
Also I think we need to be more explicit about the stages. What does "Backend" mean?
There was a problem hiding this comment.
Made it lowercase 👍
I agree backend is an unfortunate name, but it is the proper TF term.
https://developer.hashicorp.com/terraform/language/backend
For Coder, backend means the tfstate file. That is it.
This timing would likely be longer if you were using an aws s3 backend for instance.
There was a problem hiding this comment.
I want to spend time on the build timeline in the UI more. I would like it to also go 1 more hierarchical depth.
Will defer to future work on that though
| // The combination of resource and provider names MUST be unique across entries. | ||
| func (e *timingSpan) hashByState(state proto.TimingState) uint64 { | ||
| id := fmt.Sprintf("%s:%s:%s:%s:%s", e.kind.Category(), state.String(), e.action, e.resource, e.provider) | ||
| if e.messageCode != "" { |
There was a problem hiding this comment.
Nit: we probably need to make this a slice and join with the delimiter.
| var ( | ||
| version170 = version.Must(version.NewVersion("1.7.0")) | ||
| version190 = version.Must(version.NewVersion("1.9.0")) | ||
| ) |
There was a problem hiding this comment.
Terraform versions below 1.12 are already EOL. We also bundle Terraform in the official image. We may not need to worry about supporting older versions.
https://endoflife.date/terraform
There was a problem hiding this comment.
We should update our minimum supported then.

What this does
This uses the
terraform init -jsonlogs to add more visibility into theinitphase ofplan. Theinitlogs omitmsprecision, so we have to usetime.Now()😢Open TF PR: hashicorp/terraform#37818
Screencast.From.2025-10-27.12-38-33.webm
Follow up will be to add more details to
modulesandprovidersto single out each module/provider loaded.