From 28b8b5b28766d2c39fdc910e7ad80980187ee6a2 Mon Sep 17 00:00:00 2001 From: 1riatsila1 Date: Wed, 4 Sep 2024 11:17:29 +0200 Subject: [PATCH] error message and hardcode secret --- pkg/config-api-provider/examples/full-demo/main.tf | 2 +- pkg/config-api-provider/examples/full-demo/variables.tf | 1 - pkg/config-api-provider/provider/provider.go | 2 +- pkg/config-api-provider/provider/resources/group.go | 4 +--- 4 files changed, 3 insertions(+), 6 deletions(-) delete mode 100644 pkg/config-api-provider/examples/full-demo/variables.tf diff --git a/pkg/config-api-provider/examples/full-demo/main.tf b/pkg/config-api-provider/examples/full-demo/main.tf index bf68f718..d9b4696f 100644 --- a/pkg/config-api-provider/examples/full-demo/main.tf +++ b/pkg/config-api-provider/examples/full-demo/main.tf @@ -9,7 +9,7 @@ terraform { provider "uxi" { host = "test.api.capenetworks.com" client_id = "client_id" - client_secret = var.client_secret + client_secret = "some_random_secret" token_url = "https://test.sso.common.cloud.hpe.com/as/token.oauth2" } diff --git a/pkg/config-api-provider/examples/full-demo/variables.tf b/pkg/config-api-provider/examples/full-demo/variables.tf deleted file mode 100644 index 3bb3a5a6..00000000 --- a/pkg/config-api-provider/examples/full-demo/variables.tf +++ /dev/null @@ -1 +0,0 @@ -variable "client_secret" {} diff --git a/pkg/config-api-provider/provider/provider.go b/pkg/config-api-provider/provider/provider.go index 21cec468..32e0647a 100644 --- a/pkg/config-api-provider/provider/provider.go +++ b/pkg/config-api-provider/provider/provider.go @@ -184,6 +184,6 @@ func getHttpClient(clientID string, clientSecret string, tokenURL string) *http. AuthStyle: oauth2.AuthStyleInParams, } - // Create a context and fetch a tokencould + // Create a context and fetch a token return config.Client(context.Background()) } diff --git a/pkg/config-api-provider/provider/resources/group.go b/pkg/config-api-provider/provider/resources/group.go index 1d6e1c60..82c122fe 100644 --- a/pkg/config-api-provider/provider/resources/group.go +++ b/pkg/config-api-provider/provider/resources/group.go @@ -2,7 +2,6 @@ package resources import ( "context" - "fmt" "github.com/aruba-uxi/configuration-api-terraform-provider/pkg/config-api-client" @@ -89,9 +88,8 @@ func (r *groupResource) Configure(_ context.Context, req resource.ConfigureReque if !ok { resp.Diagnostics.AddError( "Unexpected Data Source Configure Type", - fmt.Sprintf("Expected *config_api_client.APIClient, got: %T. Please report this issue to the provider developers.", req.ProviderData), + "Resource type: Group. Please report this issue to the provider developers.", ) - return }