Skip to content

Commit a946d22

Browse files
wip
1 parent 4b65711 commit a946d22

File tree

3 files changed

+24
-27
lines changed

3 files changed

+24
-27
lines changed

pkg/resources/current_account.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/provider/previewfeatures"
1212
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/provider/resources"
1313
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk"
14-
"github.com/hashicorp/go-cty/cty"
1514
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
1615
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
1716
)
@@ -76,15 +75,15 @@ func CurrentAccount() *schema.Resource {
7675
StateContext: TrackingImportWrapper(resources.CurrentAccount, schema.ImportStatePassthroughContext),
7776
},
7877

79-
SchemaVersion: 1,
80-
StateUpgraders: []schema.StateUpgrader{
81-
{
82-
Version: 0,
83-
// setting type to cty.EmptyObject is a bit hacky here but following https://developer.hashicorp.com/terraform/plugin/framework/migrating/resources/state-upgrade#sdkv2-1 would require lots of repetitive code; this should work with cty.EmptyObject
84-
Type: cty.EmptyObject,
85-
Upgrade: v2_10_0_CurrentAccountStateUpgrader,
86-
},
87-
},
78+
//SchemaVersion: 1,
79+
//StateUpgraders: []schema.StateUpgrader{
80+
// {
81+
// Version: 0,
82+
// // setting type to cty.EmptyObject is a bit hacky here but following https://developer.hashicorp.com/terraform/plugin/framework/migrating/resources/state-upgrade#sdkv2-1 would require lots of repetitive code; this should work with cty.EmptyObject
83+
// Type: cty.EmptyObject,
84+
// Upgrade: v2_10_0_CurrentAccountStateUpgrader,
85+
// },
86+
//},
8887

8988
Timeouts: defaultTimeouts,
9089
}

pkg/testacc/resource_current_account_acceptance_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,8 +1026,8 @@ func TestAcc_CurrentAccount_migrateFromV2_10_0(t *testing.T) {
10261026
provider := providermodel.SnowflakeProvider().
10271027
WithPreviewFeaturesEnabled(string(previewfeatures.CurrentAccountResource)).
10281028
WithWarehouse(testClient().Ids.WarehouseId().FullyQualifiedName())
1029-
configModel := model.CurrentAccount("test").
1030-
WithNetworkPolicy("RESTRICTED_ACCESS")
1029+
1030+
configModel := model.CurrentAccount("test")
10311031

10321032
resource.Test(t, resource.TestCase{
10331033
TerraformVersionChecks: []tfversion.TerraformVersionCheck{

pkg/testacc/resource_current_organization_account_acceptance_test.go

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,6 @@ func TestAcc_CurrentOrganizationAccount_NonEmptyComment_OnCreate(t *testing.T) {
464464
})
465465
}
466466

467-
// TODO: Can't be tested as 2.10.0 version doesn't work apparently
468467
func TestAcc_CurrentOrganizationAccount_migrateFromV2_10_0(t *testing.T) {
469468
testClient().EnsureValidNonProdOrganizationAccountIsUsed(t)
470469

@@ -474,27 +473,26 @@ func TestAcc_CurrentOrganizationAccount_migrateFromV2_10_0(t *testing.T) {
474473
WithPreviewFeaturesEnabled(string(previewfeatures.CurrentOrganizationAccountResource)).
475474
WithWarehouse(testClient().Ids.WarehouseId().FullyQualifiedName())
476475

477-
configModel := model.CurrentOrganizationAccount("test", currentOrganizationAccountName).
478-
WithComment("SNOWFLAKE")
476+
configModel := model.CurrentOrganizationAccount("test", currentOrganizationAccountName)
479477

480478
resource.Test(t, resource.TestCase{
481479
TerraformVersionChecks: []tfversion.TerraformVersionCheck{
482480
tfversion.RequireAbove(tfversion.Version1_5_0),
483481
},
484482
Steps: []resource.TestStep{
485-
//{
486-
// ExternalProviders: ExternalProviderWithExactVersion("2.10.0"),
487-
// Config: config.FromModels(t, provider, configModel),
488-
// Check: assertThat(t,
489-
// assert.Check(resource.TestCheckResourceAttr(configModel.ResourceReference(), "saml_identity_provider", "")),
490-
// ),
491-
//},
492483
{
493-
//ConfigPlanChecks: resource.ConfigPlanChecks{
494-
// PreApply: []plancheck.PlanCheck{
495-
// plancheck.ExpectResourceAction(configModel.ResourceReference(), plancheck.ResourceActionNoop),
496-
// },
497-
//},
484+
ExternalProviders: ExternalProviderWithExactVersion("2.10.0"),
485+
Config: config.FromModels(t, provider, configModel),
486+
Check: assertThat(t,
487+
assert.Check(resource.TestCheckResourceAttr(configModel.ResourceReference(), "saml_identity_provider", "")),
488+
),
489+
},
490+
{
491+
ConfigPlanChecks: resource.ConfigPlanChecks{
492+
PreApply: []plancheck.PlanCheck{
493+
plancheck.ExpectResourceAction(configModel.ResourceReference(), plancheck.ResourceActionNoop),
494+
},
495+
},
498496
ProtoV6ProviderFactories: TestAccProtoV6ProviderFactories,
499497
Config: config.FromModels(t, provider, configModel),
500498
Check: assertThat(t,

0 commit comments

Comments
 (0)