Merge pull request #3718 from rakutentech/rename-config-parameters

provider/vsphere: rename vcenter_server config parameter to something clearer
This commit is contained in:
Paul Hinze 2015-12-02 14:04:52 -06:00
commit 4216a8d1e1
4 changed files with 11 additions and 11 deletions

View File

@ -16,12 +16,12 @@ const (
type Config struct { type Config struct {
User string User string
Password string Password string
VCenterServer string VSphereServer string
} }
// Client() returns a new client for accessing VMWare vSphere. // Client() returns a new client for accessing VMWare vSphere.
func (c *Config) Client() (*govmomi.Client, error) { func (c *Config) Client() (*govmomi.Client, error) {
u, err := url.Parse("https://" + c.VCenterServer + "/sdk") u, err := url.Parse("https://" + c.VSphereServer + "/sdk")
if err != nil { if err != nil {
return nil, fmt.Errorf("Error parse url: %s", err) return nil, fmt.Errorf("Error parse url: %s", err)
} }

View File

@ -23,11 +23,11 @@ func Provider() terraform.ResourceProvider {
Description: "The user password for vSphere API operations.", Description: "The user password for vSphere API operations.",
}, },
"vcenter_server": &schema.Schema{ "vsphere_server": &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,
Required: true, Required: true,
DefaultFunc: schema.EnvDefaultFunc("VSPHERE_VCENTER", nil), DefaultFunc: schema.EnvDefaultFunc("VSPHERE_SERVER", nil),
Description: "The vCenter Server name for vSphere API operations.", Description: "The vSphere Server name for vSphere API operations.",
}, },
}, },
@ -43,7 +43,7 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
config := Config{ config := Config{
User: d.Get("user").(string), User: d.Get("user").(string),
Password: d.Get("password").(string), Password: d.Get("password").(string),
VCenterServer: d.Get("vcenter_server").(string), VSphereServer: d.Get("vsphere_server").(string),
} }
return config.Client() return config.Client()

View File

@ -37,7 +37,7 @@ func testAccPreCheck(t *testing.T) {
t.Fatal("VSPHERE_PASSWORD must be set for acceptance tests") t.Fatal("VSPHERE_PASSWORD must be set for acceptance tests")
} }
if v := os.Getenv("VSPHERE_VCENTER"); v == "" { if v := os.Getenv("VSPHERE_SERVER"); v == "" {
t.Fatal("VSPHERE_VCENTER must be set for acceptance tests") t.Fatal("VSPHERE_SERVER must be set for acceptance tests")
} }
} }

View File

@ -27,7 +27,7 @@ provider at this time only supports IPv4 addresses on virtual machines.
provider "vsphere" { provider "vsphere" {
user = "${var.vsphere_user}" user = "${var.vsphere_user}"
password = "${var.vsphere_password}" password = "${var.vsphere_password}"
vcenter_server = "${var.vsphere_vcenter_server}" vsphere_server = "${var.vsphere_server}"
} }
# Create a virtual machine # Create a virtual machine
@ -55,8 +55,8 @@ The following arguments are used to configure the VMware vSphere Provider:
be specified with the `VSPHERE_USER` environment variable. be specified with the `VSPHERE_USER` environment variable.
* `password` - (Required) This is the password for vSphere API operations. Can * `password` - (Required) This is the password for vSphere API operations. Can
also be specified with the `VSPHERE_PASSWORD` environment variable. also be specified with the `VSPHERE_PASSWORD` environment variable.
* `vcenter_server` - (Required) This is the vCenter server name for vSphere API * `vsphere_server` - (Required) This is the vCenter server name for vSphere API
operations. Can also be specified with the `VSPHERE_VCENTER` environment operations. Can also be specified with the `VSPHERE_SERVER` environment
variable. variable.
## Acceptance Tests ## Acceptance Tests