rename vcenter_server config parameter to something clearer

This commit is contained in:
Takaaki Furukawa 2015-11-01 23:07:23 +09:00
parent 5b1c03879a
commit 7bf02243a1
4 changed files with 11 additions and 11 deletions

View File

@ -16,12 +16,12 @@ const (
type Config struct {
User string
Password string
VCenterServer string
VSphereServer string
}
// Client() returns a new client for accessing VMWare vSphere.
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 {
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.",
},
"vcenter_server": &schema.Schema{
"vsphere_server": &schema.Schema{
Type: schema.TypeString,
Required: true,
DefaultFunc: schema.EnvDefaultFunc("VSPHERE_VCENTER", nil),
Description: "The vCenter Server name for vSphere API operations.",
DefaultFunc: schema.EnvDefaultFunc("VSPHERE_SERVER", nil),
Description: "The vSphere Server name for vSphere API operations.",
},
},
@ -43,7 +43,7 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
config := Config{
User: d.Get("user").(string),
Password: d.Get("password").(string),
VCenterServer: d.Get("vcenter_server").(string),
VSphereServer: d.Get("vsphere_server").(string),
}
return config.Client()

View File

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

View File

@ -25,7 +25,7 @@ therefore may undergo significant changes as the community improves it.
provider "vsphere" {
user = "${var.vsphere_user}"
password = "${var.vsphere_password}"
vcenter_server = "${var.vsphere_vcenter_server}"
vsphere_server = "${var.vsphere_server}"
}
# Create a virtual machine
@ -53,7 +53,7 @@ The following arguments are used to configure the vSphere Provider:
be specified with the `VSPHERE_USER` environment variable.
* `password` - (Required) This is the password for vSphere API operations. Can
also be specified with the `VSPHERE_PASSWORD` environment variable.
* `vcenter_server` - (Required) This is the vCenter server name for vSphere API
operations. Can also be specified with the `VSPHERE_VCENTER` environment
* `vsphere_server` - (Required) This is the vCenter server name for vSphere API
operations. Can also be specified with the `VSPHERE_SERVER` environment
variable.