From f1c2be977293fdc578a4084a9f17f51daec24bc7 Mon Sep 17 00:00:00 2001 From: Nicki Watt Date: Wed, 18 Nov 2015 23:56:17 +0000 Subject: [PATCH] Make maxRetryTimeout (in seconds) configurable --- builtin/providers/vcd/config.go | 22 ++++++++++------ builtin/providers/vcd/provider.go | 19 ++++++++++---- builtin/providers/vcd/resource_vcd_dnat.go | 11 ++++---- .../providers/vcd/resource_vcd_dnat_test.go | 4 +-- .../vcd/resource_vcd_firewall_rules.go | 9 +++---- .../vcd/resource_vcd_firewall_rules_test.go | 3 ++- builtin/providers/vcd/resource_vcd_network.go | 13 +++++----- .../vcd/resource_vcd_network_test.go | 4 +-- builtin/providers/vcd/resource_vcd_snat.go | 11 ++++---- .../providers/vcd/resource_vcd_snat_test.go | 4 +-- builtin/providers/vcd/resource_vcd_vapp.go | 25 +++++++++---------- .../providers/vcd/resource_vcd_vapp_test.go | 4 +-- builtin/providers/vcd/structure.go | 4 +-- 13 files changed, 73 insertions(+), 60 deletions(-) diff --git a/builtin/providers/vcd/config.go b/builtin/providers/vcd/config.go index b5da76dba5..c6b5ba509a 100644 --- a/builtin/providers/vcd/config.go +++ b/builtin/providers/vcd/config.go @@ -8,20 +8,28 @@ import ( ) type Config struct { - User string - Password string - Org string - Href string - VDC string + User string + Password string + Org string + Href string + VDC string + MaxRetryTimeout int } -func (c *Config) Client() (*govcd.VCDClient, error) { +type VCDClient struct { + *govcd.VCDClient + MaxRetryTimeout int +} + +func (c *Config) Client() (*VCDClient, error) { u, err := url.ParseRequestURI(c.Href) if err != nil { return nil, fmt.Errorf("Something went wrong: %s", err) } - vcdclient := govcd.NewVCDClient(*u) + vcdclient := &VCDClient{ + govcd.NewVCDClient(*u), + c.MaxRetryTimeout} org, vcd, err := vcdclient.Authenticate(c.User, c.Password, c.Org, c.VDC) if err != nil { return nil, fmt.Errorf("Something went wrong: %s", err) diff --git a/builtin/providers/vcd/provider.go b/builtin/providers/vcd/provider.go index c9849be356..0e3d48d6c3 100644 --- a/builtin/providers/vcd/provider.go +++ b/builtin/providers/vcd/provider.go @@ -36,12 +36,20 @@ func Provider() terraform.ResourceProvider { DefaultFunc: schema.EnvDefaultFunc("VCD_URL", nil), Description: "The vcd url for vcd API operations.", }, + "vdc": &schema.Schema{ Type: schema.TypeString, Optional: true, DefaultFunc: schema.EnvDefaultFunc("VCD_VDC", ""), Description: "The name of the VDC to run operations on", }, + + "maxRetryTimeout": &schema.Schema{ + Type: schema.TypeInt, + Optional: true, + DefaultFunc: schema.EnvDefaultFunc("VCD_MAX_RETRY_TIMEOUT", 30), + Description: "Max num seconds to wait for successful response when operating on resources within vCloud (defaults to 30)", + }, }, ResourcesMap: map[string]*schema.Resource{ @@ -58,11 +66,12 @@ func Provider() terraform.ResourceProvider { func providerConfigure(d *schema.ResourceData) (interface{}, error) { config := Config{ - User: d.Get("user").(string), - Password: d.Get("password").(string), - Org: d.Get("org").(string), - Href: d.Get("url").(string), - VDC: d.Get("vdc").(string), + User: d.Get("user").(string), + Password: d.Get("password").(string), + Org: d.Get("org").(string), + Href: d.Get("url").(string), + VDC: d.Get("vdc").(string), + MaxRetryTimeout: d.Get("maxRetryTimeout").(int), } return config.Client() diff --git a/builtin/providers/vcd/resource_vcd_dnat.go b/builtin/providers/vcd/resource_vcd_dnat.go index 9c38b0b567..5c2e8006c1 100644 --- a/builtin/providers/vcd/resource_vcd_dnat.go +++ b/builtin/providers/vcd/resource_vcd_dnat.go @@ -3,7 +3,6 @@ package vcd import ( "fmt" "github.com/hashicorp/terraform/helper/schema" - "github.com/hmrc/vmware-govcd" ) func resourceVcdDNAT() *schema.Resource { @@ -41,7 +40,7 @@ func resourceVcdDNAT() *schema.Resource { } func resourceVcdDNATCreate(d *schema.ResourceData, meta interface{}) error { - vcdClient := meta.(*govcd.VCDClient) + vcdClient := meta.(*VCDClient) // Multiple VCD components need to run operations on the Edge Gateway, as // the edge gatway will throw back an error if it is already performing an // operation we must wait until we can aquire a lock on the client @@ -60,7 +59,7 @@ func resourceVcdDNATCreate(d *schema.ResourceData, meta interface{}) error { // constrained by out lock. If the edge gateway reurns with a busy error, wait // 3 seconds and then try again. Continue until a non-busy error or success - err = retryCall(4, func() error { + err = retryCall(vcdClient.MaxRetryTimeout, func() error { task, err := edgeGateway.AddNATMapping("DNAT", d.Get("external_ip").(string), d.Get("internal_ip").(string), portString) @@ -80,7 +79,7 @@ func resourceVcdDNATCreate(d *schema.ResourceData, meta interface{}) error { } func resourceVcdDNATRead(d *schema.ResourceData, meta interface{}) error { - vcdClient := meta.(*govcd.VCDClient) + vcdClient := meta.(*VCDClient) e, err := vcdClient.OrgVdc.FindEdgeGateway(d.Get("edge_gateway").(string)) if err != nil { @@ -106,7 +105,7 @@ func resourceVcdDNATRead(d *schema.ResourceData, meta interface{}) error { } func resourceVcdDNATDelete(d *schema.ResourceData, meta interface{}) error { - vcdClient := meta.(*govcd.VCDClient) + vcdClient := meta.(*VCDClient) // Multiple VCD components need to run operations on the Edge Gateway, as // the edge gatway will throw back an error if it is already performing an // operation we must wait until we can aquire a lock on the client @@ -119,7 +118,7 @@ func resourceVcdDNATDelete(d *schema.ResourceData, meta interface{}) error { if err != nil { return fmt.Errorf("Unable to find edge gateway: %#v", err) } - err = retryCall(4, func() error { + err = retryCall(vcdClient.MaxRetryTimeout, func() error { task, err := edgeGateway.RemoveNATMapping("DNAT", d.Get("external_ip").(string), d.Get("internal_ip").(string), portString) diff --git a/builtin/providers/vcd/resource_vcd_dnat_test.go b/builtin/providers/vcd/resource_vcd_dnat_test.go index 6e073905b1..759d9d16b8 100644 --- a/builtin/providers/vcd/resource_vcd_dnat_test.go +++ b/builtin/providers/vcd/resource_vcd_dnat_test.go @@ -50,7 +50,7 @@ func testAccCheckVcdDNATExists(n string, gateway *govcd.EdgeGateway) resource.Te return fmt.Errorf("No DNAT ID is set") } - conn := testAccProvider.Meta().(*govcd.VCDClient) + conn := testAccProvider.Meta().(*VCDClient) gatewayName := rs.Primary.Attributes["edge_gateway"] edgeGateway, err := conn.OrgVdc.FindEdgeGateway(gatewayName) @@ -79,7 +79,7 @@ func testAccCheckVcdDNATExists(n string, gateway *govcd.EdgeGateway) resource.Te } func testAccCheckVcdDNATDestroy(s *terraform.State) error { - conn := testAccProvider.Meta().(*govcd.VCDClient) + conn := testAccProvider.Meta().(*VCDClient) for _, rs := range s.RootModule().Resources { if rs.Type != "vcd_dnat" { continue diff --git a/builtin/providers/vcd/resource_vcd_firewall_rules.go b/builtin/providers/vcd/resource_vcd_firewall_rules.go index ff5d249ba2..913bff8be0 100644 --- a/builtin/providers/vcd/resource_vcd_firewall_rules.go +++ b/builtin/providers/vcd/resource_vcd_firewall_rules.go @@ -3,7 +3,6 @@ package vcd import ( "fmt" "github.com/hashicorp/terraform/helper/schema" - "github.com/hmrc/vmware-govcd" types "github.com/hmrc/vmware-govcd/types/v56" "log" "strings" @@ -82,7 +81,7 @@ func resourceVcdFirewallRules() *schema.Resource { } func resourceVcdFirewallRulesCreate(d *schema.ResourceData, meta interface{}) error { - vcdClient := meta.(*govcd.VCDClient) + vcdClient := meta.(*VCDClient) vcdClient.Mutex.Lock() defer vcdClient.Mutex.Unlock() @@ -91,7 +90,7 @@ func resourceVcdFirewallRulesCreate(d *schema.ResourceData, meta interface{}) er return fmt.Errorf("Unable to find edge gateway: %s", err) } - err = retryCall(5, func() error { + err = retryCall(vcdClient.MaxRetryTimeout, func() error { edgeGateway.Refresh() firewallRules, _ := expandFirewallRules(d, edgeGateway.EdgeGateway) task, err := edgeGateway.CreateFirewallRules(d.Get("default_action").(string), firewallRules) @@ -112,7 +111,7 @@ func resourceVcdFirewallRulesCreate(d *schema.ResourceData, meta interface{}) er } func resourceFirewallRulesDelete(d *schema.ResourceData, meta interface{}) error { - vcdClient := meta.(*govcd.VCDClient) + vcdClient := meta.(*VCDClient) vcdClient.Mutex.Lock() defer vcdClient.Mutex.Unlock() @@ -134,7 +133,7 @@ func resourceFirewallRulesDelete(d *schema.ResourceData, meta interface{}) error } func resourceFirewallRulesRead(d *schema.ResourceData, meta interface{}) error { - vcdClient := meta.(*govcd.VCDClient) + vcdClient := meta.(*VCDClient) edgeGateway, err := vcdClient.OrgVdc.FindEdgeGateway(d.Get("edge_gateway").(string)) if err != nil { diff --git a/builtin/providers/vcd/resource_vcd_firewall_rules_test.go b/builtin/providers/vcd/resource_vcd_firewall_rules_test.go index fe41712768..2c1fa69e6b 100644 --- a/builtin/providers/vcd/resource_vcd_firewall_rules_test.go +++ b/builtin/providers/vcd/resource_vcd_firewall_rules_test.go @@ -44,7 +44,7 @@ func testAccCheckVcdFirewallRulesExists(n string, gateway *govcd.EdgeGateway) re return fmt.Errorf("No Record ID is set") } - conn := testAccProvider.Meta().(*govcd.VCDClient) + conn := testAccProvider.Meta().(*VCDClient) resp, err := conn.OrgVdc.FindEdgeGateway(rs.Primary.ID) if err != nil { @@ -77,6 +77,7 @@ func createFirewallRulesConfigs(existingRules *govcd.EdgeGateway) string { Org: os.Getenv("VCD_ORG"), Href: os.Getenv("VCD_URL"), VDC: os.Getenv("VCD_VDC"), + MaxRetryTimeout: 240, } conn, err := config.Client() if err != nil { diff --git a/builtin/providers/vcd/resource_vcd_network.go b/builtin/providers/vcd/resource_vcd_network.go index 3cb7b8f707..531afd878d 100644 --- a/builtin/providers/vcd/resource_vcd_network.go +++ b/builtin/providers/vcd/resource_vcd_network.go @@ -7,7 +7,6 @@ import ( "fmt" "github.com/hashicorp/terraform/helper/hashcode" "github.com/hashicorp/terraform/helper/schema" - "github.com/hmrc/vmware-govcd" types "github.com/hmrc/vmware-govcd/types/v56" "strings" ) @@ -121,7 +120,7 @@ func resourceVcdNetwork() *schema.Resource { } func resourceVcdNetworkCreate(d *schema.ResourceData, meta interface{}) error { - vcdClient := meta.(*govcd.VCDClient) + vcdClient := meta.(*VCDClient) log.Printf("[TRACE] CLIENT: %#v", vcdClient) vcdClient.Mutex.Lock() defer vcdClient.Mutex.Unlock() @@ -156,7 +155,7 @@ func resourceVcdNetworkCreate(d *schema.ResourceData, meta interface{}) error { log.Printf("[INFO] NETWORK: %#v", newnetwork) - err = retryCall(4, func() error { + err = retryCall(vcdClient.MaxRetryTimeout, func() error { return vcdClient.OrgVdc.CreateOrgVDCNetwork(newnetwork) }) if err != nil { @@ -174,7 +173,7 @@ func resourceVcdNetworkCreate(d *schema.ResourceData, meta interface{}) error { } if dhcp, ok := d.GetOk("dhcp_pool"); ok { - err = retryCall(4, func() error { + err = retryCall(vcdClient.MaxRetryTimeout, func() error { task, err := edgeGateway.AddDhcpPool(network.OrgVDCNetwork, dhcp.(*schema.Set).List()) if err != nil { return fmt.Errorf("Error adding DHCP pool: %#v", err) @@ -194,7 +193,7 @@ func resourceVcdNetworkCreate(d *schema.ResourceData, meta interface{}) error { } func resourceVcdNetworkRead(d *schema.ResourceData, meta interface{}) error { - vcdClient := meta.(*govcd.VCDClient) + vcdClient := meta.(*VCDClient) log.Printf("[DEBUG] VCD Client configuration: %#v", vcdClient) log.Printf("[DEBUG] VCD Client configuration: %#v", vcdClient.OrgVdc) @@ -226,7 +225,7 @@ func resourceVcdNetworkRead(d *schema.ResourceData, meta interface{}) error { } func resourceVcdNetworkDelete(d *schema.ResourceData, meta interface{}) error { - vcdClient := meta.(*govcd.VCDClient) + vcdClient := meta.(*VCDClient) vcdClient.Mutex.Lock() defer vcdClient.Mutex.Unlock() err := vcdClient.OrgVdc.Refresh() @@ -239,7 +238,7 @@ func resourceVcdNetworkDelete(d *schema.ResourceData, meta interface{}) error { return fmt.Errorf("Error finding network: %#v", err) } - err = retryCall(4, func() error { + err = retryCall(vcdClient.MaxRetryTimeout, func() error { task, err := network.Delete() if err != nil { return fmt.Errorf("Error Deleting Network: %#v", err) diff --git a/builtin/providers/vcd/resource_vcd_network_test.go b/builtin/providers/vcd/resource_vcd_network_test.go index 2d260bc03b..fa59d177b7 100644 --- a/builtin/providers/vcd/resource_vcd_network_test.go +++ b/builtin/providers/vcd/resource_vcd_network_test.go @@ -50,7 +50,7 @@ func testAccCheckVcdNetworkExists(n string, network *govcd.OrgVDCNetwork) resour return fmt.Errorf("No VAPP ID is set") } - conn := testAccProvider.Meta().(*govcd.VCDClient) + conn := testAccProvider.Meta().(*VCDClient) resp, err := conn.OrgVdc.FindVDCNetwork(rs.Primary.ID) if err != nil { @@ -64,7 +64,7 @@ func testAccCheckVcdNetworkExists(n string, network *govcd.OrgVDCNetwork) resour } func testAccCheckVcdNetworkDestroy(s *terraform.State) error { - conn := testAccProvider.Meta().(*govcd.VCDClient) + conn := testAccProvider.Meta().(*VCDClient) for _, rs := range s.RootModule().Resources { if rs.Type != "vcd_network" { diff --git a/builtin/providers/vcd/resource_vcd_snat.go b/builtin/providers/vcd/resource_vcd_snat.go index 88a7a75a5e..c2ae891210 100644 --- a/builtin/providers/vcd/resource_vcd_snat.go +++ b/builtin/providers/vcd/resource_vcd_snat.go @@ -3,7 +3,6 @@ package vcd import ( "fmt" "github.com/hashicorp/terraform/helper/schema" - "github.com/hmrc/vmware-govcd" ) func resourceVcdSNAT() *schema.Resource { @@ -35,7 +34,7 @@ func resourceVcdSNAT() *schema.Resource { } func resourceVcdSNATCreate(d *schema.ResourceData, meta interface{}) error { - vcdClient := meta.(*govcd.VCDClient) + vcdClient := meta.(*VCDClient) // Multiple VCD components need to run operations on the Edge Gateway, as // the edge gatway will throw back an error if it is already performing an // operation we must wait until we can aquire a lock on the client @@ -51,7 +50,7 @@ func resourceVcdSNATCreate(d *schema.ResourceData, meta interface{}) error { return fmt.Errorf("Unable to find edge gateway: %#v", err) } - err = retryCall(4, func() error { + err = retryCall(vcdClient.MaxRetryTimeout, func() error { task, err := edgeGateway.AddNATMapping("SNAT", d.Get("internal_ip").(string), d.Get("external_ip").(string), "any") @@ -69,7 +68,7 @@ func resourceVcdSNATCreate(d *schema.ResourceData, meta interface{}) error { } func resourceVcdSNATRead(d *schema.ResourceData, meta interface{}) error { - vcdClient := meta.(*govcd.VCDClient) + vcdClient := meta.(*VCDClient) e, err := vcdClient.OrgVdc.FindEdgeGateway(d.Get("edge_gateway").(string)) if err != nil { @@ -94,7 +93,7 @@ func resourceVcdSNATRead(d *schema.ResourceData, meta interface{}) error { } func resourceVcdSNATDelete(d *schema.ResourceData, meta interface{}) error { - vcdClient := meta.(*govcd.VCDClient) + vcdClient := meta.(*VCDClient) // Multiple VCD components need to run operations on the Edge Gateway, as // the edge gatway will throw back an error if it is already performing an // operation we must wait until we can aquire a lock on the client @@ -106,7 +105,7 @@ func resourceVcdSNATDelete(d *schema.ResourceData, meta interface{}) error { return fmt.Errorf("Unable to find edge gateway: %#v", err) } - err = retryCall(4, func() error { + err = retryCall(vcdClient.MaxRetryTimeout, func() error { task, err := edgeGateway.RemoveNATMapping("SNAT", d.Get("internal_ip").(string), d.Get("external_ip").(string), "") diff --git a/builtin/providers/vcd/resource_vcd_snat_test.go b/builtin/providers/vcd/resource_vcd_snat_test.go index 66351f2a15..87c2702a31 100644 --- a/builtin/providers/vcd/resource_vcd_snat_test.go +++ b/builtin/providers/vcd/resource_vcd_snat_test.go @@ -50,7 +50,7 @@ func testAccCheckVcdSNATExists(n string, gateway *govcd.EdgeGateway) resource.Te return fmt.Errorf("No SNAT ID is set") } - conn := testAccProvider.Meta().(*govcd.VCDClient) + conn := testAccProvider.Meta().(*VCDClient) gatewayName := rs.Primary.Attributes["edge_gateway"] edgeGateway, err := conn.OrgVdc.FindEdgeGateway(gatewayName) @@ -79,7 +79,7 @@ func testAccCheckVcdSNATExists(n string, gateway *govcd.EdgeGateway) resource.Te } func testAccCheckVcdSNATDestroy(s *terraform.State) error { - conn := testAccProvider.Meta().(*govcd.VCDClient) + conn := testAccProvider.Meta().(*VCDClient) for _, rs := range s.RootModule().Resources { if rs.Type != "vcd_snat" { continue diff --git a/builtin/providers/vcd/resource_vcd_vapp.go b/builtin/providers/vcd/resource_vcd_vapp.go index d72b2cb973..73ae6f2b78 100644 --- a/builtin/providers/vcd/resource_vcd_vapp.go +++ b/builtin/providers/vcd/resource_vcd_vapp.go @@ -3,7 +3,6 @@ package vcd import ( "fmt" "github.com/hashicorp/terraform/helper/schema" - "github.com/hmrc/vmware-govcd" types "github.com/hmrc/vmware-govcd/types/v56" "log" ) @@ -80,7 +79,7 @@ func resourceVcdVApp() *schema.Resource { } func resourceVcdVAppCreate(d *schema.ResourceData, meta interface{}) error { - vcdClient := meta.(*govcd.VCDClient) + vcdClient := meta.(*VCDClient) catalog, err := vcdClient.Org.FindCatalog(d.Get("catalog_name").(string)) if err != nil { @@ -133,7 +132,7 @@ func resourceVcdVAppCreate(d *schema.ResourceData, meta interface{}) error { }, } - err = retryCall(4, func() error { + err = retryCall(vcdClient.MaxRetryTimeout, func() error { e := vcdClient.OrgVdc.InstantiateVAppTemplate(createvapp) if e != nil { @@ -152,7 +151,7 @@ func resourceVcdVAppCreate(d *schema.ResourceData, meta interface{}) error { vapp, err := vcdClient.OrgVdc.FindVAppByName(d.Get("name").(string)) - err = retryCall(4, func() error { + err = retryCall(vcdClient.MaxRetryTimeout, func() error { task, err := vapp.ChangeVMName(d.Get("name").(string)) if err != nil { return fmt.Errorf("Error with vm name change: %#v", err) @@ -164,7 +163,7 @@ func resourceVcdVAppCreate(d *schema.ResourceData, meta interface{}) error { return fmt.Errorf("Error changing vmname: %#v", err) } - err = retryCall(4, func() error { + err = retryCall(vcdClient.MaxRetryTimeout, func() error { task, err := vapp.ChangeNetworkConfig(d.Get("network_name").(string), d.Get("ip").(string)) if err != nil { return fmt.Errorf("Error with Networking change: %#v", err) @@ -176,7 +175,7 @@ func resourceVcdVAppCreate(d *schema.ResourceData, meta interface{}) error { } if initscript, ok := d.GetOk("initscript"); ok { - err = retryCall(4, func() error { + err = retryCall(vcdClient.MaxRetryTimeout, func() error { task, err := vapp.RunCustomizationScript(d.Get("name").(string), initscript.(string)) if err != nil { return fmt.Errorf("Error with setting init script: %#v", err) @@ -194,7 +193,7 @@ func resourceVcdVAppCreate(d *schema.ResourceData, meta interface{}) error { } func resourceVcdVAppUpdate(d *schema.ResourceData, meta interface{}) error { - vcdClient := meta.(*govcd.VCDClient) + vcdClient := meta.(*VCDClient) vapp, err := vcdClient.OrgVdc.FindVAppByName(d.Id()) if err != nil { @@ -246,7 +245,7 @@ func resourceVcdVAppUpdate(d *schema.ResourceData, meta interface{}) error { } if d.HasChange("memory") { - err = retryCall(4, func() error { + err = retryCall(vcdClient.MaxRetryTimeout, func() error { task, err := vapp.ChangeMemorySize(d.Get("memory").(int)) if err != nil { return fmt.Errorf("Error changing memory size: %#v", err) @@ -260,7 +259,7 @@ func resourceVcdVAppUpdate(d *schema.ResourceData, meta interface{}) error { } if d.HasChange("cpus") { - err = retryCall(4, func() error { + err = retryCall(vcdClient.MaxRetryTimeout, func() error { task, err := vapp.ChangeCPUcount(d.Get("cpus").(int)) if err != nil { return fmt.Errorf("Error changing cpu count: %#v", err) @@ -290,7 +289,7 @@ func resourceVcdVAppUpdate(d *schema.ResourceData, meta interface{}) error { } func resourceVcdVAppRead(d *schema.ResourceData, meta interface{}) error { - vcdClient := meta.(*govcd.VCDClient) + vcdClient := meta.(*VCDClient) err := vcdClient.OrgVdc.Refresh() if err != nil { @@ -309,14 +308,14 @@ func resourceVcdVAppRead(d *schema.ResourceData, meta interface{}) error { } func resourceVcdVAppDelete(d *schema.ResourceData, meta interface{}) error { - vcdClient := meta.(*govcd.VCDClient) + vcdClient := meta.(*VCDClient) vapp, err := vcdClient.OrgVdc.FindVAppByName(d.Id()) if err != nil { return fmt.Errorf("error finding vapp: %s", err) } - err = retryCall(4, func() error { + err = retryCall(vcdClient.MaxRetryTimeout, func() error { task, err := vapp.Undeploy() if err != nil { return fmt.Errorf("Error undeploying: %#v", err) @@ -328,7 +327,7 @@ func resourceVcdVAppDelete(d *schema.ResourceData, meta interface{}) error { return err } - err = retryCall(4, func() error { + err = retryCall(vcdClient.MaxRetryTimeout, func() error { task, err := vapp.Delete() if err != nil { return fmt.Errorf("Error deleting: %#v", err) diff --git a/builtin/providers/vcd/resource_vcd_vapp_test.go b/builtin/providers/vcd/resource_vcd_vapp_test.go index 1ae4315e2a..38162a64a2 100644 --- a/builtin/providers/vcd/resource_vcd_vapp_test.go +++ b/builtin/providers/vcd/resource_vcd_vapp_test.go @@ -59,7 +59,7 @@ func testAccCheckVcdVAppExists(n string, vapp *govcd.VApp) resource.TestCheckFun return fmt.Errorf("No VAPP ID is set") } - conn := testAccProvider.Meta().(*govcd.VCDClient) + conn := testAccProvider.Meta().(*VCDClient) resp, err := conn.OrgVdc.FindVAppByName(rs.Primary.ID) if err != nil { @@ -73,7 +73,7 @@ func testAccCheckVcdVAppExists(n string, vapp *govcd.VApp) resource.TestCheckFun } func testAccCheckVcdVAppDestroy(s *terraform.State) error { - conn := testAccProvider.Meta().(*govcd.VCDClient) + conn := testAccProvider.Meta().(*VCDClient) for _, rs := range s.RootModule().Resources { if rs.Type != "vcd_vapp" { diff --git a/builtin/providers/vcd/structure.go b/builtin/providers/vcd/structure.go index d8124687a7..d4ac65eaee 100644 --- a/builtin/providers/vcd/structure.go +++ b/builtin/providers/vcd/structure.go @@ -107,6 +107,6 @@ func getPortString(port int) string { return portstring } -func retryCall(min int, f resource.RetryFunc) error { - return resource.Retry(time.Duration(min)*time.Minute, f) +func retryCall(seconds int, f resource.RetryFunc) error { + return resource.Retry(time.Duration(seconds)*time.Second, f) }