diff --git a/docs/resources/account.md b/docs/resources/account.md index fa653eb524..4af9a925d0 100644 --- a/docs/resources/account.md +++ b/docs/resources/account.md @@ -2,15 +2,17 @@ page_title: "snowflake_account Resource - terraform-provider-snowflake" subcategory: "" description: |- - The account resource allows you to create and manage Snowflake accounts. + The account resource allows you to create and manage Snowflake accounts. For more information, check account documentation https://docs.snowflake.com/en/user-guide/organizations-manage-accounts. --- # snowflake_account (Resource) -The account resource allows you to create and manage Snowflake accounts. +The account resource allows you to create and manage Snowflake accounts. For more information, check [account documentation](https://docs.snowflake.com/en/user-guide/organizations-manage-accounts). ~> **Note** To use this resource you have to use an account with a privilege to use the ORGADMIN role. +~> **Note** Changes for the following fields won't be detected: `admin_name`, `admin_password`, `admin_rsa_public_key`, `admin_user_type`, `first_name`, `last_name`, `email`, `must_change_password`. This is because these fields only supply initial values for creating the admin user. Once the account is created, the admin user becomes an independent entity. Modifying users from the account resource is challenging since it requires logging into that account. This would require the account resource logging into the account it created to read or alter admin user properties, which is impractical, because any external change to the admin user would disrupt the change detection anyway. + ## Example Usage ```terraform diff --git a/pkg/resources/account.go b/pkg/resources/account.go index 2f5a1e0249..c103cf3a52 100644 --- a/pkg/resources/account.go +++ b/pkg/resources/account.go @@ -145,7 +145,7 @@ var accountSchema = map[string]*schema.Schema{ func Account() *schema.Resource { return &schema.Resource{ - Description: "The account resource allows you to create and manage Snowflake accounts.", + Description: "The account resource allows you to create and manage Snowflake accounts. For more information, check [account documentation](https://docs.snowflake.com/en/user-guide/organizations-manage-accounts).", CreateContext: TrackingCreateWrapper(resources.Account, CreateAccount), ReadContext: TrackingReadWrapper(resources.Account, ReadAccount(true)), UpdateContext: TrackingUpdateWrapper(resources.Account, UpdateAccount), diff --git a/pkg/resources/task_acceptance_test.go b/pkg/resources/task_acceptance_test.go index 46dbf626a3..ee33a8fd4b 100644 --- a/pkg/resources/task_acceptance_test.go +++ b/pkg/resources/task_acceptance_test.go @@ -7,6 +7,8 @@ import ( "strconv" "testing" + "github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/acceptance/bettertestspoc/assert/objectassert" + acc "github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/acceptance" configvariable "github.com/hashicorp/terraform-plugin-testing/config" @@ -1678,11 +1680,11 @@ func TestAcc_Task_ConvertStandaloneTaskToFinalizer(t *testing.T) { WithFinalize(rootTaskId.FullyQualifiedName()) childTaskModel.SetDependsOn(rootTaskModel.ResourceReference()) - firstTaskStandaloneModelDisabled := model.TaskWithId("root", rootTaskId, false, statement). + rootTaskStandaloneModelDisabled := model.TaskWithId("root", rootTaskId, false, statement). WithScheduleMinutes(schedule) - secondTaskStandaloneModelDisabled := model.TaskWithId("child", finalizerTaskId, false, statement). + childTaskStandaloneModelDisabled := model.TaskWithId("child", finalizerTaskId, false, statement). WithScheduleMinutes(schedule) - secondTaskStandaloneModelDisabled.SetDependsOn(firstTaskStandaloneModelDisabled.ResourceReference()) + childTaskStandaloneModelDisabled.SetDependsOn(rootTaskStandaloneModelDisabled.ResourceReference()) resource.Test(t, resource.TestCase{ ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, @@ -1724,9 +1726,10 @@ func TestAcc_Task_ConvertStandaloneTaskToFinalizer(t *testing.T) { HasSuspendTaskAfterNumFailuresString("2"), resourceshowoutputassert.TaskShowOutput(t, rootTaskModel.ResourceReference()). HasScheduleMinutes(schedule). - // TODO(SNOW-1843489): Create ticket and report; this field in task relations seems to have mixed chances of appearing (needs deeper digging, doesn't affect the resource; could be removed for now) - // HasTaskRelations(sdk.TaskRelations{FinalizerTask: &finalizerTaskId}). HasState(sdk.TaskStateStarted), + // For task relations to be present, in show_output we would have to modify the root task in a way that would + // trigger show_output recomputing by our custom diff. + objectassert.Task(t, rootTaskId).HasTaskRelations(sdk.TaskRelations{FinalizerTask: &finalizerTaskId}), resourceassert.TaskResource(t, childTaskModel.ResourceReference()). HasStartedString(r.BooleanTrue), resourceshowoutputassert.TaskShowOutput(t, childTaskModel.ResourceReference()). @@ -1737,20 +1740,20 @@ func TestAcc_Task_ConvertStandaloneTaskToFinalizer(t *testing.T) { // Change tasks in DAG to standalone tasks (disabled to check if resuming/suspending works correctly) { ConfigDirectory: acc.ConfigurationDirectory("TestAcc_Task/with_task_dependency"), - ConfigVariables: config.ConfigVariablesFromModels(t, "tasks", firstTaskStandaloneModelDisabled, secondTaskStandaloneModelDisabled), + ConfigVariables: config.ConfigVariablesFromModels(t, "tasks", rootTaskStandaloneModelDisabled, childTaskStandaloneModelDisabled), Check: assert.AssertThat(t, - resourceassert.TaskResource(t, firstTaskStandaloneModelDisabled.ResourceReference()). + resourceassert.TaskResource(t, rootTaskStandaloneModelDisabled.ResourceReference()). HasScheduleMinutes(schedule). HasStartedString(r.BooleanFalse). HasSuspendTaskAfterNumFailuresString("10"), - resourceshowoutputassert.TaskShowOutput(t, firstTaskStandaloneModelDisabled.ResourceReference()). + resourceshowoutputassert.TaskShowOutput(t, rootTaskStandaloneModelDisabled.ResourceReference()). HasScheduleMinutes(schedule). HasTaskRelations(sdk.TaskRelations{}). HasState(sdk.TaskStateSuspended), - resourceassert.TaskResource(t, secondTaskStandaloneModelDisabled.ResourceReference()). + resourceassert.TaskResource(t, childTaskStandaloneModelDisabled.ResourceReference()). HasScheduleMinutes(schedule). HasStartedString(r.BooleanFalse), - resourceshowoutputassert.TaskShowOutput(t, secondTaskStandaloneModelDisabled.ResourceReference()). + resourceshowoutputassert.TaskShowOutput(t, childTaskStandaloneModelDisabled.ResourceReference()). HasScheduleMinutes(schedule). HasTaskRelations(sdk.TaskRelations{}). HasState(sdk.TaskStateSuspended), diff --git a/pkg/sdk/testint/accounts_integration_test.go b/pkg/sdk/testint/accounts_integration_test.go index f2e646073d..fc71f7c152 100644 --- a/pkg/sdk/testint/accounts_integration_test.go +++ b/pkg/sdk/testint/accounts_integration_test.go @@ -195,7 +195,7 @@ func TestInt_Account(t *testing.T) { RegionGroup: sdk.String("PUBLIC"), Region: sdk.String(currentRegion.SnowflakeRegion), Comment: sdk.String(comment), - // TODO(SNOW-1844776): with polaris Snowflake returns an error saying: "invalid property polaris for account" + // TODO(SNOW-1895880): with polaris Snowflake returns an error saying: "invalid property polaris for account" // Polaris: sdk.Bool(true), }) require.NoError(t, err) diff --git a/pkg/sdk/testint/tasks_gen_integration_test.go b/pkg/sdk/testint/tasks_gen_integration_test.go index 5efdade6de..fb3f29b259 100644 --- a/pkg/sdk/testint/tasks_gen_integration_test.go +++ b/pkg/sdk/testint/tasks_gen_integration_test.go @@ -613,7 +613,7 @@ func TestInt_Tasks(t *testing.T) { t.Cleanup(taskCleanup) err := client.Tasks.Alter(ctx, sdk.NewAlterTaskRequest(task.ID()).WithSet(*sdk.NewTaskSetRequest(). - // TODO(SNOW-1843489): Cannot set warehouse due to Snowflake error + // TODO(SNOW-1519496): Cannot set warehouse due to Snowflake error // WithWarehouse(testClientHelper().Ids.WarehouseId()). WithErrorIntegration(errorIntegration.ID()). WithSessionParameters(sessionParametersSet). diff --git a/templates/resources/account.md.tmpl b/templates/resources/account.md.tmpl index 679bceded0..20440f8d1e 100644 --- a/templates/resources/account.md.tmpl +++ b/templates/resources/account.md.tmpl @@ -15,6 +15,8 @@ description: |- ~> **Note** To use this resource you have to use an account with a privilege to use the ORGADMIN role. +~> **Note** Changes for the following fields won't be detected: `admin_name`, `admin_password`, `admin_rsa_public_key`, `admin_user_type`, `first_name`, `last_name`, `email`, `must_change_password`. This is because these fields only supply initial values for creating the admin user. Once the account is created, the admin user becomes an independent entity. Modifying users from the account resource is challenging since it requires logging into that account. This would require the account resource logging into the account it created to read or alter admin user properties, which is impractical, because any external change to the admin user would disrupt the change detection anyway. + {{ if .HasExample -}} ## Example Usage