Skip to content
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

Terraform error not correctly displayed when using bbl in debug mode #581

Open
jochenehret opened this issue Jun 6, 2023 · 1 comment
Open

Comments

@jochenehret
Copy link
Contributor

Hi bbl developers,

when we run bbl in debug mode and a Terraform subcommand fails, the output is not correctly formatted. We see a long list of numbers which should be converted into a string. Example:

bbl --debug up --lb-type=cf --lb-cert=/tmp/bbl-cert --lb-key=/tmp/bbl-key (...)

╷
│ Error: attaching policy arn:aws:iam::537913301405:policy/perf-test-rails_bosh_policy to IAM Role perf-test-rails_bosh_role: NoSuchEntity: The role with name perf-test-rails_bosh_role cannot be found.
│ 	status code: 404, request id: 132f6022-c5b9-46b5-a117-2d0c4e0c6ee8
│ 
│   with aws_iam_role_policy_attachment.bosh[0],
│   on bbl-template.tf line 653, in resource "aws_iam_role_policy_attachment" "bosh":
│  653: resource "aws_iam_role_policy_attachment" "bosh" {
│ 
╵
(...)
Executor apply: command execution failed got: exit status 1 stderr:
 &{[%!s(*os.File=&{0xc000118120}) %!s(*bytes.Buffer=&{[10 27 91 48 109 27 91 49 109 73 110 105 116 105 97 108 105 122 105 110 103 32 116 104 101 (...)

I guess that somewhere here a (string) conversion is missing:

return fmt.Errorf("command execution failed got: %s stderr:\n %s", err, c.errorBuffer)

I haven't found a test that provokes an error and validates the output conversion.

Thanks for handling this issue!

@ramonskie
Copy link
Contributor

ramonskie commented Jun 8, 2023

well before it would swallow all errors :)
as noted in this commit b386086
but when i have some time i will take a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Waiting for Changes | Open for Contribution
Development

No branches or pull requests

3 participants