diff --git a/builtin/providers/aws/provider.go b/builtin/providers/aws/provider.go index 348b5636a..078ff8f43 100644 --- a/builtin/providers/aws/provider.go +++ b/builtin/providers/aws/provider.go @@ -19,10 +19,11 @@ func Provider() *schema.Provider { return &schema.Provider{ Schema: map[string]*schema.Schema{ "region": &schema.Schema{ - Type: schema.TypeString, - Required: true, - DefaultFunc: envDefaultFunc("AWS_REGION"), - Description: descriptions["region"], + Type: schema.TypeString, + Required: true, + DefaultFunc: envDefaultFunc("AWS_REGION"), + Description: descriptions["region"], + InputDefault: "us-east-1", }, "access_key": &schema.Schema{ diff --git a/command/ui_input.go b/command/ui_input.go index ae2ee6df2..76f2f2264 100644 --- a/command/ui_input.go +++ b/command/ui_input.go @@ -82,6 +82,7 @@ func (i *UIInput) Input(opts *terraform.InputOpts) (string, error) { if opts.Default != "" { buf.WriteString(" [bold]Default:[reset] ") buf.WriteString(opts.Default) + buf.WriteString("\n") } buf.WriteString(" [bold]Enter a value:[reset] ") diff --git a/helper/schema/schema.go b/helper/schema/schema.go index 0a0d1166e..8a813fbb3 100644 --- a/helper/schema/schema.go +++ b/helper/schema/schema.go @@ -14,6 +14,7 @@ package schema import ( "fmt" "reflect" + "sort" "strconv" "strings" @@ -79,6 +80,9 @@ type Schema struct { // be formatted to fit a CLI. Description string + // InputDefault is the default value to use for when inputs are requested. + InputDefault string + // The fields below relate to diffs. // // If Computed is true, then the result of this value is computed @@ -280,7 +284,15 @@ func (m schemaMap) Diff( func (m schemaMap) Input( input terraform.UIInput, c *terraform.ResourceConfig) (*terraform.ResourceConfig, error) { - for k, v := range m { + keys := make([]string, 0, len(m)) + for k, _ := range m { + keys = append(keys, k) + } + sort.Strings(keys) + + for _, k := range keys { + v := m[k] + // Skip things that don't require config, if that is even valid // for a provider schema. if !v.Required && !v.Optional { @@ -623,6 +635,7 @@ func (m schemaMap) inputString( Id: k, Query: k, Description: schema.Description, + Default: schema.InputDefault, }) return result, err diff --git a/terraform/ui_input.go b/terraform/ui_input.go index 9c2ee27e6..7c8745922 100644 --- a/terraform/ui_input.go +++ b/terraform/ui_input.go @@ -22,6 +22,5 @@ type InputOpts struct { Description string // Default will be the value returned if no data is entered. - Default string - DefaultHidden bool + Default string }