terraform: show variable defaults when prompting for inputs

This commit is contained in:
Mitchell Hashimoto 2014-10-02 22:33:38 -07:00
parent 1ddf5bfc5f
commit 2f2be4e936
1 changed files with 6 additions and 0 deletions

View File

@ -161,6 +161,11 @@ func (c *Context) Input() error {
panic(fmt.Sprintf("Unknown variable type: %s", v.Type()))
}
var defaultString string
if v.Default != nil {
defaultString = v.Default.(string)
}
// Ask the user for a value for this variable
var value string
for {
@ -168,6 +173,7 @@ func (c *Context) Input() error {
value, err = c.uiInput.Input(&InputOpts{
Id: fmt.Sprintf("var.%s", n),
Query: fmt.Sprintf("var.%s", n),
Default: defaultString,
Description: v.Description,
})
if err != nil {