TF_LOG verbose Terraform output?

How do I get Coder to show verbose Terraform logs? I'm trying to start a workspace but getting one of the Terraform AWS provider's less helpful error messages where it doesn't tell you what IAM action it doesn't have permission to complete:
$ coder start noah -y -v
✔ Queued [410ms]
✔ Setting up [57ms]
⧗ Starting workspace
Terraform 1.1.9
coder_agent.dev: Refreshing state... [id=2eb6446d-0ea6-41f9-97cb-b00927229958]
coder_agent.dev: Refresh complete [id=2eb6446d-0ea6-41f9-97cb-b00927229958]
aws_instance.dev: Refreshing state... [id=i-005de03cc94c5859e]
Error: reading EC2 Instance (i-005de03cc94c5859e): UnauthorizedOperation: You are not authorized to perform this operation.
status code: 403, request id: 4c69c774-0b4e-40e4-858c-3d0b03c58b7b

✔ Starting workspace [6819ms]
✘ Cleaning Up [115ms]
terraform apply: exit status 1
Run 'coder start --help' for usage.
$ coder start noah -y -v
✔ Queued [410ms]
✔ Setting up [57ms]
⧗ Starting workspace
Terraform 1.1.9
coder_agent.dev: Refreshing state... [id=2eb6446d-0ea6-41f9-97cb-b00927229958]
coder_agent.dev: Refresh complete [id=2eb6446d-0ea6-41f9-97cb-b00927229958]
aws_instance.dev: Refreshing state... [id=i-005de03cc94c5859e]
Error: reading EC2 Instance (i-005de03cc94c5859e): UnauthorizedOperation: You are not authorized to perform this operation.
status code: 403, request id: 4c69c774-0b4e-40e4-858c-3d0b03c58b7b

✔ Starting workspace [6819ms]
✘ Cleaning Up [115ms]
terraform apply: exit status 1
Run 'coder start --help' for usage.
When doing normal Terraform development and I run into this I get Terraform's verbose logs and trace the request id in the output to the API request, where I can then see the IAM action. I do this by setting the TF_LOG=1 env var in my shell. How might I do this in Coder?
2 Replies
Turtle Kayak
Turtle KayakOP3y ago
Okay turns out you can just set TF_LOG=1 in the Coder server's environment and it will enable verbose Terraform output
Codercord
Codercord3y ago
Marked the thread as resolved.
Want results from more Discord servers?
Add your server