-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Add workspace show
command
#15157
Add workspace show
command
#15157
Conversation
Thanks for this, @michaelhelmick! This does seem like a reasonable way to get the name in a way that's useful in wrapper scripts, etc. In 0.10 we're actually going to rename the Thanks again for working on this, and sorry for the friction as we get through the integration phase for the 0.10 release. |
No worries, I'll keep an eye out for 0.10 and come back to this pull request and fix any conflicts! |
Until then, maybe you could use 'cat .terraform/environment' :) |
Heh... that will indeed work for now, and we're not planning to rename that file to |
ec81477
to
8443b51
Compare
8443b51
to
dcd31fd
Compare
Hi again @michaelhelmick! With the switch to If you have the time it'd be good to have a simple test for this in the |
@apparentlymart Thanks! I attempted to add a test, but am see this:
Any idea where I'm going wrong?
Still works... not sure if something other than if code := showCmd.Run(nil); code != 0 {
t.Fatalf("bad: %d\n\n%s", code, ui.ErrorWriter)
} |
command/workspace_show.go
Outdated
workspace := c.Workspace() | ||
c.Ui.Output(workspace) | ||
|
||
return 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh... I didn't catch this on the first pass. We need to return 0
here to indicate that the command has completed without error. Numbers greater than zero indicate errors, as we can see with the flag parse error above.
@apparentlymart fixed the return code but looks like the first show succeeds but the second show doesn't.
|
@apparentlymart Found it! Was referencing the wrong |
Awesome. Thanks, @michaelhelmick! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
I didn't see an easy way to display the current env (except for
env list
and the*
next to the current env)This pull request adds
terraform env show
which looks something like this: