Skip to content

Commit

Permalink
fix hcx setting
Browse files Browse the repository at this point in the history
  • Loading branch information
adeleporte committed Jan 25, 2021
1 parent 7d50229 commit 0b6f9d4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/adeleporte/terraform-provider-hcx
go 1.15

require (
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
github.com/hashicorp/terraform v0.13.5
github.com/hashicorp/terraform-plugin-sdk/v2 v2.2.0
github.com/zclconf/go-cty v1.5.1
Expand Down
29 changes: 14 additions & 15 deletions provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"

hcx "github.com/adeleporte/terraform-provider-hcx/hcx"
"github.com/hashicorp/go-cty/cty"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
Expand Down Expand Up @@ -69,23 +70,21 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData) (interface{}
adminusername := d.Get("admin_username").(string)
adminpassword := d.Get("admin_password").(string)

if hcxurl != "" {
c, err := hcx.NewClient(&hcxurl, &username, &password, &adminusername, &adminpassword)
//c := &http.Client{Timeout: 10 * time.Second}
c, err := hcx.NewClient(&hcxurl, &username, &password, &adminusername, &adminpassword)
//c := &http.Client{Timeout: 10 * time.Second}

if err != nil {
return nil, diag.FromErr(err)
}

return c, diags
if err != nil {
return nil, diag.FromErr(err)
}

diags = append(diags, diag.Diagnostic{
Severity: diag.Warning,
Summary: "No HCX Url provided",
Detail: "Only hcx_vmc resource will be manageable",
//AttributePath: cty.Path{cty.GetAttrStep{Name: "hcx"}},
})
if hcxurl == "" {
diags = append(diags, diag.Diagnostic{
Severity: diag.Warning,
Summary: "No HCX Url provided",
Detail: "Only hcx_vmc resource will be manageable",
AttributePath: cty.Path{cty.GetAttrStep{Name: "hcx"}},
})
}

return nil, diags
return c, diags
}

0 comments on commit 0b6f9d4

Please sign in to comment.