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

output command supports printing all outputs #2503

Closed
wants to merge 2 commits into from

Conversation

econnell
Copy link
Contributor

if no output name is specified all outputs are displayed
fixed formating and added missing help for -module parameter
closes #2390

if no output name is specified all outputs are displayed
fixed formating and added missing help for -module parameter
@econnell econnell changed the title output command supports printing all outputs (closes issue #2390) output command supports printing all outputs Jun 25, 2015
@@ -26,15 +27,19 @@ func (c *OutputCommand) Run(args []string) int {
}

args = cmdFlags.Args()
if len(args) != 1 || args[0] == "" {
var allOutputs bool = false
Copy link
Contributor

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.

@phinze
Copy link
Contributor

phinze commented Jun 26, 2015

@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))
Copy link
Member

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

Copy link
Contributor Author

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?

Copy link
Member

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.

@radeksimko
Copy link
Member

@econnell Thanks for the PR, I polished it & added tests in #2920 which has been merged. Authorship of your commit is still credited to you.

@radeksimko radeksimko closed this Aug 13, 2015
@radeksimko radeksimko removed the wip label Aug 13, 2015
@ghost
Copy link

ghost commented May 1, 2020

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.

@ghost ghost locked and limited conversation to collaborators May 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

terraform output with no params should show all configured outputs
3 participants