From e4984c159113d43b9e1fcb1b98d034965b061d2e Mon Sep 17 00:00:00 2001 From: Jakub Michalak Date: Tue, 23 Jul 2024 08:15:37 +0200 Subject: [PATCH] Fix schemas in setStateToValuesFromConfig --- pkg/resources/api_authentication_integration_common.go | 2 +- ...hentication_integration_with_authorization_code_grant.go | 2 +- ...pi_authentication_integration_with_client_credentials.go | 2 +- .../api_authentication_integration_with_jwt_bearer.go | 2 +- pkg/resources/external_oauth_integration.go | 6 +++--- pkg/resources/scim_integration.go | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/resources/api_authentication_integration_common.go b/pkg/resources/api_authentication_integration_common.go index bee53e091b..aafad99b24 100644 --- a/pkg/resources/api_authentication_integration_common.go +++ b/pkg/resources/api_authentication_integration_common.go @@ -335,7 +335,7 @@ func handleApiAuthRead(d *schema.ResourceData, return err } } - if err := setStateToValuesFromConfig(d, warehouseSchema, []string{ + if err := setStateToValuesFromConfig(d, apiAuthCommonSchema, []string{ "oauth_access_token_validity", "oauth_refresh_token_validity", "oauth_client_id", diff --git a/pkg/resources/api_authentication_integration_with_authorization_code_grant.go b/pkg/resources/api_authentication_integration_with_authorization_code_grant.go index 9c8b0cc03f..538b6440da 100644 --- a/pkg/resources/api_authentication_integration_with_authorization_code_grant.go +++ b/pkg/resources/api_authentication_integration_with_authorization_code_grant.go @@ -175,7 +175,7 @@ func ReadContextApiAuthenticationIntegrationWithAuthorizationCodeGrant(withExter }); err != nil { return diag.FromErr(err) } - if err := setStateToValuesFromConfig(d, warehouseSchema, []string{ + if err := setStateToValuesFromConfig(d, apiAuthAuthorizationCodeGrantSchema, []string{ "oauth_authorization_endpoint", "oauth_allowed_scopes", "oauth_client_auth_method", diff --git a/pkg/resources/api_authentication_integration_with_client_credentials.go b/pkg/resources/api_authentication_integration_with_client_credentials.go index 45e25ca0cd..d027493ab2 100644 --- a/pkg/resources/api_authentication_integration_with_client_credentials.go +++ b/pkg/resources/api_authentication_integration_with_client_credentials.go @@ -146,7 +146,7 @@ func ReadContextApiAuthenticationIntegrationWithClientCredentials(withExternalCh }); err != nil { return diag.FromErr(err) } - if err := setStateToValuesFromConfig(d, warehouseSchema, []string{ + if err := setStateToValuesFromConfig(d, apiAuthClientCredentialsSchema, []string{ "oauth_allowed_scopes", }); err != nil { return diag.FromErr(err) diff --git a/pkg/resources/api_authentication_integration_with_jwt_bearer.go b/pkg/resources/api_authentication_integration_with_jwt_bearer.go index df54815f89..edc612f56d 100644 --- a/pkg/resources/api_authentication_integration_with_jwt_bearer.go +++ b/pkg/resources/api_authentication_integration_with_jwt_bearer.go @@ -162,7 +162,7 @@ func ReadContextApiAuthenticationIntegrationWithJwtBearer(withExternalChangesMar }); err != nil { return diag.FromErr(err) } - if err := setStateToValuesFromConfig(d, warehouseSchema, []string{ + if err := setStateToValuesFromConfig(d, apiAuthJwtBearerSchema, []string{ "oauth_authorization_endpoint", "oauth_assertion_issuer", }); err != nil { diff --git a/pkg/resources/external_oauth_integration.go b/pkg/resources/external_oauth_integration.go index 2434dc284c..37c91ded28 100644 --- a/pkg/resources/external_oauth_integration.go +++ b/pkg/resources/external_oauth_integration.go @@ -21,7 +21,7 @@ import ( var privilegedRoles = []string{"ACCOUNTADMIN", "ORGADMIN", "SECURITYADMIN"} -var oauthExternalIntegrationSchema = map[string]*schema.Schema{ +var externalOauthIntegrationSchema = map[string]*schema.Schema{ "name": { Type: schema.TypeString, Required: true, @@ -159,7 +159,7 @@ func ExternalOauthIntegration() *schema.Resource { DeleteContext: DeleteContextExternalOauthIntegration, Description: "Resource used to manage external oauth security integration objects. For more information, check [security integrations documentation](https://docs.snowflake.com/en/sql-reference/sql/create-security-integration-oauth-external).", - Schema: oauthExternalIntegrationSchema, + Schema: externalOauthIntegrationSchema, CustomizeDiff: customdiff.All( ForceNewIfChangeToEmptyString("external_oauth_rsa_public_key"), ForceNewIfChangeToEmptyString("external_oauth_rsa_public_key_2"), @@ -521,7 +521,7 @@ func ReadContextExternalOauthIntegration(withExternalChangesMarking bool) schema } } - if err = setStateToValuesFromConfig(d, warehouseSchema, []string{ + if err = setStateToValuesFromConfig(d, externalOauthIntegrationSchema, []string{ "external_oauth_jws_keys_url", "external_oauth_rsa_public_key", "external_oauth_rsa_public_key_2", diff --git a/pkg/resources/scim_integration.go b/pkg/resources/scim_integration.go index d184145361..ba78acbeac 100644 --- a/pkg/resources/scim_integration.go +++ b/pkg/resources/scim_integration.go @@ -331,7 +331,7 @@ func ReadContextSCIMIntegration(withExternalChangesMarking bool) schema.ReadCont } } - if err = setStateToValuesFromConfig(d, saml2IntegrationSchema, []string{ + if err = setStateToValuesFromConfig(d, scimIntegrationSchema, []string{ "network_policy", "sync_password", }); err != nil {