Skip to content

fix(coderd/templatebuilder): include Terraform diagnostics in import errors#26677

Open
jeremyruppel wants to merge 1 commit into
jeremy/devex-515-base-templatesfrom
jeremy/devex-521-template-import-errors
Open

fix(coderd/templatebuilder): include Terraform diagnostics in import errors#26677
jeremyruppel wants to merge 1 commit into
jeremy/devex-515-base-templatesfrom
jeremy/devex-521-template-import-errors

Conversation

@jeremyruppel

@jeremyruppel jeremyruppel commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

ClassifyProvisionerError previously returned only the raw job error string (e.g. "terraform plan: exit status 1") for unrecognized failures, discarding the provisioner log lines it already had. This made template import errors in the builder unactionable.

Now the function extracts Terraform diagnostic blocks (Error:/Warning: lines and their context) from the provisioner logs and appends them to the error detail. This surfaces the actual failure cause (missing credentials, invalid references, unsupported blocks) in the ErrorAlert banner.

Changes:

  • extractDiagnostics parses Terraform diagnostic blocks from log output, capped at 20 lines with a truncation marker
  • Auth error classification for AWS, GCP, Azure credential failures with a targeted user-facing message
  • Case-insensitive pattern matching via strings.ToLower on the combined text
  • Auth branch guarded against empty diagnostics (no trailing \n\n)

Note

This PR was authored by Coder Agents on behalf of @jeremyruppel.

@linear-code

linear-code Bot commented Jun 24, 2026

Copy link
Copy Markdown

DEVEX-521

@github-actions

Copy link
Copy Markdown

Docs preview

📖 View docs preview for docs/admin/integrations/prometheus.md

@jeremyruppel jeremyruppel changed the title fix(enterprise/coderd): propagate license events over Postgres pubsub when NATS is in use (#26536) fix(coderd/templatebuilder): include Terraform diagnostics in import errors Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

…errors

ClassifyProvisionerError previously returned only the raw job error
string (e.g. "terraform plan: exit status 1") for unrecognized failures,
discarding the provisioner log lines it already had. This made template
import errors in the builder unactionable.

Now the function extracts Terraform diagnostic blocks (Error:/Warning:
lines and their context) from the provisioner logs and appends them to
the error detail. This surfaces the actual failure cause (missing
credentials, invalid references, unsupported blocks) in the ErrorAlert
banner without requiring a separate log viewer.

Also adds classification for cloud provider authentication failures
(AWS, GCP, Azure credential errors) with a targeted user-facing message.
@jeremyruppel jeremyruppel force-pushed the jeremy/devex-521-template-import-errors branch from 882c19d to bbc290a Compare June 24, 2026 19:23
@jeremyruppel jeremyruppel force-pushed the jeremy/devex-515-base-templates branch from 6e0d67e to 38795e9 Compare June 24, 2026 19:23
@jeremyruppel jeremyruppel marked this pull request as ready for review June 24, 2026 20:02
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.

1 participant