Skip to content

chore: dump provisioner logs on error #95

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 16, 2024

Conversation

ethanndickson
Copy link
Member

@ethanndickson ethanndickson commented Sep 12, 2024

Closes #92.

Currently, the logs are only streamed to tflog and not dumped on failure. Now, if the provisioner build fails for any reason, the logs will be included in the final Terraform error, which, unlike tflog, is always shown.

│ Error: Provisioner Error
│ 
│   with coderd_template.sample,
│   on main.tf line 24, in resource "coderd_template" "sample":
│   24: resource "coderd_template" "sample" {
│ 
│ failed to wait for job: provisioner job did not succeed: failed (template
│ import provision for start: terraform plan: exit status 1)
│ 2024-09-12 03:14:05.029Z Initializing the backend...
│ 2024-09-12 03:14:05.029Z Initializing provider plugins...
│ 2024-09-12 03:14:05.029Z - Finding latest version of hashicorp/local...
│ 2024-09-12 03:14:05.687Z - Installing hashicorp/local v2.5.2...
│ 2024-09-12 03:14:05.930Z - Installed hashicorp/local v2.5.2 (signed by HashiCorp)
│ 2024-09-12 03:14:05.930Z Terraform has created a lock file .terraform.lock.hcl to record the provider
│ 2024-09-12 03:14:05.930Z selections it made above. Include this file in your version control repository
│ 2024-09-12 03:14:05.930Z so that Terraform can guarantee to make the same selections by default when
│ 2024-09-12 03:14:05.930Z you run "terraform init" in the future.
│ 2024-09-12 03:14:05.930Z Terraform has been successfully initialized!
│ 2024-09-12 03:14:05.930Z You may now begin working with Terraform. Try running "terraform plan" to see
│ 2024-09-12 03:14:05.930Z any changes that are required for your infrastructure. All Terraform commands
│ 2024-09-12 03:14:05.930Z should now work.
│ 2024-09-12 03:14:05.930Z If you ever set or change modules or backend configuration for Terraform,
│ 2024-09-12 03:14:05.930Z rerun this command to reinitialize your working directory. If you forget, other
│ 2024-09-12 03:14:05.930Z commands will detect it and remind you to do so if necessary.
│ 2024-09-12 03:14:05.963Z Terraform 1.9.2
│ 2024-09-12 03:14:06.026Z Error: Unsupported attribute
│ 2024-09-12 03:14:06.026Z on main.tf line 11, in output "a":
│ 2024-09-12 03:14:06.026Z   11:   value = local_file.a.content.asdf
│ 2024-09-12 03:14:06.026Z Can't access attributes on a primitive-typed value (string).
│ 
╵

Copy link
Member Author

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

Join @ethanndickson and the rest of your teammates on Graphite Graphite

@ethanndickson ethanndickson force-pushed the 09-12-chore_dump_provisioner_logs_on_error branch from 70d992e to b56eae0 Compare September 12, 2024 03:18
@ethanndickson ethanndickson marked this pull request as ready for review September 12, 2024 03:20
@ethanndickson ethanndickson force-pushed the 09-12-chore_dump_provisioner_logs_on_error branch from b56eae0 to 46d1769 Compare September 12, 2024 04:33
@ethanndickson ethanndickson merged commit 09e0394 into main Sep 16, 2024
14 checks passed
@ethanndickson ethanndickson deleted the 09-12-chore_dump_provisioner_logs_on_error branch September 16, 2024 04:22
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.

Improve error handling
2 participants