Skip to content

Commit

Permalink
provider/vsphere: restore vcenter_server as deprecated field
Browse files Browse the repository at this point in the history
As promised in my comment in #3718, this preserves backwards
compatibility while warning users of the new proper name for the field.
  • Loading branch information
phinze committed Dec 2, 2015
1 parent d0b07c9 commit f196194
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion builtin/providers/vsphere/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ func Provider() terraform.ResourceProvider {
DefaultFunc: schema.EnvDefaultFunc("VSPHERE_SERVER", nil),
Description: "The vSphere Server name for vSphere API operations.",
},

"vcenter_server": &schema.Schema{
Type: schema.TypeString,
Optional: true,
DefaultFunc: schema.EnvDefaultFunc("VSPHERE_VCENTER", nil),
Deprecated: "This field has been renamed to vsphere_server.",
},
},

ResourcesMap: map[string]*schema.Resource{
Expand All @@ -40,10 +47,16 @@ func Provider() terraform.ResourceProvider {
}

func providerConfigure(d *schema.ResourceData) (interface{}, error) {
server := d.Get("vsphere_server").(string)

if server == "" && d.Get("vcenter_server").(string) != nil {
server = d.Get("vcenter_server").(string)
}

config := Config{
User: d.Get("user").(string),
Password: d.Get("password").(string),
VSphereServer: d.Get("vsphere_server").(string),
VSphereServer: server,
}

return config.Client()
Expand Down

0 comments on commit f196194

Please sign in to comment.