Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

#26677
Merged
jeremyruppel merged 4 commits into
maincoder/coder:mainfrom
jeremy/devex-521-template-import-errorscoder/coder:jeremy/devex-521-template-import-errorsCopy head branch name to clipboard
Jun 30, 2026
Merged

fix(coderd/templatebuilder): include Terraform diagnostics in import errors#26677
jeremyruppel merged 4 commits into
maincoder/coder:mainfrom
jeremy/devex-521-template-import-errorscoder/coder:jeremy/devex-521-template-import-errorsCopy head branch name to clipboard

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

jeremyruppel commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

@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
@jeremyruppel
jeremyruppel force-pushed the jeremy/devex-515-base-templates branch from 38795e9 to 5ca0705 Compare June 30, 2026 19:29
@jeremyruppel
jeremyruppel force-pushed the jeremy/devex-521-template-import-errors branch from bbc290a to 3b2b878 Compare June 30, 2026 19:29
@jeremyruppel
jeremyruppel force-pushed the jeremy/devex-515-base-templates branch from 5ca0705 to a8c63d6 Compare June 30, 2026 21:53
@jeremyruppel
jeremyruppel force-pushed the jeremy/devex-521-template-import-errors branch 2 times, most recently from 2ecbb7b to 8a1ba0d Compare June 30, 2026 22:01
@jeremyruppel
jeremyruppel force-pushed the jeremy/devex-515-base-templates branch from 516a437 to 825db41 Compare June 30, 2026 22:09
@jeremyruppel
jeremyruppel force-pushed the jeremy/devex-521-template-import-errors branch from 8a1ba0d to 1b9b138 Compare June 30, 2026 22:10

@code-asher code-asher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Too bad we have to sniff strings but it is what it is.

Comment thread coderd/templatebuilder/errors.go Outdated
Base automatically changed from jeremy/devex-515-base-templates to main June 30, 2026 22:26
…providers

Add 7 new base templates to the template builder:
- scratch: minimal starter template (coder_agent only)
- aws-windows: AWS EC2 Windows instances
- azure-linux: Azure VMs with cloud-init and managed disk
- azure-windows: Azure Windows VMs with RDP support
- gcp-linux: Google Compute Engine Linux instances
- gcp-windows: Google Compute Engine Windows instances
- digitalocean-linux: DigitalOcean Linux droplets

Each base includes a manifest (base.json), Go template (main.tf.tmpl),
README with prerequisite markers, and any static files (cloud-init
configs, PowerShell scripts). Tests verify all bases load, render, and
produce valid coder_agent declarations.
…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 1b9b138 to 1f3b8f1 Compare June 30, 2026 22:27
@jeremyruppel
jeremyruppel merged commit a48ace5 into main Jun 30, 2026
29 of 30 checks passed
@jeremyruppel
jeremyruppel deleted the jeremy/devex-521-template-import-errors branch June 30, 2026 22:44
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 30, 2026
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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.