It appears that starting with the v0.14.4 release, the --detailed-exitcode behavior is broken.
# terragrunt version v0.14.2
# Terraform v0.11.5
$ terragrunt plan --detailed-exitcode
[terragrunt] 2018/03/28 09:14:13 exit status 2
$ echo $?
2
# terragrunt version v0.14.4
# Terraform v0.11.5
$ terragrunt plan --detailed-exitcode
[terragrunt] 2018/03/28 09:12:52 Hit multiple errors:
exit status 2
[terragrunt] 2018/03/28 09:12:52 Unable to determine underlying exit code, so Terragrunt will exit with error code 1
$ echo $?
1
Please let me know if you'd like more verbose logging.
Both plan commands produce a valid plan with no obvious errors.
I also verified that the same behavior occurs in v0.14.5, and absent in v0.14.3.
Ah, you're right. It's because we now are wrapping the error: https://github.com/gruntwork-io/terragrunt/blob/master/cli/cli_app.go#L302-L306. I'll see if I can get a fix out.
Thanks for the verification. A side question that I have after this: have you considered following semantic versioning for the releases?
Generally, going from version 0.14.3 -> 0.14.4 I would only expect to see bugfixes with a small chance of breakage.
For new features, I'd expect to see the middle number bumped up. E.g. 0.14.3 -> 0.15.0 or whatever.
I think there is some value there from the end-user perspective - I am curious to see if you have given this any thought.
Try https://github.com/gruntwork-io/terragrunt/releases/tag/v0.14.6 for the fix in a few minutes, once the binaries build.
A side question that I have after this: have you considered following semantic versioning for the releases?
We do. It's just that we are pre-1.0.0, so the rules are a bit different. We don't use the major version number (it's always 0), so we bump the patch version for anything backwards compatible and the minor version for things that are backwards incompatible. This new feature was supposed to be backwards compatible, but bugs do happen, and are always backwards incompatible :)
I can confirm that the Terraform exit code is being passed on properly in 0.14.6.
I think that there is side story here for better handling of the -detailed-exitcode flag.
Currently Terragrunt treats it as an error (if there are plan changes), and produces some text output indicating errors.
It might be beneficial to always use -detailed-exitcode under the hood during plans, and then interpret the exit codes appropriately.
Right now the users can obtain the plan's exit code via Terragrunt, but Terragrunt itself will treat a valid (but containing a diff) plan as a module plan error.
So I think my suggestion would be as follows:
Instead of passing on the --detailed-exitcode flag, always run plans with --detailed-exitcode, and update Terragrunts interpretation of the exit codes to match Terraform documentation.
seems like a good idea. Please file a separate issue for that.
Most helpful comment
seems like a good idea. Please file a separate issue for that.