From 3f55b51b9b0e06e98cd5d81c7fa75db5f3ca83c8 Mon Sep 17 00:00:00 2001 From: Sean Marciniak <30928402+MovieStoreGuy@users.noreply.github.com> Date: Thu, 21 Nov 2024 08:32:27 +1030 Subject: [PATCH] Correcting missuse of the conflicts statement and ensure provider values (#548) are set --- signalfx/provider.go | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/signalfx/provider.go b/signalfx/provider.go index e584cd2b..82be3735 100644 --- a/signalfx/provider.go +++ b/signalfx/provider.go @@ -38,11 +38,10 @@ func Provider() *schema.Provider { sfxProvider = &schema.Provider{ Schema: map[string]*schema.Schema{ "auth_token": { - Type: schema.TypeString, - Optional: true, - ConflictsWith: []string{"email", "password", "organization_id"}, - DefaultFunc: schema.EnvDefaultFunc("SFX_AUTH_TOKEN", ""), - Description: "Splunk Observability Cloud auth token", + Type: schema.TypeString, + Optional: true, + DefaultFunc: schema.EnvDefaultFunc("SFX_AUTH_TOKEN", ""), + Description: "Splunk Observability Cloud auth token", }, "api_url": { Type: schema.TypeString, @@ -81,22 +80,20 @@ func Provider() *schema.Provider { Description: "Maximum retry wait for a single HTTP call in seconds. Defaults to 30", }, "email": { - Type: schema.TypeString, - Optional: true, - ConflictsWith: []string{"auth_token"}, - Description: "Used to create a session token instead of an API token, it requires the account to be configured to login with Email and Password", + Type: schema.TypeString, + Optional: true, + Description: "Used to create a session token instead of an API token, it requires the account to be configured to login with Email and Password", }, "password": { - Type: schema.TypeString, - Optional: true, - ConflictsWith: []string{"auth_token"}, - Description: "Used to create a session token instead of an API token, it requires the account to be configured to login with Email and Password", + Type: schema.TypeString, + Optional: true, + Sensitive: true, + Description: "Used to create a session token instead of an API token, it requires the account to be configured to login with Email and Password", }, "organization_id": { - Type: schema.TypeString, - Optional: true, - ConflictsWith: []string{"auth_token"}, - Description: "Required if the user is configured to be part of multiple organizations", + Type: schema.TypeString, + Optional: true, + Description: "Required if the user is configured to be part of multiple organizations", }, }, DataSourcesMap: map[string]*schema.Resource{ @@ -142,7 +139,11 @@ func Provider() *schema.Provider { } func signalfxConfigure(data *schema.ResourceData) (interface{}, error) { - config := signalfxConfig{} + config := signalfxConfig{ + Email: data.Get("email").(string), + Password: data.Get("password").(string), + OrganizationID: data.Get("organization_id").(string), + } // /etc/signalfx.conf has the lowest priority if _, err := os.Stat(SystemConfigPath); err == nil {