diff --git a/client/meta/dataset.go b/client/meta/dataset.go index c35b13d4..885b3c5b 100644 --- a/client/meta/dataset.go +++ b/client/meta/dataset.go @@ -30,12 +30,6 @@ func DefaultDependencyHandling() *DependencyHandlingInput { return &DependencyHandlingInput{SaveMode: &mode} } -func DependencyHandlingSkipRematerialization() *DependencyHandlingInput { - saveMode := SaveModeUpdateDatasetAndDependenciesIgnoringAllErrors - rematMode := RematerializationModeSkiprematerialization - return &DependencyHandlingInput{SaveMode: &saveMode, RematerializationMode: &rematMode} -} - // SaveDataset creates and updates datasets func (client *Client) SaveDataset(ctx context.Context, workspaceId string, input *DatasetInput, queryInput *MultiStageQueryInput, dependencyHandling *DependencyHandlingInput) (*Dataset, error) { resp, err := saveDataset(ctx, client.Gql, workspaceId, *input, *queryInput, dependencyHandling) diff --git a/observe/resource_dataset.go b/observe/resource_dataset.go index 73de03eb..3bd66437 100644 --- a/observe/resource_dataset.go +++ b/observe/resource_dataset.go @@ -21,9 +21,6 @@ const ( schemaDatasetDescriptionDescription = "Dataset description." schemaDatasetIconDescription = "Icon image." schemaDatasetOIDDescription = "The Observe ID for dataset." - - rematerializationModeRematerialize = "rematerialize" - rematerializationModeSkipRematerialization = "skip_rematerialization" ) func resourceDataset() *schema.Resource { @@ -154,7 +151,6 @@ func resourceDataset() *schema.Resource { "rematerialization_mode": { Type: schema.TypeString, Optional: true, - Default: "rematerialize", ValidateDiagFunc: validateEnums(gql.AllRematerializationModes), Description: descriptions.Get("dataset", "schema", "rematerialization_mode"), }, @@ -365,14 +361,13 @@ func resourceDatasetCreate(ctx context.Context, data *schema.ResourceData, meta } dependencyHandling := gql.DefaultDependencyHandling() - switch data.Get("rematerialization_mode").(string) { - case rematerializationModeRematerialize: - case rematerializationModeSkipRematerialization: - dependencyHandling = gql.DependencyHandlingSkipRematerialization() + if mode, ok := data.GetOk("rematerialization_mode"); ok { + rematerializationMode := gql.RematerializationMode(toCamel(mode.(string))) + dependencyHandling.RematerializationMode = &rematerializationMode diags = append(diags, diag.Diagnostic{ Severity: diag.Warning, - Summary: "Skipping rematerialization on a new dataset is a no-op", + Summary: "rematerialization_mode on a new dataset is a no-op", }) } @@ -421,10 +416,9 @@ func resourceDatasetUpdate(ctx context.Context, data *schema.ResourceData, meta wsid, _ := oid.NewOID(data.Get("workspace").(string)) dependencyHandling := gql.DefaultDependencyHandling() - switch data.Get("rematerialization_mode").(string) { - case rematerializationModeRematerialize: - case rematerializationModeSkipRematerialization: - dependencyHandling = gql.DependencyHandlingSkipRematerialization() + if mode, ok := data.GetOk("rematerialization_mode"); ok { + rematerializationMode := gql.RematerializationMode(toCamel(mode.(string))) + dependencyHandling.RematerializationMode = &rematerializationMode } result, err := client.SaveDataset(ctx, wsid.Id, input, queryInput, dependencyHandling) diff --git a/observe/resource_dataset_test.go b/observe/resource_dataset_test.go index b703ede6..8065190f 100644 --- a/observe/resource_dataset_test.go +++ b/observe/resource_dataset_test.go @@ -112,7 +112,7 @@ func TestAccObserveDatasetUpdate(t *testing.T) { resource.TestCheckResourceAttr("observe_dataset.first", "stage.0.input", ""), resource.TestCheckResourceAttr("observe_dataset.first", "stage.0.pipeline", ""), resource.TestCheckResourceAttr("observe_dataset.first", "acceleration_disabled_source", "view"), - resource.TestCheckResourceAttr("observe_dataset.first", "rematerialization_mode", "rematerialize"), + resource.TestCheckNoResourceAttr("observe_dataset.first", "rematerialization_mode"), ), }, {