-
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
output command supports printing all outputs #2503
Conversation
if no output name is specified all outputs are displayed fixed formating and added missing help for -module parameter
@@ -26,15 +27,19 @@ func (c *OutputCommand) Run(args []string) int { | |||
} | |||
|
|||
args = cmdFlags.Args() | |||
if len(args) != 1 || args[0] == "" { | |||
var allOutputs bool = false |
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.
Go style thing; declarations look like:
// type implicitly set by value
foo := false
// type explicitly declared, gets zero value
var foo bool
^^ One or the other, rarely both.
@econnell this is a great start - thank you! Have a look at my inline comments, and it'd be great if you could try and write a unit test for this. You should be able to use the other tests in the area as examples. 👌 |
|
||
for _, k := range ks { | ||
v := mod.Outputs[k] | ||
c.Ui.Output(fmt.Sprintf("%s = %s", k, v)) |
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.
Would you mind doing some escaping for values to make it also useful for cases like these?
terraform output > terraform.tfvars
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.
I'm not sure what you mean. What do you want escaped?
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.
I was more thinking of HCL-compatible output, e.g. variable_name = "space here"
or another_variable = "dash-here"
, but then I found it's actually "broken" elsewhere too, so I think it's ok to keep it as is in this PR.
The escaping can be fixed all together in different PR.
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. |
if no output name is specified all outputs are displayed
fixed formating and added missing help for -module parameter
closes #2390