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

terragrunt plan should respect -detailed-exitcode #37

Closed
antonbabenko opened this issue Oct 3, 2016 · 4 comments · Fixed by #98
Closed

terragrunt plan should respect -detailed-exitcode #37

antonbabenko opened this issue Oct 3, 2016 · 4 comments · Fixed by #98
Labels
bug Something isn't working

Comments

@antonbabenko
Copy link
Contributor

terraform plan -detailed-exitcode may return 0, 1, 2. Official documentation

terragrunt plan -detailed-exitcode currently return 0 or 1.

@brikis98 brikis98 added bug Something isn't working help wanted labels Oct 3, 2016
@brikis98
Copy link
Member

brikis98 commented Oct 3, 2016

Ah, good catch.

@james-gonzalez
Copy link

Any update on this?

@brikis98
Copy link
Member

@cultavix We haven't had a chance to take a crack at it. Anyone interested in submitting a PR?

Easiest solution is probably to have the checkForErrorsAndExit method in main.go check if the error is of some new type ErrorWithExitCode and if it is, call os.Exit with that code. After that, all you'd have to do is update the RunShellCommand method in run_shell_cmd.go to capture the exit code when there is an error and return an ErrorWithExitCode struct.

asobrien pushed a commit to asobrien/terragrunt that referenced this issue Jan 10, 2017
@asobrien
Copy link

I took a stab at this with PR #98. checkForErrorsAndExit will exit with the underlying error code in the case of an error. I can confirm that this exits with exit code = 2, as expected, when terragrunt plan -detailed-exitcode is called and there are diffs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants