From 127436842211cd72cf2c1b1f45d5087d92c31867 Mon Sep 17 00:00:00 2001 From: drfaust92 Date: Tue, 21 Sep 2021 07:21:14 +0300 Subject: [PATCH] fix provider --- pingdom/config.go | 2 +- pingdom/provider.go | 5 ++--- pingdom/provider_test.go | 15 +++++++++------ pingdom/resource_pingdom_integration.go | 6 ++++-- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/pingdom/config.go b/pingdom/config.go index 90f71166..4d13c63c 100644 --- a/pingdom/config.go +++ b/pingdom/config.go @@ -13,7 +13,7 @@ import ( type Config struct { APIToken string `mapstructure:"api_token"` SolarwindsUser string `mapstructure:"solarwinds_user"` - SolarwindsPassword string `mapstructure:"solarwinds_password"` + SolarwindsPassword string `mapstructure:"solarwinds_passwd"` SolarwindsOrgID string `mapstructure:"solarwinds_org_id"` } diff --git a/pingdom/provider.go b/pingdom/provider.go index ed61d37f..2efbec70 100644 --- a/pingdom/provider.go +++ b/pingdom/provider.go @@ -33,9 +33,8 @@ func Provider() *schema.Provider { "pingdom_contact": resourcePingdomContact(), "pingdom_integration": resourcePingdomIntegration(), "pingdom_maintenance": resourcePingdomMaintenance(), - // "pingdom_user": resourceSolarwindsUser(), - "pingdom_occurrence": resourcePingdomOccurrences(), - "pingdom_tms_check": resourcePingdomTmsCheck(), + "pingdom_occurrence": resourcePingdomOccurrences(), + "pingdom_tms_check": resourcePingdomTmsCheck(), }, DataSourcesMap: map[string]*schema.Resource{ "pingdom_contact": dataSourcePingdomContact(), diff --git a/pingdom/provider_test.go b/pingdom/provider_test.go index d8abffae..774eb29d 100644 --- a/pingdom/provider_test.go +++ b/pingdom/provider_test.go @@ -68,12 +68,15 @@ func testAccPreCheck(t *testing.T) { if v := os.Getenv("PINGDOM_API_TOKEN"); v == "" { t.Fatal("PINGDOM_API_TOKEN environment variable must be set for acceptance tests") } - // if v := os.Getenv("SOLARWINDS_USER"); v == "" { - // t.Fatal("SOLARWINDS_USER environment variable must be set for acceptance tests") - // } - // if v := os.Getenv("SOLARWINDS_PASSWD"); v == "" { - // t.Fatal("SOLARWINDS_PASSWD environment variable must be set for acceptance tests") - // } + if v := os.Getenv("SOLARWINDS_USER"); v == "" { + t.Fatal("SOLARWINDS_USER environment variable must be set for acceptance tests") + } + if v := os.Getenv("SOLARWINDS_PASSWD"); v == "" { + t.Fatal("SOLARWINDS_PASSWD environment variable must be set for acceptance tests") + } + if v := os.Getenv("SOLARWINDS_ORG_ID"); v == "" { + t.Fatal("SOLARWINDS_ORG_ID environment variable must be set for acceptance tests") + } } func testAccCheckPingdomResourceID(name string) resource.TestCheckFunc { diff --git a/pingdom/resource_pingdom_integration.go b/pingdom/resource_pingdom_integration.go index cbf1f036..cc4dc658 100644 --- a/pingdom/resource_pingdom_integration.go +++ b/pingdom/resource_pingdom_integration.go @@ -8,6 +8,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/nordcloud/go-pingdom/pingdomext" ) @@ -39,8 +40,9 @@ func resourcePingdomIntegration() *schema.Resource { Required: true, }, "url": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.IsURLWithHTTPorHTTPS, }, }, }