hashicorp / terraform-config-inspect

A helper library for shallow inspection of Terraform configurations
Mozilla Public License 2.0
383 stars 76 forks source link

Support the sensitive attribute on outputs (#55) #56

Closed andy-caruso closed 3 years ago

andy-caruso commented 3 years ago

If sensitive is not specified or is false it will not be present in the Output object as per omitempty behavior.

hashicorp-cla commented 3 years ago

CLA assistant check
All committers have signed the CLA.

mildwonkey commented 3 years ago

Hi @andy-caruso , Can you explain a bit about your use case here? terraform-config-inspect is a general tool used to inspect configuration, not display it to other users, and I don't think suppressing output is something terraform-config-inspect should be expected to handle. I'd go as far as to say it's counter-indicated; the whole point is to be able to inspect the given configuration, and that may include sensitive values.

andy-caruso commented 3 years ago

I don't think I explained it well, this change doesn't suppress the output, it populates the Sensitive field in the Output object when inspecting a terraform module.

type Output struct {
    Name        string `json:"name"`
    Description string    `json:"description,omitempty"`
    Sensitive   bool      `json:"sensitive,omitempty"`  <--- Newly added
    Pos         SourcePos `json:"pos"`
}

I added an example of some use-cases to Feature Request #55

mildwonkey commented 3 years ago

Hi, thanks @andy-caruso !

Your explanation was just fine, but I definitely misinterpreted what I was seeing and indeed thought you were suppressing the value (trust me when I say we yell about terraform's overloaded terminology on a daily basis). This makes sense and I am very sorry I did not look closely enough at first.

mildwonkey commented 3 years ago

Thanks @justincampbell that's all I needed!