diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f994b9b86d..3ec814e652 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -41,7 +41,11 @@ jobs: - name: Create and populate .snowflake/config file id: create_config - run: mkdir $HOME/.snowflake && echo "${{ secrets.SNOWFLAKE_CONFIG_FILE }}" > $HOME/.snowflake/config + run: mkdir -p $HOME/.snowflake && echo "${{ secrets.SNOWFLAKE_CONFIG_FILE }}" > $HOME/.snowflake/config + + - name: Create and populate .snowflake/config_v097_compatible file + id: create_config_v097_compatible + run: mkdir -p $HOME/.snowflake && echo "${{ secrets.SNOWFLAKE_CONFIG_FILE_V097_COMPATIBLE }}" > $HOME/.snowflake/config_v097_compatible - run: make test if: ${{ !cancelled() && steps.create_config.conclusion == 'success' }} diff --git a/pkg/acceptance/testing.go b/pkg/acceptance/testing.go index bd1c6d299f..3896228d0b 100644 --- a/pkg/acceptance/testing.go +++ b/pkg/acceptance/testing.go @@ -14,6 +14,7 @@ import ( "github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/acceptance/helpers/random" "github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/acceptance/testenvs" "github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/acceptance/testprofiles" + "github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/internal/snowflakeenvs" "github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/provider" "github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk" "github.com/hashicorp/terraform-plugin-go/tfprotov5" @@ -23,6 +24,7 @@ import ( "github.com/hashicorp/terraform-plugin-testing/config" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/snowflakedb/gosnowflake" + "github.com/stretchr/testify/require" ) const AcceptanceTestPrefix = "acc_test_" @@ -208,3 +210,18 @@ func ExternalProviderWithExactVersion(version string) map[string]resource.Extern }, } } + +// SetV097CompatibleConfigPathEnv sets a new config path in a relevant env variable for a file that is compatible with v0.97. +func SetV097CompatibleConfigPathEnv(t *testing.T) { + t.Helper() + home, err := os.UserHomeDir() + require.NoError(t, err) + configPath := filepath.Join(home, ".snowflake", "config_v097_compatible") + t.Setenv(snowflakeenvs.ConfigPath, configPath) +} + +// UnsetConfigPathEnv unsets a config path env +func UnsetConfigPathEnv(t *testing.T) { + t.Helper() + t.Setenv(snowflakeenvs.ConfigPath, "") +} diff --git a/pkg/acceptance/testprofiles/testing_config_profiles.go b/pkg/acceptance/testprofiles/testing_config_profiles.go index 23ff0fb9c2..c671c4219c 100644 --- a/pkg/acceptance/testprofiles/testing_config_profiles.go +++ b/pkg/acceptance/testprofiles/testing_config_profiles.go @@ -9,4 +9,8 @@ const ( CompleteFields = "complete_fields" CompleteFieldsInvalid = "complete_fields_invalid" DefaultWithPasscode = "default_with_passcode" + + JwtAuth = "jwt_auth" + EncryptedJwtAuth = "encrypted_jwt_auth" + Okta = "okta" ) diff --git a/pkg/manual_tests/authentication_methods/auth_test.go b/pkg/manual_tests/authentication_methods/auth_test.go index 1e8fbef848..5089009e3a 100644 --- a/pkg/manual_tests/authentication_methods/auth_test.go +++ b/pkg/manual_tests/authentication_methods/auth_test.go @@ -31,7 +31,7 @@ func TestAcc_Provider_OktaAuth(t *testing.T) { }, Steps: []resource.TestStep{ { - Config: providerConfigWithAuthenticator("okta", sdk.AuthenticationTypeOkta), + Config: providerConfigWithAuthenticator(testprofiles.Okta, sdk.AuthenticationTypeOkta), }, }, }) diff --git a/pkg/provider/provider_acceptance_test.go b/pkg/provider/provider_acceptance_test.go index 5369ada5c6..0d0daf7b67 100644 --- a/pkg/provider/provider_acceptance_test.go +++ b/pkg/provider/provider_acceptance_test.go @@ -12,7 +12,6 @@ import ( acc "github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/acceptance" "github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk" - "github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/testhelpers" "github.com/snowflakedb/gosnowflake" "github.com/stretchr/testify/assert" @@ -165,8 +164,6 @@ func TestAcc_Provider_configureClientOnceSwitching(t *testing.T) { } func TestAcc_Provider_tomlConfig(t *testing.T) { - // TODO(SNOW-1752038): unskip - t.Skip("Skip because this test needs a TOML config incompatible with older versions, causing tests with ExternalProvider to fail.") t.Setenv(string(testenvs.ConfigureClientOnce), "") user := acc.DefaultConfig(t).User @@ -239,8 +236,6 @@ func TestAcc_Provider_tomlConfig(t *testing.T) { } func TestAcc_Provider_envConfig(t *testing.T) { - // TODO(SNOW-1752038): unskip - t.Skip("Skip because this test needs a TOML config incompatible with older versions, causing tests with ExternalProvider to fail.") t.Setenv(string(testenvs.ConfigureClientOnce), "") user := acc.DefaultConfig(t).User @@ -352,8 +347,6 @@ func TestAcc_Provider_envConfig(t *testing.T) { } func TestAcc_Provider_tfConfig(t *testing.T) { - // TODO(SNOW-1752038): unskip - t.Skip("Skip because this test needs a TOML config incompatible with older versions, causing tests with ExternalProvider to fail.") t.Setenv(string(testenvs.ConfigureClientOnce), "") user := acc.DefaultConfig(t).User @@ -499,19 +492,6 @@ func TestAcc_Provider_useNonExistentDefaultParams(t *testing.T) { // prove we can use tri-value booleans, similarly to the ones in resources func TestAcc_Provider_triValueBoolean(t *testing.T) { t.Setenv(string(testenvs.ConfigureClientOnce), "") - account := acc.DefaultConfig(t).Account - user := acc.DefaultConfig(t).User - password := acc.DefaultConfig(t).Password - - // Prepare a temporary TOML config that is valid for v0.97.0. - // The default TOML is not valid because we set new fields, which is incorrect from v0.97.0's point of view. - c := fmt.Sprintf(` - [default] - account='%s' - user='%s' - password='%s' - `, account, user, password) - configPath := testhelpers.TestFile(t, "config", []byte(c)) resource.Test(t, resource.TestCase{ PreCheck: func() { @@ -524,9 +504,7 @@ func TestAcc_Provider_triValueBoolean(t *testing.T) { }, Steps: []resource.TestStep{ { - PreConfig: func() { - t.Setenv(snowflakeenvs.ConfigPath, configPath) - }, + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: acc.ExternalProviderWithExactVersion("0.97.0"), Config: providerConfigWithClientStoreTemporaryCredential(testprofiles.Default, `true`), }, @@ -572,9 +550,6 @@ func TestAcc_Provider_sessionParameters(t *testing.T) { } func TestAcc_Provider_JwtAuth(t *testing.T) { - // TODO(SNOW-1752038): unskip - t.Skip("Skip because this test needs a TOML config incompatible with older versions, causing tests with ExternalProvider to fail.") - t.Setenv(string(testenvs.ConfigureClientOnce), "") resource.Test(t, resource.TestCase{ @@ -590,16 +565,16 @@ func TestAcc_Provider_JwtAuth(t *testing.T) { Steps: []resource.TestStep{ // authenticate with unencrypted private key { - Config: providerConfigWithAuthenticator("jwt_test", sdk.AuthenticationTypeJwt), + Config: providerConfigWithAuthenticator(testprofiles.JwtAuth, sdk.AuthenticationTypeJwt), }, // authenticate with unencrypted private key with a legacy authenticator value // solves https://github.com/Snowflake-Labs/terraform-provider-snowflake/issues/2983 { - Config: providerConfigWithAuthenticator("jwt_test", sdk.AuthenticationTypeJwtLegacy), + Config: providerConfigWithAuthenticator(testprofiles.JwtAuth, sdk.AuthenticationTypeJwtLegacy), }, // authenticate with encrypted private key { - Config: providerConfigWithAuthenticator("jwt_encrypted_test", sdk.AuthenticationTypeJwt), + Config: providerConfigWithAuthenticator(testprofiles.EncryptedJwtAuth, sdk.AuthenticationTypeJwt), }, }, }) diff --git a/pkg/resources/account_role_acceptance_test.go b/pkg/resources/account_role_acceptance_test.go index cda06bec4d..7fffe1456b 100644 --- a/pkg/resources/account_role_acceptance_test.go +++ b/pkg/resources/account_role_acceptance_test.go @@ -217,6 +217,7 @@ func TestAcc_AccountRole_migrateFromV0941_ensureSmoothUpgradeWithNewResourceId(t CheckDestroy: acc.CheckDestroy(t, resources.AccountRole), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -229,6 +230,7 @@ func TestAcc_AccountRole_migrateFromV0941_ensureSmoothUpgradeWithNewResourceId(t ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: accountRoleBasicConfig(id.Name(), comment), Check: resource.ComposeAggregateTestCheckFunc( @@ -252,6 +254,7 @@ func TestAcc_AccountRole_WithQuotedName(t *testing.T) { CheckDestroy: acc.CheckDestroy(t, resources.AccountRole), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -266,6 +269,7 @@ func TestAcc_AccountRole_WithQuotedName(t *testing.T) { ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: accountRoleBasicConfig(quotedId, comment), ConfigPlanChecks: resource.ConfigPlanChecks{ diff --git a/pkg/resources/alert_acceptance_test.go b/pkg/resources/alert_acceptance_test.go index 7dd9853e6e..f021233f08 100644 --- a/pkg/resources/alert_acceptance_test.go +++ b/pkg/resources/alert_acceptance_test.go @@ -208,7 +208,6 @@ resource "snowflake_alert" "test_alert" { // Can't reproduce the issue, leaving the test for now. func TestAcc_Alert_Issue3117(t *testing.T) { id := acc.TestClient().Ids.RandomSchemaObjectIdentifierWithPrefix("small caps with spaces") - resource.Test(t, resource.TestCase{ PreCheck: func() { acc.TestAccPreCheck(t) }, TerraformVersionChecks: []tfversion.TerraformVersionCheck{ @@ -217,6 +216,7 @@ func TestAcc_Alert_Issue3117(t *testing.T) { CheckDestroy: acc.CheckDestroy(t, resources.Alert), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.92.0", @@ -229,6 +229,7 @@ func TestAcc_Alert_Issue3117(t *testing.T) { ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: alertIssue3117Config(id, acc.TestClient().Ids.WarehouseId(), "test_alert"), Check: resource.ComposeTestCheckFunc( diff --git a/pkg/resources/api_authentication_integration_with_authorization_code_grant_acceptance_test.go b/pkg/resources/api_authentication_integration_with_authorization_code_grant_acceptance_test.go index e8ee7e82bb..d81c86eac6 100644 --- a/pkg/resources/api_authentication_integration_with_authorization_code_grant_acceptance_test.go +++ b/pkg/resources/api_authentication_integration_with_authorization_code_grant_acceptance_test.go @@ -271,6 +271,7 @@ func TestAcc_ApiAuthenticationIntegrationWithAuthorizationCodeGrant_migrateFromV CheckDestroy: acc.CheckDestroy(t, resources.ApiAuthenticationIntegrationWithAuthorizationCodeGrant), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -283,6 +284,7 @@ func TestAcc_ApiAuthenticationIntegrationWithAuthorizationCodeGrant_migrateFromV ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: apiAuthenticationIntegrationWithAuthorizationCodeGrantBasicConfig(id.Name()), Check: resource.ComposeAggregateTestCheckFunc( @@ -305,6 +307,7 @@ func TestAcc_ApiAuthenticationIntegrationWithAuthorizationCodeGrant_WithQuotedNa CheckDestroy: acc.CheckDestroy(t, resources.ApiAuthenticationIntegrationWithAuthorizationCodeGrant), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -319,6 +322,7 @@ func TestAcc_ApiAuthenticationIntegrationWithAuthorizationCodeGrant_WithQuotedNa ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: apiAuthenticationIntegrationWithAuthorizationCodeGrantBasicConfig(quotedId), ConfigPlanChecks: resource.ConfigPlanChecks{ diff --git a/pkg/resources/api_authentication_integration_with_client_credentials_acceptance_test.go b/pkg/resources/api_authentication_integration_with_client_credentials_acceptance_test.go index 799655a517..d221bacd85 100644 --- a/pkg/resources/api_authentication_integration_with_client_credentials_acceptance_test.go +++ b/pkg/resources/api_authentication_integration_with_client_credentials_acceptance_test.go @@ -264,6 +264,7 @@ func TestAcc_ApiAuthenticationIntegrationWithClientCredentials_migrateFromV0941_ CheckDestroy: acc.CheckDestroy(t, resources.ApiAuthenticationIntegrationWithClientCredentials), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -276,6 +277,7 @@ func TestAcc_ApiAuthenticationIntegrationWithClientCredentials_migrateFromV0941_ ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: apiAuthenticationIntegrationWithClientCredentialsBasicConfig(id.Name()), Check: resource.ComposeAggregateTestCheckFunc( @@ -298,6 +300,7 @@ func TestAcc_ApiAuthenticationIntegrationWithClientCredentials_WithQuotedName(t CheckDestroy: acc.CheckDestroy(t, resources.ApiAuthenticationIntegrationWithClientCredentials), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -312,6 +315,7 @@ func TestAcc_ApiAuthenticationIntegrationWithClientCredentials_WithQuotedName(t ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: apiAuthenticationIntegrationWithClientCredentialsBasicConfig(quotedId), ConfigPlanChecks: resource.ConfigPlanChecks{ diff --git a/pkg/resources/api_authentication_integration_with_jwt_bearer_acceptance_test.go b/pkg/resources/api_authentication_integration_with_jwt_bearer_acceptance_test.go index a9ce80b0f4..a653f71970 100644 --- a/pkg/resources/api_authentication_integration_with_jwt_bearer_acceptance_test.go +++ b/pkg/resources/api_authentication_integration_with_jwt_bearer_acceptance_test.go @@ -232,6 +232,7 @@ func TestAcc_ApiAuthenticationIntegrationWithJwtBearer_migrateFromV0941_ensureSm CheckDestroy: acc.CheckDestroy(t, resources.ApiAuthenticationIntegrationWithJwtBearer), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -244,6 +245,7 @@ func TestAcc_ApiAuthenticationIntegrationWithJwtBearer_migrateFromV0941_ensureSm ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: apiAuthenticationIntegrationWithJwtBearerBasicConfig(id.Name()), Check: resource.ComposeAggregateTestCheckFunc( @@ -268,6 +270,7 @@ func TestAcc_ApiAuthenticationIntegrationWithJwtBearer_IdentifierQuotingDiffSupp CheckDestroy: acc.CheckDestroy(t, resources.ApiAuthenticationIntegrationWithJwtBearer), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -282,6 +285,7 @@ func TestAcc_ApiAuthenticationIntegrationWithJwtBearer_IdentifierQuotingDiffSupp ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: apiAuthenticationIntegrationWithJwtBearerBasicConfig(quotedId), ConfigPlanChecks: resource.ConfigPlanChecks{ diff --git a/pkg/resources/database_acceptance_test.go b/pkg/resources/database_acceptance_test.go index a1df0a1266..d46f51d7c5 100644 --- a/pkg/resources/database_acceptance_test.go +++ b/pkg/resources/database_acceptance_test.go @@ -980,6 +980,7 @@ func TestAcc_Database_UpgradeWithTheSameFieldsAsInTheOldOne(t *testing.T) { CheckDestroy: acc.CheckDestroy(t, resources.Database), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.92.0", @@ -1045,6 +1046,7 @@ func TestAcc_Database_UpgradeWithDataRetentionSet(t *testing.T) { CheckDestroy: acc.CheckDestroy(t, resources.Database), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.92.0", @@ -1108,6 +1110,7 @@ func TestAcc_Database_WithReplication(t *testing.T) { CheckDestroy: acc.CheckDestroy(t, resources.Database), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.92.0", @@ -1125,6 +1128,7 @@ func TestAcc_Database_WithReplication(t *testing.T) { ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: databaseStateUpgraderWithReplicationNew(id, secondaryAccountIdentifier), ConfigPlanChecks: resource.ConfigPlanChecks{ @@ -1267,6 +1271,7 @@ func TestAcc_Database_migrateFromV0941_ensureSmoothUpgradeWithNewResourceId(t *t CheckDestroy: acc.CheckDestroy(t, resources.Database), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -1279,6 +1284,7 @@ func TestAcc_Database_migrateFromV0941_ensureSmoothUpgradeWithNewResourceId(t *t ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: databaseConfigBasic(id.Name()), Check: resource.ComposeAggregateTestCheckFunc( @@ -1315,6 +1321,7 @@ func TestAcc_Database_IdentifierQuotingDiffSuppression(t *testing.T) { CheckDestroy: acc.CheckDestroy(t, resources.Database), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -1331,6 +1338,7 @@ func TestAcc_Database_IdentifierQuotingDiffSuppression(t *testing.T) { ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: databaseConfigBasicWithExternalVolumeAndCatalog(quotedId, quotedExternalVolumeId, quotedCatalogId), ConfigPlanChecks: resource.ConfigPlanChecks{ diff --git a/pkg/resources/database_role_acceptance_test.go b/pkg/resources/database_role_acceptance_test.go index 1d3552a86c..45ab1ddeac 100644 --- a/pkg/resources/database_role_acceptance_test.go +++ b/pkg/resources/database_role_acceptance_test.go @@ -161,6 +161,7 @@ func TestAcc_DatabaseRole_migrateFromV0941_ensureSmoothUpgradeWithNewResourceId( }, Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -173,6 +174,7 @@ func TestAcc_DatabaseRole_migrateFromV0941_ensureSmoothUpgradeWithNewResourceId( ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: config.FromModel(t, databaseRoleModelWithComment), ConfigPlanChecks: resource.ConfigPlanChecks{ @@ -204,6 +206,7 @@ func TestAcc_DatabaseRole_IdentifierQuotingDiffSuppression(t *testing.T) { }, Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -219,6 +222,7 @@ func TestAcc_DatabaseRole_IdentifierQuotingDiffSuppression(t *testing.T) { ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: config.FromModel(t, databaseRoleModelWithComment), ConfigPlanChecks: resource.ConfigPlanChecks{ diff --git a/pkg/resources/external_function_acceptance_test.go b/pkg/resources/external_function_acceptance_test.go index 1ce5b27cf1..c53b90167a 100644 --- a/pkg/resources/external_function_acceptance_test.go +++ b/pkg/resources/external_function_acceptance_test.go @@ -239,6 +239,7 @@ func TestAcc_ExternalFunction_migrateFromVersion085(t *testing.T) { Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.85.0", @@ -291,6 +292,7 @@ func TestAcc_ExternalFunction_migrateFromVersion085_issue2694_previousValuePrese Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.85.0", @@ -335,6 +337,7 @@ func TestAcc_ExternalFunction_migrateFromVersion085_issue2694_previousValueRemov Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.85.0", @@ -415,6 +418,7 @@ func TestAcc_ExternalFunction_HeaderParsing(t *testing.T) { CheckDestroy: acc.CheckDestroy(t, resources.ExternalFunction), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.93.0", @@ -436,6 +440,7 @@ func TestAcc_ExternalFunction_HeaderParsing(t *testing.T) { ExpectNonEmptyPlan: true, }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: externalFunctionConfigIssueCurlyHeader(id), Check: resource.ComposeTestCheckFunc( @@ -583,6 +588,7 @@ func TestAcc_ExternalFunction_EnsureSmoothResourceIdMigrationToV0950(t *testing. CheckDestroy: acc.CheckDestroy(t, resources.ExternalFunction), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -595,6 +601,7 @@ func TestAcc_ExternalFunction_EnsureSmoothResourceIdMigrationToV0950(t *testing. ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: externalFunctionConfigWithMoreArguments(acc.TestDatabaseName, acc.TestSchemaName, name), Check: resource.ComposeTestCheckFunc( @@ -655,6 +662,7 @@ func TestAcc_ExternalFunction_EnsureSmoothResourceIdMigrationToV0950_WithoutArgu CheckDestroy: acc.CheckDestroy(t, resources.ExternalFunction), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -667,6 +675,7 @@ func TestAcc_ExternalFunction_EnsureSmoothResourceIdMigrationToV0950_WithoutArgu ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: externalFunctionConfigWithoutArguments(acc.TestDatabaseName, acc.TestSchemaName, name), Check: resource.ComposeTestCheckFunc( diff --git a/pkg/resources/external_oauth_integration_acceptance_test.go b/pkg/resources/external_oauth_integration_acceptance_test.go index 0732282702..4b4f90c415 100644 --- a/pkg/resources/external_oauth_integration_acceptance_test.go +++ b/pkg/resources/external_oauth_integration_acceptance_test.go @@ -773,6 +773,7 @@ func TestAcc_ExternalOauthIntegration_migrateFromVersion092_withRsaPublicKeysAnd Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.92.0", @@ -799,6 +800,7 @@ func TestAcc_ExternalOauthIntegration_migrateFromVersion092_withRsaPublicKeysAnd ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: externalOauthIntegrationWithRsaPublicKeysAndBlockedRolesListv093(id.Name(), issuer, rsaKey, role.Name), Check: resource.ComposeAggregateTestCheckFunc( @@ -889,6 +891,7 @@ func TestAcc_ExternalOauthIntegration_migrateFromVersion092_withJwsKeysUrlAndAll Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.92.0", @@ -915,6 +918,7 @@ func TestAcc_ExternalOauthIntegration_migrateFromVersion092_withJwsKeysUrlAndAll ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: externalOauthIntegrationWithJwsKeysUrlAndAllowedRolesListv093(id.Name(), issuer, role.Name), Check: resource.ComposeAggregateTestCheckFunc( @@ -988,6 +992,7 @@ func TestAcc_ExternalOauthIntegration_migrateFromV0941_ensureSmoothUpgradeWithNe CheckDestroy: acc.CheckDestroy(t, resources.ExternalOauthSecurityIntegration), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -1000,6 +1005,7 @@ func TestAcc_ExternalOauthIntegration_migrateFromV0941_ensureSmoothUpgradeWithNe ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: externalOauthIntegrationBasicConfig(id.Name()), Check: resource.ComposeAggregateTestCheckFunc( @@ -1022,6 +1028,7 @@ func TestAcc_ExternalOauthIntegration_WithQuotedName(t *testing.T) { CheckDestroy: acc.CheckDestroy(t, resources.ExternalOauthSecurityIntegration), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -1036,6 +1043,7 @@ func TestAcc_ExternalOauthIntegration_WithQuotedName(t *testing.T) { ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: externalOauthIntegrationBasicConfig(quotedId), ConfigPlanChecks: resource.ConfigPlanChecks{ diff --git a/pkg/resources/function_acceptance_test.go b/pkg/resources/function_acceptance_test.go index 439d7cd47b..52d60e3717 100644 --- a/pkg/resources/function_acceptance_test.go +++ b/pkg/resources/function_acceptance_test.go @@ -203,6 +203,7 @@ func TestAcc_Function_migrateFromVersion085(t *testing.T) { // Added as subtask SNOW-1057066 to SNOW-926148. Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.85.0", @@ -350,6 +351,7 @@ func TestAcc_Function_EnsureSmoothResourceIdMigrationToV0950(t *testing.T) { CheckDestroy: acc.CheckDestroy(t, resources.Function), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -362,6 +364,7 @@ func TestAcc_Function_EnsureSmoothResourceIdMigrationToV0950(t *testing.T) { ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: functionConfigWithMoreArguments(acc.TestDatabaseName, acc.TestSchemaName, name), Check: resource.ComposeTestCheckFunc( @@ -410,6 +413,7 @@ func TestAcc_Function_EnsureSmoothResourceIdMigrationToV0950_WithoutArguments(t CheckDestroy: acc.CheckDestroy(t, resources.Function), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -422,6 +426,7 @@ func TestAcc_Function_EnsureSmoothResourceIdMigrationToV0950_WithoutArguments(t ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: functionConfigWithoutArguments(acc.TestDatabaseName, acc.TestSchemaName, name), Check: resource.ComposeTestCheckFunc( diff --git a/pkg/resources/grant_account_role_acceptance_test.go b/pkg/resources/grant_account_role_acceptance_test.go index 3a05e90595..d9c8c786a3 100644 --- a/pkg/resources/grant_account_role_acceptance_test.go +++ b/pkg/resources/grant_account_role_acceptance_test.go @@ -103,6 +103,7 @@ func TestAcc_GrantAccountRole_migrateFromV0941_ensureSmoothUpgradeWithNewResourc }, Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -115,6 +116,7 @@ func TestAcc_GrantAccountRole_migrateFromV0941_ensureSmoothUpgradeWithNewResourc ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: grantAccountRoleBasicConfig(roleName.Name(), parentRoleName.Name()), ConfigPlanChecks: resource.ConfigPlanChecks{ @@ -164,6 +166,7 @@ func TestAcc_GrantAccountRole_IdentifierQuotingDiffSuppression(t *testing.T) { }, Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -174,6 +177,7 @@ func TestAcc_GrantAccountRole_IdentifierQuotingDiffSuppression(t *testing.T) { Config: grantAccountRoleBasicConfig(quotedRoleId, quotedParentRoleId), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: grantAccountRoleBasicConfig(quotedRoleId, quotedParentRoleId), ConfigPlanChecks: resource.ConfigPlanChecks{ diff --git a/pkg/resources/grant_application_role_acceptance_test.go b/pkg/resources/grant_application_role_acceptance_test.go index fb70f56a2f..6068063592 100644 --- a/pkg/resources/grant_application_role_acceptance_test.go +++ b/pkg/resources/grant_application_role_acceptance_test.go @@ -140,6 +140,7 @@ func TestAcc_GrantApplicationRole_migrateFromV0941_ensureSmoothUpgradeWithNewRes }, Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -152,6 +153,7 @@ func TestAcc_GrantApplicationRole_migrateFromV0941_ensureSmoothUpgradeWithNewRes ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: grantApplicationRoleBasicConfig(fmt.Sprintf(`\"%s\".\"%s\"`, appRoleId.DatabaseName(), appRoleId.Name()), parentRoleId.Name()), ConfigPlanChecks: resource.ConfigPlanChecks{ @@ -200,6 +202,7 @@ func TestAcc_GrantApplicationRole_IdentifierQuotingDiffSuppression(t *testing.T) }, Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -210,6 +213,7 @@ func TestAcc_GrantApplicationRole_IdentifierQuotingDiffSuppression(t *testing.T) Config: grantApplicationRoleBasicConfig(unquotedApplicationRoleId, quotedParentRoleId), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: grantApplicationRoleBasicConfig(unquotedApplicationRoleId, quotedParentRoleId), ConfigPlanChecks: resource.ConfigPlanChecks{ diff --git a/pkg/resources/grant_database_role_acceptance_test.go b/pkg/resources/grant_database_role_acceptance_test.go index 48120de920..ae43cc32fc 100644 --- a/pkg/resources/grant_database_role_acceptance_test.go +++ b/pkg/resources/grant_database_role_acceptance_test.go @@ -265,6 +265,7 @@ func TestAcc_GrantDatabaseRole_migrateFromV0941_ensureSmoothUpgradeWithNewResour }, Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -277,6 +278,7 @@ func TestAcc_GrantDatabaseRole_migrateFromV0941_ensureSmoothUpgradeWithNewResour ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: grantDatabaseRoleBasicConfigQuoted(databaseId.Name(), roleId.Name(), parentRoleId.Name()), ConfigPlanChecks: resource.ConfigPlanChecks{ @@ -353,6 +355,7 @@ func TestAcc_GrantDatabaseRole_IdentifierQuotingDiffSuppression(t *testing.T) { }, Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -367,6 +370,7 @@ func TestAcc_GrantDatabaseRole_IdentifierQuotingDiffSuppression(t *testing.T) { ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: grantDatabaseRoleBasicConfigUnquoted(databaseId.Name(), roleId.Name(), parentRoleId.Name()), ConfigPlanChecks: resource.ConfigPlanChecks{ diff --git a/pkg/resources/grant_ownership_acceptance_test.go b/pkg/resources/grant_ownership_acceptance_test.go index 4980f1bf37..e59975eb48 100644 --- a/pkg/resources/grant_ownership_acceptance_test.go +++ b/pkg/resources/grant_ownership_acceptance_test.go @@ -1360,6 +1360,7 @@ func TestAcc_GrantOwnership_migrateFromV0941_ensureSmoothUpgradeWithNewResourceI }, Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -1372,6 +1373,7 @@ func TestAcc_GrantOwnership_migrateFromV0941_ensureSmoothUpgradeWithNewResourceI ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: grantOwnershipOnTableBasicConfig(acc.TestDatabaseName, acc.TestSchemaName, tableId.Name(), accountRoleId.Name(), escapedFullyQualifiedName), ConfigPlanChecks: resource.ConfigPlanChecks{ @@ -1434,6 +1436,7 @@ func TestAcc_GrantOwnership_IdentifierQuotingDiffSuppression(t *testing.T) { }, Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -1447,6 +1450,7 @@ func TestAcc_GrantOwnership_IdentifierQuotingDiffSuppression(t *testing.T) { ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: grantOwnershipOnTableBasicConfigWithManagedDatabaseAndSchema(databaseId.Name(), schemaId.Name(), tableId.Name(), accountRoleId.Name(), unescapedFullyQualifiedName), ConfigPlanChecks: resource.ConfigPlanChecks{ diff --git a/pkg/resources/grant_privileges_to_account_role_acceptance_test.go b/pkg/resources/grant_privileges_to_account_role_acceptance_test.go index 15cdae3486..c9a0a44ce2 100644 --- a/pkg/resources/grant_privileges_to_account_role_acceptance_test.go +++ b/pkg/resources/grant_privileges_to_account_role_acceptance_test.go @@ -1750,6 +1750,7 @@ func TestAcc_GrantPrivilegesToAccountRole_migrateFromV0941_ensureSmoothUpgradeWi }, Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -1762,6 +1763,7 @@ func TestAcc_GrantPrivilegesToAccountRole_migrateFromV0941_ensureSmoothUpgradeWi ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: grantPrivilegesToAccountRoleBasicConfig(accountRoleId.Name(), accountRoleId.Name(), quotedSchemaId), ConfigPlanChecks: resource.ConfigPlanChecks{ @@ -1812,6 +1814,7 @@ func TestAcc_GrantPrivilegesToAccountRole_IdentifierQuotingDiffSuppression(t *te }, Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -1826,6 +1829,7 @@ func TestAcc_GrantPrivilegesToAccountRole_IdentifierQuotingDiffSuppression(t *te ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: grantPrivilegesToAccountRoleBasicConfig(accountRoleId.Name(), unquotedAccountRoleId, unquotedSchemaId), ConfigPlanChecks: resource.ConfigPlanChecks{ @@ -1913,6 +1917,7 @@ func TestAcc_GrantPrivilegesToAccountRole_OnFutureModels_issue3050(t *testing.T) CheckDestroy: acc.CheckAccountRolePrivilegesRevoked(t), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.95.0", @@ -1923,6 +1928,7 @@ func TestAcc_GrantPrivilegesToAccountRole_OnFutureModels_issue3050(t *testing.T) ExpectNonEmptyPlan: true, }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: grantPrivilegesToAccountRoleOnFutureInDatabaseConfig(accountRoleName, []string{"USAGE"}, sdk.PluralObjectTypeModels, databaseName), }, diff --git a/pkg/resources/grant_privileges_to_database_role_acceptance_test.go b/pkg/resources/grant_privileges_to_database_role_acceptance_test.go index b3b491cfd8..c1da413547 100644 --- a/pkg/resources/grant_privileges_to_database_role_acceptance_test.go +++ b/pkg/resources/grant_privileges_to_database_role_acceptance_test.go @@ -1388,6 +1388,7 @@ func TestAcc_GrantPrivilegesToDatabaseRole_migrateFromV0941_ensureSmoothUpgradeW }, Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -1400,6 +1401,7 @@ func TestAcc_GrantPrivilegesToDatabaseRole_migrateFromV0941_ensureSmoothUpgradeW ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: grantPrivilegesToDatabaseRoleBasicConfig(acc.TestClient().Ids.DatabaseId().Name(), databaseRoleId.Name(), quotedDatabaseRoleId, quotedSchemaId), ConfigPlanChecks: resource.ConfigPlanChecks{ @@ -1451,6 +1453,7 @@ func TestAcc_GrantPrivilegesToDatabaseRole_IdentifierQuotingDiffSuppression(t *t }, Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -1465,6 +1468,7 @@ func TestAcc_GrantPrivilegesToDatabaseRole_IdentifierQuotingDiffSuppression(t *t ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: grantPrivilegesToDatabaseRoleBasicConfig(acc.TestClient().Ids.DatabaseId().Name(), databaseRoleId.Name(), unquotedDatabaseRoleId, unquotedSchemaId), ConfigPlanChecks: resource.ConfigPlanChecks{ @@ -1498,6 +1502,7 @@ func TestAcc_GrantPrivilegesToDatabaseRole_OnFutureModels_issue3050(t *testing.T CheckDestroy: acc.CheckAccountRolePrivilegesRevoked(t), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.95.0", @@ -1508,6 +1513,7 @@ func TestAcc_GrantPrivilegesToDatabaseRole_OnFutureModels_issue3050(t *testing.T ExpectNonEmptyPlan: true, }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: grantPrivilegesToDatabaseRoleOnFutureInDatabaseConfig(databaseRoleId, []string{"USAGE"}, sdk.PluralObjectTypeModels, databaseName), }, diff --git a/pkg/resources/grant_privileges_to_share_acceptance_test.go b/pkg/resources/grant_privileges_to_share_acceptance_test.go index 78ae8a4a01..45c7bcd0c0 100644 --- a/pkg/resources/grant_privileges_to_share_acceptance_test.go +++ b/pkg/resources/grant_privileges_to_share_acceptance_test.go @@ -721,6 +721,7 @@ func TestAcc_GrantPrivilegesToShare_migrateFromV0941_ensureSmoothUpgradeWithNewR }, Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -733,6 +734,7 @@ func TestAcc_GrantPrivilegesToShare_migrateFromV0941_ensureSmoothUpgradeWithNewR ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: grantPrivilegesToShareBasicConfig(databaseId.Name(), shareId.Name()), ConfigPlanChecks: resource.ConfigPlanChecks{ @@ -783,6 +785,7 @@ func TestAcc_GrantPrivilegesToShare_IdentifierQuotingDiffSuppression(t *testing. }, Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -793,6 +796,7 @@ func TestAcc_GrantPrivilegesToShare_IdentifierQuotingDiffSuppression(t *testing. Config: grantPrivilegesToShareBasicConfig(quotedDatabaseId, quotedShareId), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: grantPrivilegesToShareBasicConfig(quotedDatabaseId, quotedShareId), ConfigPlanChecks: resource.ConfigPlanChecks{ diff --git a/pkg/resources/masking_policy_acceptance_test.go b/pkg/resources/masking_policy_acceptance_test.go index 98a3648fb9..ac8e055173 100644 --- a/pkg/resources/masking_policy_acceptance_test.go +++ b/pkg/resources/masking_policy_acceptance_test.go @@ -413,6 +413,7 @@ func TestAcc_MaskingPolicy_migrateFromVersion_0_94_1(t *testing.T) { Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -426,6 +427,7 @@ func TestAcc_MaskingPolicy_migrateFromVersion_0_94_1(t *testing.T) { ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, ConfigDirectory: acc.ConfigurationDirectory("TestAcc_MaskingPolicy/basic"), ConfigVariables: tfconfig.ConfigVariablesFromModel(t, policyModel), @@ -570,6 +572,7 @@ func TestAcc_MaskingPolicy_migrateFromVersion_0_95_0(t *testing.T) { PreCheck: func() { acc.TestAccPreCheck(t) }, Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.95.0", @@ -594,6 +597,7 @@ func TestAcc_MaskingPolicy_migrateFromVersion_0_95_0(t *testing.T) { ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, ConfigDirectory: acc.ConfigurationDirectory("TestAcc_MaskingPolicy/complete"), ConfigVariables: tfconfig.ConfigVariablesFromModel(t, policyModel), diff --git a/pkg/resources/network_policy_acceptance_test.go b/pkg/resources/network_policy_acceptance_test.go index 7ba7a143f2..b205528ee0 100644 --- a/pkg/resources/network_policy_acceptance_test.go +++ b/pkg/resources/network_policy_acceptance_test.go @@ -479,6 +479,7 @@ func TestAcc_NetworkPolicy_Issue2236(t *testing.T) { // Identifier quoting mismatch (no diff suppression) ExpectNonEmptyPlan: true, PreConfig: func() { + func() { acc.SetV097CompatibleConfigPathEnv(t) }() acc.TestClient().NetworkRule.CreateWithIdentifier(t, allowedNetworkRuleId) acc.TestClient().NetworkRule.CreateWithIdentifier(t, allowedNetworkRuleId2) acc.TestClient().NetworkRule.CreateWithIdentifier(t, blockedNetworkRuleId) @@ -502,6 +503,7 @@ func TestAcc_NetworkPolicy_Issue2236(t *testing.T) { ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: networkPolicyConfigWithNetworkRules( id.Name(), @@ -554,6 +556,7 @@ func TestAcc_NetworkPolicy_migrateFromV0941_ensureSmoothUpgradeWithNewResourceId CheckDestroy: acc.CheckDestroy(t, resources.NetworkPolicy), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -566,6 +569,7 @@ func TestAcc_NetworkPolicy_migrateFromV0941_ensureSmoothUpgradeWithNewResourceId ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: networkPolicyConfigBasic(id.Name()), Check: resource.ComposeAggregateTestCheckFunc( @@ -588,6 +592,7 @@ func TestAcc_NetworkPolicy_WithQuotedName(t *testing.T) { CheckDestroy: acc.CheckDestroy(t, resources.NetworkPolicy), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -602,6 +607,7 @@ func TestAcc_NetworkPolicy_WithQuotedName(t *testing.T) { ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: networkPolicyConfigBasic(quotedId), ConfigPlanChecks: resource.ConfigPlanChecks{ diff --git a/pkg/resources/network_rule_acceptance_test.go b/pkg/resources/network_rule_acceptance_test.go index 0c4e274d88..c6b6bea422 100644 --- a/pkg/resources/network_rule_acceptance_test.go +++ b/pkg/resources/network_rule_acceptance_test.go @@ -134,6 +134,7 @@ func TestAcc_NetworkRule_migrateFromVersion_0_94_1(t *testing.T) { Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -147,6 +148,7 @@ func TestAcc_NetworkRule_migrateFromVersion_0_94_1(t *testing.T) { ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: networkRuleIpv4(id.Name(), acc.TestDatabaseName, acc.TestSchemaName), Check: resource.ComposeTestCheckFunc( diff --git a/pkg/resources/notification_integration_acceptance_test.go b/pkg/resources/notification_integration_acceptance_test.go index fc473440aa..ffdb782367 100644 --- a/pkg/resources/notification_integration_acceptance_test.go +++ b/pkg/resources/notification_integration_acceptance_test.go @@ -232,6 +232,7 @@ func TestAcc_NotificationIntegration_migrateFromVersion085(t *testing.T) { CheckDestroy: acc.CheckDestroy(t, resources.NotificationIntegration), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.85.0", @@ -246,6 +247,7 @@ func TestAcc_NotificationIntegration_migrateFromVersion085(t *testing.T) { ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: googleAutoConfigWithoutDirection(accName, gcpPubsubSubscriptionName), ConfigPlanChecks: resource.ConfigPlanChecks{ @@ -276,6 +278,7 @@ func TestAcc_NotificationIntegration_migrateFromVersion085_explicitType(t *testi CheckDestroy: acc.CheckDestroy(t, resources.NotificationIntegration), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.85.0", @@ -288,6 +291,7 @@ func TestAcc_NotificationIntegration_migrateFromVersion085_explicitType(t *testi ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: googleAutoConfig(accName, gcpPubsubSubscriptionName), ConfigPlanChecks: resource.ConfigPlanChecks{ diff --git a/pkg/resources/oauth_integration_for_custom_clients_acceptance_test.go b/pkg/resources/oauth_integration_for_custom_clients_acceptance_test.go index 0f77f4e16b..be88ceab7c 100644 --- a/pkg/resources/oauth_integration_for_custom_clients_acceptance_test.go +++ b/pkg/resources/oauth_integration_for_custom_clients_acceptance_test.go @@ -682,6 +682,7 @@ func TestAcc_OauthIntegrationForCustomClients_migrateFromV0941_ensureSmoothUpgra CheckDestroy: acc.CheckDestroy(t, resourcenames.OauthIntegrationForCustomClients), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -694,6 +695,7 @@ func TestAcc_OauthIntegrationForCustomClients_migrateFromV0941_ensureSmoothUpgra ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: oauthIntegrationForCustomClientsBasicConfig(id.Name()), Check: resource.ComposeAggregateTestCheckFunc( @@ -716,6 +718,7 @@ func TestAcc_OauthIntegrationForCustomClients_WithQuotedName(t *testing.T) { CheckDestroy: acc.CheckDestroy(t, resourcenames.OauthIntegrationForCustomClients), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -730,6 +733,7 @@ func TestAcc_OauthIntegrationForCustomClients_WithQuotedName(t *testing.T) { ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: oauthIntegrationForCustomClientsBasicConfig(quotedId), ConfigPlanChecks: resource.ConfigPlanChecks{ diff --git a/pkg/resources/oauth_integration_for_partner_applications_acceptance_test.go b/pkg/resources/oauth_integration_for_partner_applications_acceptance_test.go index e9bfe4d778..0eccde347c 100644 --- a/pkg/resources/oauth_integration_for_partner_applications_acceptance_test.go +++ b/pkg/resources/oauth_integration_for_partner_applications_acceptance_test.go @@ -687,6 +687,7 @@ func TestAcc_OauthIntegrationForPartnerApplications_migrateFromV0941_ensureSmoot CheckDestroy: acc.CheckDestroy(t, resources.OauthIntegrationForPartnerApplications), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -699,6 +700,7 @@ func TestAcc_OauthIntegrationForPartnerApplications_migrateFromV0941_ensureSmoot ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: oauthIntegrationForPartnerApplicationsBasicConfig(id.Name()), Check: resource.ComposeAggregateTestCheckFunc( @@ -721,6 +723,7 @@ func TestAcc_OauthIntegrationForPartnerApplications_WithQuotedName(t *testing.T) CheckDestroy: acc.CheckDestroy(t, resources.OauthIntegrationForPartnerApplications), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -735,6 +738,7 @@ func TestAcc_OauthIntegrationForPartnerApplications_WithQuotedName(t *testing.T) ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: oauthIntegrationForPartnerApplicationsBasicConfig(quotedId), ConfigPlanChecks: resource.ConfigPlanChecks{ diff --git a/pkg/resources/password_policy_acceptance_test.go b/pkg/resources/password_policy_acceptance_test.go index 6fef84a84d..cf978abc3d 100644 --- a/pkg/resources/password_policy_acceptance_test.go +++ b/pkg/resources/password_policy_acceptance_test.go @@ -197,6 +197,7 @@ func TestAcc_PasswordPolicy_migrateFromVersion_0_94_1(t *testing.T) { Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -210,6 +211,7 @@ func TestAcc_PasswordPolicy_migrateFromVersion_0_94_1(t *testing.T) { ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: passwordPolicyBasicConfig(id), Check: resource.ComposeTestCheckFunc( diff --git a/pkg/resources/procedure_acceptance_test.go b/pkg/resources/procedure_acceptance_test.go index 6d0ec93b58..05cbfbfd73 100644 --- a/pkg/resources/procedure_acceptance_test.go +++ b/pkg/resources/procedure_acceptance_test.go @@ -212,6 +212,7 @@ func TestAcc_Procedure_migrateFromVersion085(t *testing.T) { Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.85.0", @@ -276,6 +277,7 @@ func TestAcc_Procedure_proveArgsPermanentDiff(t *testing.T) { CheckDestroy: acc.CheckDestroy(t, resources.Procedure), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.89.0", @@ -292,6 +294,7 @@ func TestAcc_Procedure_proveArgsPermanentDiff(t *testing.T) { }, }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: sqlProcedureConfigArgsPermanentDiff(acc.TestDatabaseName, acc.TestSchemaName, name), ConfigPlanChecks: resource.ConfigPlanChecks{ @@ -319,6 +322,7 @@ func TestAcc_Procedure_returnTypePermanentDiff(t *testing.T) { CheckDestroy: acc.CheckDestroy(t, resources.Procedure), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.89.0", @@ -335,6 +339,7 @@ func TestAcc_Procedure_returnTypePermanentDiff(t *testing.T) { }, }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: sqlProcedureConfigReturnTypePermanentDiff(acc.TestDatabaseName, acc.TestSchemaName, name), Check: resource.ComposeTestCheckFunc( @@ -408,6 +413,7 @@ func TestAcc_Procedure_EnsureSmoothResourceIdMigrationToV0950(t *testing.T) { CheckDestroy: acc.CheckDestroy(t, resources.Procedure), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -420,6 +426,7 @@ func TestAcc_Procedure_EnsureSmoothResourceIdMigrationToV0950(t *testing.T) { ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: procedureConfigWithMoreArguments(acc.TestDatabaseName, acc.TestSchemaName, name), Check: resource.ComposeTestCheckFunc( @@ -472,6 +479,7 @@ func TestAcc_Procedure_EnsureSmoothResourceIdMigrationToV0950_WithoutArguments(t CheckDestroy: acc.CheckDestroy(t, resources.Function), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -484,6 +492,7 @@ func TestAcc_Procedure_EnsureSmoothResourceIdMigrationToV0950_WithoutArguments(t ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: procedureConfigWithoutArguments(acc.TestDatabaseName, acc.TestSchemaName, name), Check: resource.ComposeTestCheckFunc( @@ -523,6 +532,7 @@ func TestAcc_Procedure_EnsureSmoothResourceIdMigrationToV0950_ArgumentSynonyms(t CheckDestroy: acc.CheckDestroy(t, resources.Procedure), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -535,6 +545,7 @@ func TestAcc_Procedure_EnsureSmoothResourceIdMigrationToV0950_ArgumentSynonyms(t ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: procedureConfigWithArgumentSynonyms(acc.TestDatabaseName, acc.TestSchemaName, name), Check: resource.ComposeTestCheckFunc( diff --git a/pkg/resources/resource_monitor_acceptance_test.go b/pkg/resources/resource_monitor_acceptance_test.go index 0f7a02322a..00b99b9227 100644 --- a/pkg/resources/resource_monitor_acceptance_test.go +++ b/pkg/resources/resource_monitor_acceptance_test.go @@ -529,6 +529,7 @@ func TestAcc_ResourceMonitor_Issue1990_RemovingResourceMonitorOutsideOfTerraform Steps: []resource.TestStep{ // Create resource monitor { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.69.0", @@ -564,6 +565,7 @@ func TestAcc_ResourceMonitor_Issue1990_RemovingResourceMonitorOutsideOfTerraform }, // Same configuration, but it's the latest version of the provider (0.96.0 and above) { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: config.FromModel(t, configModel), }, @@ -599,6 +601,7 @@ func TestAcc_ResourceMonitor_Issue_TimestampInfinitePlan(t *testing.T) { Steps: []resource.TestStep{ // Create resource monitor without the timestamps { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.90.0", @@ -641,6 +644,7 @@ func TestAcc_ResourceMonitor_Issue_TimestampInfinitePlan(t *testing.T) { }, // Create resource monitor without the timestamps { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: config.FromModel(t, configModel), }, @@ -678,6 +682,7 @@ func TestAcc_ResourceMonitor_Issue1500_CreatingWithOnlyTriggers(t *testing.T) { Steps: []resource.TestStep{ // Create resource monitor with only triggers (old version) { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.90.0", @@ -689,6 +694,7 @@ func TestAcc_ResourceMonitor_Issue1500_CreatingWithOnlyTriggers(t *testing.T) { }, // Create resource monitor with only triggers (the latest version) { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: config.FromModel(t, configModel), ExpectError: regexp.MustCompile("due to Snowflake limiltations you cannot create Resource Monitor with only triggers set"), @@ -730,6 +736,7 @@ func TestAcc_ResourceMonitor_Issue1500_AlteringWithOnlyTriggers(t *testing.T) { CheckDestroy: acc.CheckDestroy(t, resources.ResourceMonitor), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.90.0", @@ -763,6 +770,7 @@ func TestAcc_ResourceMonitor_Issue1500_AlteringWithOnlyTriggers(t *testing.T) { }, // Upgrade to the latest version { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: config.FromModel(t, configModelWithCreditQuota), }, @@ -898,6 +906,7 @@ func TestAcc_ResourceMonitor_SetForWarehouse(t *testing.T) { CheckDestroy: acc.CheckDestroy(t, resources.ResourceMonitor), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.90.0", @@ -917,6 +926,7 @@ resource "snowflake_resource_monitor" "test" { ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: fmt.Sprintf(` resource "snowflake_resource_monitor" "test" { diff --git a/pkg/resources/row_access_policy_acceptance_test.go b/pkg/resources/row_access_policy_acceptance_test.go index 5dfeddcaed..e553d16a73 100644 --- a/pkg/resources/row_access_policy_acceptance_test.go +++ b/pkg/resources/row_access_policy_acceptance_test.go @@ -208,6 +208,7 @@ func TestAcc_RowAccessPolicy_Issue2053(t *testing.T) { PreCheck: func() { acc.TestAccPreCheck(t) }, Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.95.0", @@ -228,6 +229,7 @@ func TestAcc_RowAccessPolicy_Issue2053(t *testing.T) { ExpectNonEmptyPlan: true, }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, ConfigDirectory: acc.ConfigurationDirectory("TestAcc_RowAccessPolicy/basic"), ConfigVariables: tfconfig.ConfigVariablesFromModel(t, policyModel), @@ -425,6 +427,7 @@ func TestAcc_RowAccessPolicy_migrateFromVersion_0_95_0_LowercaseArgName(t *testi PreCheck: func() { acc.TestAccPreCheck(t) }, Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.95.0", @@ -450,6 +453,7 @@ func TestAcc_RowAccessPolicy_migrateFromVersion_0_95_0_LowercaseArgName(t *testi ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, ConfigDirectory: acc.ConfigurationDirectory("TestAcc_RowAccessPolicy/basic"), ConfigVariables: tfconfig.ConfigVariablesFromModel(t, policyModel), @@ -505,6 +509,7 @@ func TestAcc_RowAccessPolicy_migrateFromVersion_0_95_0_UppercaseArgName(t *testi PreCheck: func() { acc.TestAccPreCheck(t) }, Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.95.0", @@ -530,6 +535,7 @@ func TestAcc_RowAccessPolicy_migrateFromVersion_0_95_0_UppercaseArgName(t *testi ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, ConfigDirectory: acc.ConfigurationDirectory("TestAcc_RowAccessPolicy/basic"), ConfigVariables: tfconfig.ConfigVariablesFromModel(t, policyModel), diff --git a/pkg/resources/saml2_integration_acceptance_test.go b/pkg/resources/saml2_integration_acceptance_test.go index 352c58c884..4493a6a248 100644 --- a/pkg/resources/saml2_integration_acceptance_test.go +++ b/pkg/resources/saml2_integration_acceptance_test.go @@ -1082,6 +1082,7 @@ func TestAcc_Saml2Integration_migrateFromV0941_ensureSmoothUpgradeWithNewResourc CheckDestroy: acc.CheckDestroy(t, resources.Saml2SecurityIntegration), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -1094,6 +1095,7 @@ func TestAcc_Saml2Integration_migrateFromV0941_ensureSmoothUpgradeWithNewResourc ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: saml2IntegrationBasicConfig(id.Name(), cert), Check: resource.ComposeAggregateTestCheckFunc( @@ -1117,6 +1119,7 @@ func TestAcc_Saml2Integration_IdentifierQuotingDiffSuppression(t *testing.T) { CheckDestroy: acc.CheckDestroy(t, resources.Saml2SecurityIntegration), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -1131,6 +1134,7 @@ func TestAcc_Saml2Integration_IdentifierQuotingDiffSuppression(t *testing.T) { ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: saml2IntegrationBasicConfig(quotedId, cert), ConfigPlanChecks: resource.ConfigPlanChecks{ diff --git a/pkg/resources/schema_acceptance_test.go b/pkg/resources/schema_acceptance_test.go index 03551b68f5..179df30392 100644 --- a/pkg/resources/schema_acceptance_test.go +++ b/pkg/resources/schema_acceptance_test.go @@ -465,6 +465,7 @@ func TestAcc_Schema_ManagePublicVersion_0_94_0(t *testing.T) { Steps: []resource.TestStep{ // PUBLIC can not be created in v0.93 { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.93.0", @@ -543,6 +544,7 @@ func TestAcc_Schema_ManagePublicVersion_0_94_1(t *testing.T) { Steps: []resource.TestStep{ // PUBLIC can not be created in v0.93 { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.93.0", @@ -553,6 +555,7 @@ func TestAcc_Schema_ManagePublicVersion_0_94_1(t *testing.T) { ExpectError: regexp.MustCompile("Error: error creating schema PUBLIC"), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: schemav094WithPipeExecutionPaused(name, db.ID().Name(), true), Check: resource.ComposeTestCheckFunc( @@ -958,6 +961,7 @@ func TestAcc_Schema_migrateFromVersion093WithoutManagedAccess(t *testing.T) { Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.93.0", @@ -971,6 +975,7 @@ func TestAcc_Schema_migrateFromVersion093WithoutManagedAccess(t *testing.T) { ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: schemav094(id.Name(), databaseId.Name()), Check: resource.ComposeAggregateTestCheckFunc( @@ -1000,6 +1005,7 @@ func TestAcc_Schema_migrateFromVersion093(t *testing.T) { Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.93.0", @@ -1017,6 +1023,7 @@ func TestAcc_Schema_migrateFromVersion093(t *testing.T) { ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: schemav094WithManagedAccessAndDataRetentionTimeInDays(id.Name(), databaseId.Name(), true, 10), Check: resource.ComposeAggregateTestCheckFunc( @@ -1104,6 +1111,7 @@ func TestAcc_Schema_migrateFromV0941_ensureSmoothUpgradeWithNewResourceId(t *tes CheckDestroy: acc.CheckDestroy(t, resources.Schema), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -1116,6 +1124,7 @@ func TestAcc_Schema_migrateFromV0941_ensureSmoothUpgradeWithNewResourceId(t *tes ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: schemaBasicConfig(id.DatabaseName(), id.Name()), Check: resource.ComposeAggregateTestCheckFunc( @@ -1148,6 +1157,7 @@ func TestAcc_Schema_IdentifierQuotingDiffSuppression(t *testing.T) { CheckDestroy: acc.CheckDestroy(t, resources.Schema), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -1163,6 +1173,7 @@ func TestAcc_Schema_IdentifierQuotingDiffSuppression(t *testing.T) { ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: schemaBasicConfig(quotedDatabaseName, quotedName), ConfigPlanChecks: resource.ConfigPlanChecks{ diff --git a/pkg/resources/scim_integration_acceptance_test.go b/pkg/resources/scim_integration_acceptance_test.go index a1a3812f82..aa8f838cdc 100644 --- a/pkg/resources/scim_integration_acceptance_test.go +++ b/pkg/resources/scim_integration_acceptance_test.go @@ -425,6 +425,7 @@ func TestAcc_ScimIntegration_migrateFromVersion092EnabledTrue(t *testing.T) { Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.92.0", @@ -438,6 +439,7 @@ func TestAcc_ScimIntegration_migrateFromVersion092EnabledTrue(t *testing.T) { ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: scimIntegrationv093(id.Name(), role.Name(), true, sdk.ScimSecurityIntegrationScimClientGeneric), ConfigPlanChecks: resource.ConfigPlanChecks{ @@ -473,6 +475,7 @@ func TestAcc_ScimIntegration_migrateFromVersion092EnabledFalse(t *testing.T) { Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.92.0", @@ -486,6 +489,7 @@ func TestAcc_ScimIntegration_migrateFromVersion092EnabledFalse(t *testing.T) { ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: scimIntegrationv093(id.Name(), role.Name(), false, sdk.ScimSecurityIntegrationScimClientGeneric), ConfigPlanChecks: resource.ConfigPlanChecks{ @@ -514,6 +518,7 @@ func TestAcc_ScimIntegration_migrateFromVersion093HandleSyncPassword(t *testing. Steps: []resource.TestStep{ // create resource with v0.92 { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.92.0", @@ -547,6 +552,7 @@ func TestAcc_ScimIntegration_migrateFromVersion093HandleSyncPassword(t *testing. }, // check with newest version - the value in state was set to boolean default, so there should be no diff { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: scimIntegrationv093(id.Name(), role.Name(), true, sdk.ScimSecurityIntegrationScimClientAzure), ConfigPlanChecks: resource.ConfigPlanChecks{ @@ -596,6 +602,7 @@ func TestAcc_ScimIntegration_migrateFromV0941_ensureSmoothUpgradeWithNewResource CheckDestroy: acc.CheckDestroy(t, resources.ScimSecurityIntegration), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -608,6 +615,7 @@ func TestAcc_ScimIntegration_migrateFromV0941_ensureSmoothUpgradeWithNewResource ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: scimIntegrationBasicConfig(id.Name()), Check: resource.ComposeAggregateTestCheckFunc( @@ -630,6 +638,7 @@ func TestAcc_ScimIntegration_IdentifierQuotingDiffSuppression(t *testing.T) { CheckDestroy: acc.CheckDestroy(t, resources.ScimSecurityIntegration), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -644,6 +653,7 @@ func TestAcc_ScimIntegration_IdentifierQuotingDiffSuppression(t *testing.T) { ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: scimIntegrationBasicConfig(quotedId), ConfigPlanChecks: resource.ConfigPlanChecks{ diff --git a/pkg/resources/secondary_database_acceptance_test.go b/pkg/resources/secondary_database_acceptance_test.go index e499a08317..22cb7c5611 100644 --- a/pkg/resources/secondary_database_acceptance_test.go +++ b/pkg/resources/secondary_database_acceptance_test.go @@ -541,6 +541,7 @@ func TestAcc_SecondaryDatabase_migrateFromV0941_ensureSmoothUpgradeWithNewResour CheckDestroy: acc.CheckDestroy(t, resources.SecondaryDatabase), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -553,6 +554,7 @@ func TestAcc_SecondaryDatabase_migrateFromV0941_ensureSmoothUpgradeWithNewResour ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: secondaryDatabaseConfigBasic(id.Name(), externalPrimaryId.FullyQualifiedName()), Check: resource.ComposeAggregateTestCheckFunc( @@ -591,6 +593,7 @@ func TestAcc_SecondaryDatabase_IdentifierQuotingDiffSuppression(t *testing.T) { CheckDestroy: acc.CheckDestroy(t, resources.SecondaryDatabase), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -605,6 +608,7 @@ func TestAcc_SecondaryDatabase_IdentifierQuotingDiffSuppression(t *testing.T) { ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: secondaryDatabaseConfigBasic(quotedId, unquotedExternalPrimaryId), ConfigPlanChecks: resource.ConfigPlanChecks{ diff --git a/pkg/resources/shared_database_acceptance_test.go b/pkg/resources/shared_database_acceptance_test.go index c31314899e..5c05b8dce2 100644 --- a/pkg/resources/shared_database_acceptance_test.go +++ b/pkg/resources/shared_database_acceptance_test.go @@ -306,6 +306,7 @@ func TestAcc_SharedDatabase_migrateFromV0941_ensureSmoothUpgradeWithNewResourceI CheckDestroy: acc.CheckDestroy(t, resources.SharedDatabase), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -318,6 +319,7 @@ func TestAcc_SharedDatabase_migrateFromV0941_ensureSmoothUpgradeWithNewResourceI ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: sharedDatabaseConfigBasic(id.Name(), externalShareId.FullyQualifiedName()), Check: resource.ComposeAggregateTestCheckFunc( @@ -355,6 +357,7 @@ func TestAcc_SharedDatabase_IdentifierQuotingDiffSuppression(t *testing.T) { CheckDestroy: acc.CheckDestroy(t, resources.SharedDatabase), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -369,6 +372,7 @@ func TestAcc_SharedDatabase_IdentifierQuotingDiffSuppression(t *testing.T) { ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: sharedDatabaseConfigBasic(quotedId, unquotedExternalShareId), ConfigPlanChecks: resource.ConfigPlanChecks{ diff --git a/pkg/resources/streamlit_acceptance_test.go b/pkg/resources/streamlit_acceptance_test.go index f18722a6c3..415bd2a22a 100644 --- a/pkg/resources/streamlit_acceptance_test.go +++ b/pkg/resources/streamlit_acceptance_test.go @@ -449,6 +449,7 @@ func TestAcc_Streamlit_migrateFromV0941_ensureSmoothUpgradeWithNewResourceId(t * CheckDestroy: acc.CheckDestroy(t, resources.Streamlit), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -461,6 +462,7 @@ func TestAcc_Streamlit_migrateFromV0941_ensureSmoothUpgradeWithNewResourceId(t * ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: streamlitBasicConfig(id, stage.ID(), "main_file"), Check: resource.ComposeAggregateTestCheckFunc( @@ -501,6 +503,7 @@ func TestAcc_Streamlit_IdentifierQuotingDiffSuppression(t *testing.T) { CheckDestroy: acc.CheckDestroy(t, resources.Streamlit), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -517,6 +520,7 @@ func TestAcc_Streamlit_IdentifierQuotingDiffSuppression(t *testing.T) { ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: streamlitBasicConfigWithRawIdentifierValues(quotedDatabaseName, quotedSchemaName, quotedName, stage.ID().Name(), "main_file"), ConfigPlanChecks: resource.ConfigPlanChecks{ diff --git a/pkg/resources/table_acceptance_test.go b/pkg/resources/table_acceptance_test.go index f0fc349780..caeeb1daaf 100644 --- a/pkg/resources/table_acceptance_test.go +++ b/pkg/resources/table_acceptance_test.go @@ -1994,6 +1994,7 @@ func TestAcc_Table_migrateFromVersion_0_94_1(t *testing.T) { Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -2007,6 +2008,7 @@ func TestAcc_Table_migrateFromVersion_0_94_1(t *testing.T) { ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: tableConfig(id.Name(), id.DatabaseName(), id.SchemaName()), Check: resource.ComposeTestCheckFunc( @@ -2032,6 +2034,7 @@ func TestAcc_Table_SuppressQuotingOnDefaultSequence_issue2644(t *testing.T) { }, Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -2042,6 +2045,7 @@ func TestAcc_Table_SuppressQuotingOnDefaultSequence_issue2644(t *testing.T) { Config: tableConfigWithSequence(name, databaseName, schemaName), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: tableConfigWithSequence(name, databaseName, schemaName), Check: resource.ComposeTestCheckFunc( diff --git a/pkg/resources/table_constraint_acceptance_test.go b/pkg/resources/table_constraint_acceptance_test.go index 2feb8eca0c..89c83573a5 100644 --- a/pkg/resources/table_constraint_acceptance_test.go +++ b/pkg/resources/table_constraint_acceptance_test.go @@ -232,6 +232,7 @@ func TestAcc_Table_issue2535_newConstraint(t *testing.T) { CheckDestroy: nil, Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.86.0", @@ -254,6 +255,7 @@ func TestAcc_Table_issue2535_newConstraint(t *testing.T) { ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: tableConstraintUniqueConfigUsingTableId(accName, acc.TestDatabaseName, acc.TestSchemaName, "|"), ExpectError: regexp.MustCompile(`.*Expected SchemaObjectIdentifier identifier type, but got:.*`), @@ -282,6 +284,7 @@ func TestAcc_Table_issue2535_existingTable(t *testing.T) { Steps: []resource.TestStep{ // reference done by table.id in 0.85.0 { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.85.0", @@ -306,6 +309,7 @@ func TestAcc_Table_issue2535_existingTable(t *testing.T) { }, // fixed in the current version { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: tableConstraintUniqueConfigUsingFullyQualifiedName(accName, acc.TestDatabaseName, acc.TestSchemaName), Check: resource.ComposeTestCheckFunc( diff --git a/pkg/resources/user_acceptance_test.go b/pkg/resources/user_acceptance_test.go index 17e5ef747d..137dadcf2d 100644 --- a/pkg/resources/user_acceptance_test.go +++ b/pkg/resources/user_acceptance_test.go @@ -1350,6 +1350,7 @@ func TestAcc_User_migrateFromVersion094_noDefaultSecondaryRolesSet(t *testing.T) CheckDestroy: acc.CheckDestroy(t, resources.User), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -1363,6 +1364,7 @@ func TestAcc_User_migrateFromVersion094_noDefaultSecondaryRolesSet(t *testing.T) ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: config.FromModel(t, userModel), ConfigPlanChecks: resource.ConfigPlanChecks{ @@ -1395,6 +1397,7 @@ func TestAcc_User_migrateFromVersion094_defaultSecondaryRolesSet(t *testing.T) { CheckDestroy: acc.CheckDestroy(t, resources.User), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -1413,6 +1416,7 @@ resource "snowflake_user" "test" { ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: config.FromModel(t, userModelWithOptionAll), ConfigPlanChecks: resource.ConfigPlanChecks{ @@ -1669,6 +1673,7 @@ func TestAcc_User_handleChangesToShowUsers_bcr202408_migration_bcr202407_enabled { PreConfig: func() { acc.TestClient().BcrBundles.EnableBcrBundle(t, "2024_07") + func() { acc.SetV097CompatibleConfigPathEnv(t) }() }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { @@ -1685,6 +1690,7 @@ func TestAcc_User_handleChangesToShowUsers_bcr202408_migration_bcr202407_enabled { PreConfig: func() { acc.TestClient().BcrBundles.EnableBcrBundle(t, "2024_08") + func() { acc.UnsetConfigPathEnv(t) }() }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: config.FromModel(t, userModel), @@ -1724,7 +1730,8 @@ func TestAcc_User_handleChangesToShowUsers_bcr202408_migration_bcr202407_disable Source: "Snowflake-Labs/snowflake", }, }, - Config: config.FromModel(t, userModel), + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, + Config: config.FromModel(t, userModel), Check: assert.AssertThat(t, resourceassert.UserResource(t, userModel.ResourceReference()). HasAllDefaults(userId, sdk.SecondaryRolesOptionDefault), @@ -1733,6 +1740,7 @@ func TestAcc_User_handleChangesToShowUsers_bcr202408_migration_bcr202407_disable { PreConfig: func() { acc.TestClient().BcrBundles.EnableBcrBundle(t, "2024_08") + func() { acc.UnsetConfigPathEnv(t) }() }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: config.FromModel(t, userModel), diff --git a/pkg/resources/user_password_policy_attachment_acceptance_test.go b/pkg/resources/user_password_policy_attachment_acceptance_test.go index 192471ec6b..ce3b8e4335 100644 --- a/pkg/resources/user_password_policy_attachment_acceptance_test.go +++ b/pkg/resources/user_password_policy_attachment_acceptance_test.go @@ -82,7 +82,8 @@ func TestAcc_UserPasswordPolicyAttachment_gh3005(t *testing.T) { Steps: []resource.TestStep{ // CREATE { - Config: userPasswordPolicyAttachmentConfigV087(userName, acc.TestDatabaseName, acc.TestSchemaName, passwordPolicyName), + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, + Config: userPasswordPolicyAttachmentConfigV087(userName, acc.TestDatabaseName, acc.TestSchemaName, passwordPolicyName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("snowflake_user_password_policy_attachment.ppa", "user_name", userName), resource.TestCheckResourceAttr("snowflake_user_password_policy_attachment.ppa", "password_policy_name", passwordPolicyId.FullyQualifiedName()), diff --git a/pkg/resources/view_acceptance_test.go b/pkg/resources/view_acceptance_test.go index 462f4ee6b8..2db7a4d7a1 100644 --- a/pkg/resources/view_acceptance_test.go +++ b/pkg/resources/view_acceptance_test.go @@ -1253,6 +1253,7 @@ func TestAcc_view_migrateFromVersion_0_94_1(t *testing.T) { Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -1269,6 +1270,7 @@ func TestAcc_view_migrateFromVersion_0_94_1(t *testing.T) { ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, ConfigDirectory: acc.ConfigurationDirectory("TestAcc_View/basic"), ConfigVariables: viewConfig, diff --git a/pkg/resources/warehouse_acceptance_test.go b/pkg/resources/warehouse_acceptance_test.go index 2d49146eed..49f3d678ce 100644 --- a/pkg/resources/warehouse_acceptance_test.go +++ b/pkg/resources/warehouse_acceptance_test.go @@ -1452,6 +1452,7 @@ func TestAcc_Warehouse_migrateFromVersion092_withWarehouseSize(t *testing.T) { Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.92.0", @@ -1465,6 +1466,7 @@ func TestAcc_Warehouse_migrateFromVersion092_withWarehouseSize(t *testing.T) { ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ @@ -1493,6 +1495,7 @@ func TestAcc_Warehouse_migrateFromVersion092_allFieldsFilledBeforeMigration(t *t Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.92.0", @@ -1507,6 +1510,7 @@ func TestAcc_Warehouse_migrateFromVersion092_allFieldsFilledBeforeMigration(t *t ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: warehouseFullMigrationConfig(id.Name(), false), ConfigPlanChecks: resource.ConfigPlanChecks{ @@ -1553,6 +1557,7 @@ func TestAcc_Warehouse_migrateFromVersion092_allFieldsFilledBeforeMigration_bool Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.92.0", @@ -1569,6 +1574,7 @@ func TestAcc_Warehouse_migrateFromVersion092_allFieldsFilledBeforeMigration_bool }, // let's try to change the value of the parameter that was earlier a bool and now is a string { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ @@ -1600,6 +1606,7 @@ func TestAcc_Warehouse_migrateFromVersion092_queryAccelerationMaxScaleFactor_sam Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.92.0", @@ -1613,6 +1620,7 @@ func TestAcc_Warehouse_migrateFromVersion092_queryAccelerationMaxScaleFactor_sam ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: warehouseFullDefaultConfig(id.Name(), ""), ConfigPlanChecks: resource.ConfigPlanChecks{ @@ -1646,6 +1654,7 @@ func TestAcc_Warehouse_migrateFromVersion092_queryAccelerationMaxScaleFactor_noI Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.92.0", @@ -1659,6 +1668,7 @@ func TestAcc_Warehouse_migrateFromVersion092_queryAccelerationMaxScaleFactor_noI ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: warehouseFullDefaultConfigWithQueryAccelerationMaxScaleFactorRemoved(id.Name(), ""), ConfigPlanChecks: resource.ConfigPlanChecks{ @@ -1692,6 +1702,7 @@ func TestAcc_Warehouse_migrateFromVersion092_queryAccelerationMaxScaleFactor_dif Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.92.0", @@ -1705,6 +1716,7 @@ func TestAcc_Warehouse_migrateFromVersion092_queryAccelerationMaxScaleFactor_dif ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: warehouseFullDefaultConfigWithQueryAcceleration(id.Name(), "", true, 10), ConfigPlanChecks: resource.ConfigPlanChecks{ @@ -1737,6 +1749,7 @@ func TestAcc_Warehouse_migrateFromVersion092_noConfigToFullConfig(t *testing.T) Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.92.0", @@ -1750,6 +1763,7 @@ func TestAcc_Warehouse_migrateFromVersion092_noConfigToFullConfig(t *testing.T) ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: warehouseFullDefaultConfigWithQueryAcceleration(id.Name(), "", true, 8), ConfigPlanChecks: resource.ConfigPlanChecks{ @@ -1792,6 +1806,7 @@ func TestAcc_Warehouse_migrateFromVersion092_defaultsRemoved(t *testing.T) { Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.92.0", @@ -1821,6 +1836,7 @@ func TestAcc_Warehouse_migrateFromVersion092_defaultsRemoved(t *testing.T) { ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: warehouseWithSizeConfig(id.Name(), string(sdk.WarehouseSizeXSmall)), ConfigPlanChecks: resource.ConfigPlanChecks{ @@ -1860,6 +1876,7 @@ func TestAcc_Warehouse_migrateFromVersion092_warehouseSizeCausingForceNew(t *tes Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.92.0", @@ -1872,6 +1889,7 @@ func TestAcc_Warehouse_migrateFromVersion092_warehouseSizeCausingForceNew(t *tes ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: warehouseBasicConfig(id.Name()), ConfigPlanChecks: resource.ConfigPlanChecks{ @@ -1898,6 +1916,7 @@ func TestAcc_Warehouse_migrateFromV0941_ensureSmoothUpgradeWithNewResourceId(t * CheckDestroy: acc.CheckDestroy(t, resources.Warehouse), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -1910,6 +1929,7 @@ func TestAcc_Warehouse_migrateFromV0941_ensureSmoothUpgradeWithNewResourceId(t * ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: warehouseBasicConfig(id.Name()), Check: resource.ComposeAggregateTestCheckFunc( @@ -1932,6 +1952,7 @@ func TestAcc_Warehouse_IdentifierQuotingDiffSuppression(t *testing.T) { CheckDestroy: acc.CheckDestroy(t, resources.Warehouse), Steps: []resource.TestStep{ { + PreConfig: func() { acc.SetV097CompatibleConfigPathEnv(t) }, ExternalProviders: map[string]resource.ExternalProvider{ "snowflake": { VersionConstraint: "=0.94.1", @@ -1946,6 +1967,7 @@ func TestAcc_Warehouse_IdentifierQuotingDiffSuppression(t *testing.T) { ), }, { + PreConfig: func() { acc.UnsetConfigPathEnv(t) }, ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, Config: warehouseBasicConfig(quotedId), ConfigPlanChecks: resource.ConfigPlanChecks{ diff --git a/pkg/sdk/testint/security_integrations_gen_integration_test.go b/pkg/sdk/testint/security_integrations_gen_integration_test.go index 3f24f1f436..29620dcd0a 100644 --- a/pkg/sdk/testint/security_integrations_gen_integration_test.go +++ b/pkg/sdk/testint/security_integrations_gen_integration_test.go @@ -781,6 +781,7 @@ func TestInt_SecurityIntegrations(t *testing.T) { externalOauthIssuer: newIssuer, externalOauthAnyRoleMode: string(sdk.ExternalOauthSecurityIntegrationAnyRoleModeDisable), externalOauthRsaPublicKey: rsaKey, + externalOauthScopeMappingAttribute: "scp", externalOauthRsaPublicKey2: rsaKey, externalOauthBlockedRolesList: role1.Name, externalOauthAudienceList: "foo",