From 2f2be4e9368ed6343c020c646a485c4c21b6b594 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 2 Oct 2014 22:33:38 -0700 Subject: [PATCH] terraform: show variable defaults when prompting for inputs --- terraform/context.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/terraform/context.go b/terraform/context.go index 894e906c8..2823fdc4f 100644 --- a/terraform/context.go +++ b/terraform/context.go @@ -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 {