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 version" prints interesting output #312

Open
kevinburke opened this issue Oct 9, 2017 · 6 comments
Open

"terragrunt version" prints interesting output #312

kevinburke opened this issue Oct 9, 2017 · 6 comments
Labels
enhancement New feature or request

Comments

@kevinburke
Copy link
Contributor

If I run

terragrunt --version

I get the following output:

 $ terragrunt --version
terragrunt version

If I run terragrunt version I get:

$ terragrunt version
[terragrunt] [/Users/kevin/src/github.com/gruntwork-io/terragrunt] 2017/10/09 12:30:41 Running command: terraform --version
[terragrunt] 2017/10/09 12:30:41 Reading Terragrunt config file at /Users/kevin/src/github.com/gruntwork-io/terragrunt/terraform.tfvars
[terragrunt] 2017/10/09 12:30:41 Error reading file at path /Users/kevin/src/github.com/gruntwork-io/terragrunt/terraform.tfvars: open /Users/kevin/src/github.com/gruntwork-io/terragrunt/terraform.tfvars: no such file or directory
[terragrunt] 2017/10/09 12:30:41 Unable to determine underlying exit code, so Terragrunt will exit with error code 1

It seems like there are at least two problems here, one is that terragrunt can't tell you the version, and one is that the return code was not determinable.

I'm running Terraform version 0.9.5. I downloaded Terragrunt today, but I can't tell you which version I use, unfortunately.

@kevinburke
Copy link
Contributor Author

I'm also able to reproduce this error with Terraform v0.10.7.

$ terragrunt version
[terragrunt] [/Users/kevin/src/github.com/gruntwork-io/terragrunt] 2017/10/09 12:37:04 Running command: terraform --version
[terragrunt] 2017/10/09 12:37:07 Reading Terragrunt config file at /Users/kevin/src/github.com/gruntwork-io/terragrunt/terraform.tfvars
[terragrunt] 2017/10/09 12:37:07 Error reading file at path /Users/kevin/src/github.com/gruntwork-io/terragrunt/terraform.tfvars: open /Users/kevin/src/github.com/gruntwork-io/terragrunt/terraform.tfvars: no such file or directory
[terragrunt] 2017/10/09 12:37:07 Unable to determine underlying exit code, so Terragrunt will exit with error code 1

@kevinburke
Copy link
Contributor Author

I guess another way of framing the title issue is "loading a config file should not be a requirement of printing the version string"

@brikis98
Copy link
Member

brikis98 commented Oct 9, 2017

That's weird...

> terragrunt --version
terragrunt version v0.13.7

Agreed, however, that running terragrunt version should not produce an error message!

PRs welcome!

@brikis98 brikis98 added enhancement New feature or request help wanted labels Oct 9, 2017
@mcalhoun
Copy link
Contributor

mcalhoun commented Oct 9, 2017

Oops...I missed the original nuance of --version vs version

$ terragrunt --version                                                                                                                                                                                                                                                                                 
terragrunt version v0.13.5

$ terraform --version                                                                                                                                                                                                                                                                                  
Terraform v0.10.7

@kevinburkeotto
Copy link

kevinburkeotto commented Oct 9, 2017

Ah, if you install the compiled binary or use the ldflags, it prints correctly, I believe. From main.go

// This variable is set at build time using -ldflags parameters. For more info, see:
// http://stackoverflow.com/a/11355611/483528
var VERSION string

I installed by running go install -v -race ./..., hence no version. Maybe you should set the version to "tip" by default, so it prints something.

See also golang/go#22147.

@brikis98
Copy link
Member

brikis98 commented Oct 9, 2017

Ah, yes, if you're running from source, the VERSION flag will not be set. Setting a default seems like a good idea!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: To do
Development

No branches or pull requests

5 participants