-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Retrieving Output for Failed Executions of Terraform #1120
Comments
Hi, https://github.com/gruntwork-io/terratest/blob/master/modules/terraform/cmd.go#L68 |
Hi @denis256 yes that would be a possibility, I have realised that actually if we do use |
Ok, now I have realised what is the issue with the use of the approach you have proposed. A common test case may be that we execute
We can rewrite in our testing logic the implementation of: terratest/modules/terraform/cmd.go Line 100 in 4694196
This may not be very good over time as we depend on the internal implementation of the method. I would imagine that having the ability to get back both the exit code and the stdout/stderr (perhaps as two separate strings) would a generally useful feature. |
Would it be possible to return the output (string format) when a terraform execution fails?
It seems that the internal method of terratest/terraform already have access to it, but they simply strip it away here:
terratest/modules/terraform/cmd.go
Line 105 in 4694196
Since terraform returns always 1 as error code for validation errors, it would be helpful to access the output stream to verify the cause of the error. At the moment executing a
tf plan
with errors (variable validation or other error during plan phase) provides an opaque value (=1) that will not enable the caller to verify what is the exact cause of the failure.The text was updated successfully, but these errors were encountered: