-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
feat: add suppress_stderr argument to hooks #3771
base: main
Are you sure you want to change the base?
Conversation
Given #!/bin/bash
>&1 echo "stdout"
>&2 echo "stderr" then with the following hook: terraform {
after_hook "after_hook" {
commands = ["plan"]
execute = ["./hook.sh"]
run_on_error = true
suppress_stdout = true
suppress_stderr = false
}
} $ go run main.go plan
...
12:21:35.082 INFO Executing hook: after_hook
stderr and with the following hook: terraform {
after_hook "after_hook" {
commands = ["plan"]
execute = ["./hook.sh"]
run_on_error = true
suppress_stdout = true
suppress_stderr = true
}
} $ go run main.go plan
...
12:22:05.338 INFO Executing hook: after_hook |
Hey @paololazzari , Thanks for contributing this. Awesome to see you get engaged in the project! If you don't mind, could you also add tests to confirm that stderr suppression does and doesn't happen when controlled by the new attribute? |
@yhakbar I added a couple of tests. I had to use a shell script to write to stderr. What do you think? |
@paololazzari , running the tests now. Thanks for adding those! The more recent docs update did result in a conflict with main, though. Just FYI, I think Feature flags are a good way of creating fixtures that can be changed dynamically. In this scenario, I would have just created one fixture, then toggled stderr suppression so that there's one test with two test cases. You don't have to change your test, just wanted to make sure you knew that was available for you. |
@yhakbar Thanks, I'll look into that. I also updated a couple of existing tests, hopefully I did the right thing there. I'll fix the docs conflict. |
ff66361
to
1d2f0ae
Compare
@yhakbar just rebased against main |
Hey @paololazzari , We're getting linting errors in CI:
Check out our docs on linting if you need help setting that up locally. |
@yhakbar I've addressed those linting errors |
Description
Fixes #3770.
Adds
suppress_stderr
argument to hooks.TODOs
Read the Gruntwork contribution guidelines.
Release Notes (draft)
Added / Removed / Updated [X].
Migration Guide