From 0975310040346b75843993e92f76f8abc891b70c Mon Sep 17 00:00:00 2001 From: Omer Lachish <289488+rauchy@users.noreply.github.com> Date: Tue, 29 Oct 2024 10:26:54 +0100 Subject: [PATCH] [Internal] Migrate Share Resource to Plugin Framework (#4047) ## Changes This PR migrates the share resource to the Plugin framework. The code was largely copied "as is" from the previous implementation of the share resource, with the necessary adaptations made for integration with the Plugin framework. This implementation utilizes the newly generated Effective fields to provide the functionality that was previously achieved through diff suppression. ## Tests - [x] `make test` run locally - [ ] relevant change in `docs/` folder - [x] covered with integration tests in `internal/acceptance` - [x] relevant acceptance tests are passing - [x] using Go SDK --------- Co-authored-by: Omer Lachish --- .codegen/model.go.tmpl | 1 + .../providers/pluginfw/converters/tf_to_go.go | 2 +- internal/providers/pluginfw/pluginfw.go | 2 + .../resources/sharing/resource_acc_test.go | 204 +++++++++ .../resources/sharing/resource_share.go | 401 ++++++++++++++++++ internal/service/apps_tf/model.go | 13 + internal/service/catalog_tf/model.go | 2 + internal/service/dashboards_tf/model.go | 51 +++ internal/service/jobs_tf/model.go | 2 + internal/service/provisioning_tf/model.go | 9 + internal/service/settings_tf/model.go | 10 + internal/service/sharing_tf/model.go | 6 + 12 files changed, 702 insertions(+), 1 deletion(-) create mode 100644 internal/providers/pluginfw/resources/sharing/resource_acc_test.go create mode 100644 internal/providers/pluginfw/resources/sharing/resource_share.go diff --git a/.codegen/model.go.tmpl b/.codegen/model.go.tmpl index 7d20bea4e..714401729 100644 --- a/.codegen/model.go.tmpl +++ b/.codegen/model.go.tmpl @@ -53,6 +53,7 @@ func (newState *{{.PascalName}}) SyncEffectiveFieldsDuringRead(existingState {{. {{- if .Entity.IsFloat64}}{{$type = "Float64"}}{{end}} {{- if .Entity.IsInt}}{{$type = "Int64"}}{{end}} {{- if .Entity.Enum}}{{$type = "String"}}{{end}} + newState.Effective{{.PascalName}} = existingState.Effective{{.PascalName}} if existingState.Effective{{.PascalName}}.Value{{$type}}() == newState.{{.PascalName}}.Value{{$type}}() { newState.{{.PascalName}} = existingState.{{.PascalName}} } diff --git a/internal/providers/pluginfw/converters/tf_to_go.go b/internal/providers/pluginfw/converters/tf_to_go.go index 70efd92a3..27eb02d91 100644 --- a/internal/providers/pluginfw/converters/tf_to_go.go +++ b/internal/providers/pluginfw/converters/tf_to_go.go @@ -184,7 +184,7 @@ func tfsdkToGoSdkStructField(srcField reflect.Value, destField reflect.Value, sr // This is the case for enum. // Skip unset value. - if srcField.IsZero() { + if srcField.IsZero() || v.ValueString() == "" { return } diff --git a/internal/providers/pluginfw/pluginfw.go b/internal/providers/pluginfw/pluginfw.go index db811d5ae..53b361f99 100644 --- a/internal/providers/pluginfw/pluginfw.go +++ b/internal/providers/pluginfw/pluginfw.go @@ -21,6 +21,7 @@ import ( "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/resources/notificationdestinations" "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/resources/qualitymonitor" "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/resources/registered_model" + "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/resources/sharing" "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/resources/volume" "github.com/hashicorp/terraform-plugin-framework/datasource" @@ -47,6 +48,7 @@ func (p *DatabricksProviderPluginFramework) Resources(ctx context.Context) []fun return []func() resource.Resource{ qualitymonitor.ResourceQualityMonitor, library.ResourceLibrary, + sharing.ResourceShare, } } diff --git a/internal/providers/pluginfw/resources/sharing/resource_acc_test.go b/internal/providers/pluginfw/resources/sharing/resource_acc_test.go new file mode 100644 index 000000000..7018e0b40 --- /dev/null +++ b/internal/providers/pluginfw/resources/sharing/resource_acc_test.go @@ -0,0 +1,204 @@ +package sharing_test + +import ( + "fmt" + "testing" + + "github.com/databricks/terraform-provider-databricks/internal/acceptance" +) + +const preTestTemplate = ` + resource "databricks_catalog" "sandbox" { + name = "sandbox{var.STICKY_RANDOM}" + comment = "this catalog is managed by terraform" + properties = { + purpose = "testing" + } + } + + resource "databricks_schema" "things" { + catalog_name = databricks_catalog.sandbox.id + name = "things{var.STICKY_RANDOM}" + comment = "this database is managed by terraform" + properties = { + kind = "various" + } + } + + resource "databricks_table" "mytable" { + catalog_name = databricks_catalog.sandbox.id + schema_name = databricks_schema.things.name + name = "bar" + table_type = "MANAGED" + data_source_format = "DELTA" + + column { + name = "id" + position = 0 + type_name = "INT" + type_text = "int" + type_json = "{\"name\":\"id\",\"type\":\"integer\",\"nullable\":true,\"metadata\":{}}" + } + } + + resource "databricks_table" "mytable_2" { + catalog_name = databricks_catalog.sandbox.id + schema_name = databricks_schema.things.name + name = "bar_2" + table_type = "MANAGED" + data_source_format = "DELTA" + + column { + name = "id" + position = 0 + type_name = "INT" + type_text = "int" + type_json = "{\"name\":\"id\",\"type\":\"integer\",\"nullable\":true,\"metadata\":{}}" + } + } + + resource "databricks_table" "mytable_3" { + catalog_name = databricks_catalog.sandbox.id + schema_name = databricks_schema.things.name + name = "bar_3" + table_type = "MANAGED" + data_source_format = "DELTA" + + column { + name = "id" + position = 0 + type_name = "INT" + type_text = "int" + type_json = "{\"name\":\"id\",\"type\":\"integer\",\"nullable\":true,\"metadata\":{}}" + } + } +` + +const preTestTemplateUpdate = ` + resource "databricks_grants" "some" { + catalog = databricks_catalog.sandbox.id + grant { + principal = "account users" + privileges = ["ALL_PRIVILEGES"] + } + grant { + principal = "{env.TEST_METASTORE_ADMIN_GROUP_NAME}" + privileges = ["ALL_PRIVILEGES"] + } + } +` + +func TestUcAccCreateShare(t *testing.T) { + acceptance.UnityWorkspaceLevel(t, acceptance.Step{ + Template: preTestTemplate + ` + resource "databricks_share_pluginframework" "myshare" { + name = "{var.STICKY_RANDOM}-terraform-delta-share" + owner = "account users" + object { + name = databricks_table.mytable.id + comment = "c" + data_object_type = "TABLE" + } + object { + name = databricks_table.mytable_2.id + cdf_enabled = false + comment = "c" + data_object_type = "TABLE" + } + } + + resource "databricks_recipient" "db2open" { + name = "{var.STICKY_RANDOM}-terraform-db2open-recipient" + comment = "made by terraform" + authentication_type = "TOKEN" + sharing_code = "{var.STICKY_RANDOM}" + ip_access_list { + // using private ip for acc testing + allowed_ip_addresses = ["10.0.0.0/16"] + } + } + + resource "databricks_grants" "some" { + share = databricks_share_pluginframework.myshare.name + grant { + principal = databricks_recipient.db2open.name + privileges = ["SELECT"] + } + } + `, + }) +} + +func shareTemplateWithOwner(comment string, owner string) string { + return fmt.Sprintf(` + resource "databricks_share_pluginframework" "myshare" { + name = "{var.STICKY_RANDOM}-terraform-delta-share" + owner = "%s" + object { + name = databricks_table.mytable.id + comment = "%s" + data_object_type = "TABLE" + history_data_sharing_status = "DISABLED" + } + + }`, owner, comment) +} + +func TestUcAccUpdateShare(t *testing.T) { + acceptance.UnityWorkspaceLevel(t, acceptance.Step{ + Template: preTestTemplate + preTestTemplateUpdate + shareTemplateWithOwner("c", "account users"), + }, acceptance.Step{ + Template: preTestTemplate + preTestTemplateUpdate + shareTemplateWithOwner("e", "account users"), + }, acceptance.Step{ + Template: preTestTemplate + preTestTemplateUpdate + shareTemplateWithOwner("e", "{env.TEST_DATA_ENG_GROUP}"), + }, acceptance.Step{ + Template: preTestTemplate + preTestTemplateUpdate + shareTemplateWithOwner("f", "{env.TEST_METASTORE_ADMIN_GROUP_NAME}"), + }) +} + +func TestUcAccUpdateShareAddObject(t *testing.T) { + acceptance.UnityWorkspaceLevel(t, acceptance.Step{ + Template: preTestTemplate + preTestTemplateUpdate + + `resource "databricks_share_pluginframework" "myshare" { + name = "{var.STICKY_RANDOM}-terraform-delta-share" + owner = "account users" + object { + name = databricks_table.mytable.id + comment = "A" + data_object_type = "TABLE" + history_data_sharing_status = "DISABLED" + } + object { + name = databricks_table.mytable_3.id + comment = "C" + data_object_type = "TABLE" + history_data_sharing_status = "DISABLED" + } + + }`, + }, acceptance.Step{ + Template: preTestTemplate + preTestTemplateUpdate + + `resource "databricks_share_pluginframework" "myshare" { + name = "{var.STICKY_RANDOM}-terraform-delta-share" + owner = "account users" + object { + name = databricks_table.mytable.id + comment = "AA" + data_object_type = "TABLE" + history_data_sharing_status = "DISABLED" + } + object { + name = databricks_table.mytable_2.id + comment = "BB" + data_object_type = "TABLE" + history_data_sharing_status = "DISABLED" + } + object { + name = databricks_table.mytable_3.id + comment = "CC" + data_object_type = "TABLE" + history_data_sharing_status = "DISABLED" + } + }`, + }) +} diff --git a/internal/providers/pluginfw/resources/sharing/resource_share.go b/internal/providers/pluginfw/resources/sharing/resource_share.go new file mode 100644 index 000000000..b96cd0e97 --- /dev/null +++ b/internal/providers/pluginfw/resources/sharing/resource_share.go @@ -0,0 +1,401 @@ +package sharing + +import ( + "context" + "reflect" + "sort" + + "github.com/databricks/databricks-sdk-go/apierr" + "github.com/databricks/databricks-sdk-go/service/sharing" + "github.com/databricks/terraform-provider-databricks/common" + pluginfwcommon "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/common" + pluginfwcontext "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/context" + "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/converters" + "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/tfschema" + "github.com/databricks/terraform-provider-databricks/internal/service/sharing_tf" + "github.com/hashicorp/terraform-plugin-framework/path" + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/int64planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" +) + +const resourceName = "share" + +var _ resource.ResourceWithConfigure = &ShareResource{} + +func ResourceShare() resource.Resource { + return &ShareResource{} +} + +type ShareInfoExtended struct { + sharing_tf.ShareInfo +} + +func matchOrder[T any, K comparable](target, reference []T, keyFunc func(T) K) { + // Create a map to store the index positions of each key in the reference slice. + orderMap := make(map[K]int) + for index, item := range reference { + orderMap[keyFunc(item)] = index + } + + // Sort the target slice based on the order defined in the orderMap. + sort.Slice(target, func(i, j int) bool { + return orderMap[keyFunc(target[i])] < orderMap[keyFunc(target[j])] + }) +} + +func suppressCDFEnabledDiff(si *sharing.ShareInfo) { + //suppress diff for CDF Enabled if HistoryDataSharingStatus is enabled , as API does not accept both fields to be set + for i := range si.Objects { + if si.Objects[i].HistoryDataSharingStatus == "ENABLED" { + si.Objects[i].CdfEnabled = false + } + } +} + +func resourceShareMap(si sharing.ShareInfo) map[string]sharing.SharedDataObject { + m := make(map[string]sharing.SharedDataObject, len(si.Objects)) + for _, sdo := range si.Objects { + m[sdo.Name] = sdo + } + return m +} + +func equal(this sharing.SharedDataObject, other sharing.SharedDataObject) bool { + if other.SharedAs == "" { + other.SharedAs = this.SharedAs + } + //don't compare computed fields + other.AddedAt = this.AddedAt + other.AddedBy = this.AddedBy + other.Status = this.Status + other.HistoryDataSharingStatus = this.HistoryDataSharingStatus + other.ForceSendFields = this.ForceSendFields // TODO: is this the right thing to do? + return reflect.DeepEqual(this, other) +} + +func diff(beforeSi sharing.ShareInfo, afterSi sharing.ShareInfo) []sharing.SharedDataObjectUpdate { + beforeMap := resourceShareMap(beforeSi) + afterMap := resourceShareMap(afterSi) + changes := []sharing.SharedDataObjectUpdate{} + // not in after so remove + for _, beforeSdo := range beforeSi.Objects { + if _, ok := afterMap[beforeSdo.Name]; ok { + continue + } + changes = append(changes, sharing.SharedDataObjectUpdate{ + Action: sharing.SharedDataObjectUpdateActionRemove, + DataObject: &beforeSdo, + }) + } + + // not in before so add + // if in before but diff then update + for _, afterSdo := range afterSi.Objects { + if beforeSdo, ok := beforeMap[afterSdo.Name]; ok { + if !equal(beforeSdo, afterSdo) { + // do not send SharedAs + afterSdo.SharedAs = "" + changes = append(changes, sharing.SharedDataObjectUpdate{ + Action: sharing.SharedDataObjectUpdateActionUpdate, + DataObject: &afterSdo, + }) + } + continue + } + changes = append(changes, sharing.SharedDataObjectUpdate{ + Action: sharing.SharedDataObjectUpdateActionAdd, + DataObject: &afterSdo, + }) + } + return changes +} + +func shareChanges(si sharing.ShareInfo, action string) sharing.UpdateShare { + var changes []sharing.SharedDataObjectUpdate + for _, obj := range si.Objects { + changes = append(changes, sharing.SharedDataObjectUpdate{ + Action: sharing.SharedDataObjectUpdateAction(action), + DataObject: &obj, + }, + ) + } + return sharing.UpdateShare{ + Name: si.Name, + Owner: si.Owner, + Updates: changes, + } +} + +type ShareResource struct { + Client *common.DatabricksClient +} + +func (r *ShareResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + resp.TypeName = pluginfwcommon.GetDatabricksStagingName(resourceName) +} + +func (r *ShareResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + attrs, blocks := tfschema.ResourceStructToSchemaMap(ShareInfoExtended{}, func(c tfschema.CustomizableSchema) tfschema.CustomizableSchema { + c.SetRequired("name") + + c.AddPlanModifier(stringplanmodifier.RequiresReplace(), "name") // ForceNew + c.AddPlanModifier(int64planmodifier.UseStateForUnknown(), "created_at") + c.AddPlanModifier(stringplanmodifier.UseStateForUnknown(), "created_by") + + c.SetRequired("object", "data_object_type") + c.SetRequired("object", "partitions", "values", "op") + c.SetRequired("object", "partitions", "values", "name") + return c + }) + resp.Schema = schema.Schema{ + Description: "Terraform schema for Databricks Share", + Attributes: attrs, + Blocks: blocks, + } +} + +func (d *ShareResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { + if d.Client == nil && req.ProviderData != nil { + d.Client = pluginfwcommon.ConfigureResource(req, resp) + } +} + +func (r *ShareResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + ctx = pluginfwcontext.SetUserAgentInResourceContext(ctx, resourceName) + + w, diags := r.Client.GetWorkspaceClient() + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + var plan ShareInfoExtended + resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) + if resp.Diagnostics.HasError() { + return + } + + var planGoSDK sharing.ShareInfo + resp.Diagnostics.Append(converters.TfSdkToGoSdkStruct(ctx, plan, &planGoSDK)...) + if resp.Diagnostics.HasError() { + return + } + + var createShare sharing.CreateShare + resp.Diagnostics.Append(converters.TfSdkToGoSdkStruct(ctx, plan, &createShare)...) + if resp.Diagnostics.HasError() { + return + } + shareInfo, err := w.Shares.Create(ctx, createShare) + if err != nil { + resp.Diagnostics.AddError("failed to create share", err.Error()) + return + } + + shareChanges := shareChanges(planGoSDK, string(sharing.SharedDataObjectUpdateActionAdd)) + + updatedShareInfo, err := w.Shares.Update(ctx, shareChanges) + if err != nil { + // delete orphaned share if update fails + if d_err := w.Shares.DeleteByName(ctx, shareInfo.Name); d_err != nil { + resp.Diagnostics.AddError("failed to delete orphaned share", d_err.Error()) + return + } + resp.Diagnostics.AddError("failed to update share", err.Error()) + return + } + + matchOrder(updatedShareInfo.Objects, planGoSDK.Objects, func(obj sharing.SharedDataObject) string { return obj.Name }) + + var newState ShareInfoExtended + resp.Diagnostics.Append(converters.GoSdkToTfSdkStruct(ctx, updatedShareInfo, &newState)...) + if resp.Diagnostics.HasError() { + return + } + + newState.SyncEffectiveFieldsDuringCreateOrUpdate(plan.ShareInfo) + for i := range newState.Objects { + newState.Objects[i].SyncEffectiveFieldsDuringCreateOrUpdate(plan.Objects[i]) + } + + resp.Diagnostics.Append(resp.State.Set(ctx, newState)...) + if resp.Diagnostics.HasError() { + return + } +} + +func (r *ShareResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + ctx = pluginfwcontext.SetUserAgentInResourceContext(ctx, resourceName) + + var existingState ShareInfoExtended + resp.Diagnostics.Append(req.State.Get(ctx, &existingState)...) + if resp.Diagnostics.HasError() { + return + } + + var stateGoSDK sharing.ShareInfo + resp.Diagnostics.Append(converters.TfSdkToGoSdkStruct(ctx, existingState, &stateGoSDK)...) + if resp.Diagnostics.HasError() { + return + } + + w, diags := r.Client.GetWorkspaceClient() + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + + var getShareRequest sharing.GetShareRequest + getShareRequest.IncludeSharedData = true + resp.Diagnostics.Append(req.State.GetAttribute(ctx, path.Root("name"), &getShareRequest.Name)...) + if resp.Diagnostics.HasError() { + return + } + + shareInfo, err := w.Shares.Get(ctx, getShareRequest) + if err != nil { + if apierr.IsMissing(err) { + resp.State.RemoveResource(ctx) + return + } + resp.Diagnostics.AddError("failed to get share", err.Error()) + return + } + + matchOrder(shareInfo.Objects, stateGoSDK.Objects, func(obj sharing.SharedDataObject) string { return obj.Name }) + suppressCDFEnabledDiff(shareInfo) + + var newState ShareInfoExtended + resp.Diagnostics.Append(converters.GoSdkToTfSdkStruct(ctx, shareInfo, &newState)...) + if resp.Diagnostics.HasError() { + return + } + + newState.SyncEffectiveFieldsDuringRead(existingState.ShareInfo) + for i := range newState.Objects { + newState.Objects[i].SyncEffectiveFieldsDuringRead(existingState.Objects[i]) + } + + resp.Diagnostics.Append(resp.State.Set(ctx, newState)...) +} + +func (r *ShareResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + ctx = pluginfwcontext.SetUserAgentInResourceContext(ctx, resourceName) + + var state ShareInfoExtended + resp.Diagnostics.Append(req.State.Get(ctx, &state)...) + if resp.Diagnostics.HasError() { + return + } + + client, diags := r.Client.GetWorkspaceClient() + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + + var plan ShareInfoExtended + resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) + if resp.Diagnostics.HasError() { + return + } + + var planGoSDK sharing.ShareInfo + resp.Diagnostics.Append(converters.TfSdkToGoSdkStruct(ctx, plan, &planGoSDK)...) + if resp.Diagnostics.HasError() { + return + } + + var getShareRequest sharing.GetShareRequest + getShareRequest.Name = state.Name.ValueString() + getShareRequest.IncludeSharedData = true + + currentShareInfo, err := client.Shares.Get(ctx, getShareRequest) + if err != nil { + resp.Diagnostics.AddError("failed to get current share info", err.Error()) + return + } + + matchOrder(currentShareInfo.Objects, planGoSDK.Objects, func(obj sharing.SharedDataObject) string { return obj.Name }) + suppressCDFEnabledDiff(currentShareInfo) + + changes := diff(*currentShareInfo, planGoSDK) + + // if owner has changed, update the share owner + if !plan.Owner.IsNull() { + updatedShareInfo, err := client.Shares.Update(ctx, sharing.UpdateShare{ + Name: state.Name.ValueString(), + Owner: plan.Owner.ValueString(), + }) + if err == nil { + resp.Diagnostics.Append(converters.GoSdkToTfSdkStruct(ctx, updatedShareInfo, &state)...) + if resp.Diagnostics.HasError() { + return + } + } else { + resp.Diagnostics.AddError("failed to update share owner", err.Error()) + return + } + } + + if len(changes) > 0 { + // if there are any other changes, update the share with the changes + updatedShareInfo, err := client.Shares.Update(ctx, sharing.UpdateShare{ + Name: plan.Name.ValueString(), + Updates: changes, + }) + + if err != nil { + resp.Diagnostics.AddError("failed to update share", err.Error()) + + rollbackShareInfo, rollbackErr := client.Shares.Update(ctx, sharing.UpdateShare{ + Name: currentShareInfo.Name, + Owner: currentShareInfo.Owner, + }) + if rollbackErr != nil { + resp.Diagnostics.AddError("failed to roll back", common.OwnerRollbackError(err, rollbackErr, currentShareInfo.Owner, plan.Owner.ValueString()).Error()) + return + } + + resp.Diagnostics.Append(converters.GoSdkToTfSdkStruct(ctx, rollbackShareInfo, &state)...) + if resp.Diagnostics.HasError() { + return + } + } + + matchOrder(updatedShareInfo.Objects, planGoSDK.Objects, func(obj sharing.SharedDataObject) string { return obj.Name }) + resp.Diagnostics.Append(converters.GoSdkToTfSdkStruct(ctx, updatedShareInfo, &state)...) + if resp.Diagnostics.HasError() { + return + } + } + + state.SyncEffectiveFieldsDuringCreateOrUpdate(plan.ShareInfo) + for i := range state.Objects { + state.Objects[i].SyncEffectiveFieldsDuringCreateOrUpdate(plan.Objects[i]) + } + + resp.Diagnostics.Append(resp.State.Set(ctx, state)...) +} + +func (r *ShareResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + ctx = pluginfwcontext.SetUserAgentInResourceContext(ctx, resourceName) + + w, diags := r.Client.GetWorkspaceClient() + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + + var deleteShareRequest sharing_tf.DeleteShareRequest + resp.Diagnostics.Append(req.State.GetAttribute(ctx, path.Root("name"), &deleteShareRequest.Name)...) + if resp.Diagnostics.HasError() { + return + } + err := w.Shares.DeleteByName(ctx, deleteShareRequest.Name.ValueString()) + if err != nil && !apierr.IsMissing(err) { + resp.Diagnostics.AddError("failed to delete share", err.Error()) + return + } +} diff --git a/internal/service/apps_tf/model.go b/internal/service/apps_tf/model.go index 2c5594a1e..4f90baf11 100755 --- a/internal/service/apps_tf/model.go +++ b/internal/service/apps_tf/model.go @@ -77,24 +77,31 @@ func (newState *App) SyncEffectiveFieldsDuringCreateOrUpdate(plan App) { } func (newState *App) SyncEffectiveFieldsDuringRead(existingState App) { + newState.EffectiveCreateTime = existingState.EffectiveCreateTime if existingState.EffectiveCreateTime.ValueString() == newState.CreateTime.ValueString() { newState.CreateTime = existingState.CreateTime } + newState.EffectiveCreator = existingState.EffectiveCreator if existingState.EffectiveCreator.ValueString() == newState.Creator.ValueString() { newState.Creator = existingState.Creator } + newState.EffectiveServicePrincipalId = existingState.EffectiveServicePrincipalId if existingState.EffectiveServicePrincipalId.ValueInt64() == newState.ServicePrincipalId.ValueInt64() { newState.ServicePrincipalId = existingState.ServicePrincipalId } + newState.EffectiveServicePrincipalName = existingState.EffectiveServicePrincipalName if existingState.EffectiveServicePrincipalName.ValueString() == newState.ServicePrincipalName.ValueString() { newState.ServicePrincipalName = existingState.ServicePrincipalName } + newState.EffectiveUpdateTime = existingState.EffectiveUpdateTime if existingState.EffectiveUpdateTime.ValueString() == newState.UpdateTime.ValueString() { newState.UpdateTime = existingState.UpdateTime } + newState.EffectiveUpdater = existingState.EffectiveUpdater if existingState.EffectiveUpdater.ValueString() == newState.Updater.ValueString() { newState.Updater = existingState.Updater } + newState.EffectiveUrl = existingState.EffectiveUrl if existingState.EffectiveUrl.ValueString() == newState.Url.ValueString() { newState.Url = existingState.Url } @@ -174,12 +181,15 @@ func (newState *AppDeployment) SyncEffectiveFieldsDuringCreateOrUpdate(plan AppD } func (newState *AppDeployment) SyncEffectiveFieldsDuringRead(existingState AppDeployment) { + newState.EffectiveCreateTime = existingState.EffectiveCreateTime if existingState.EffectiveCreateTime.ValueString() == newState.CreateTime.ValueString() { newState.CreateTime = existingState.CreateTime } + newState.EffectiveCreator = existingState.EffectiveCreator if existingState.EffectiveCreator.ValueString() == newState.Creator.ValueString() { newState.Creator = existingState.Creator } + newState.EffectiveUpdateTime = existingState.EffectiveUpdateTime if existingState.EffectiveUpdateTime.ValueString() == newState.UpdateTime.ValueString() { newState.UpdateTime = existingState.UpdateTime } @@ -211,6 +221,7 @@ func (newState *AppDeploymentStatus) SyncEffectiveFieldsDuringCreateOrUpdate(pla } func (newState *AppDeploymentStatus) SyncEffectiveFieldsDuringRead(existingState AppDeploymentStatus) { + newState.EffectiveMessage = existingState.EffectiveMessage if existingState.EffectiveMessage.ValueString() == newState.Message.ValueString() { newState.Message = existingState.Message } @@ -361,6 +372,7 @@ func (newState *ApplicationStatus) SyncEffectiveFieldsDuringCreateOrUpdate(plan } func (newState *ApplicationStatus) SyncEffectiveFieldsDuringRead(existingState ApplicationStatus) { + newState.EffectiveMessage = existingState.EffectiveMessage if existingState.EffectiveMessage.ValueString() == newState.Message.ValueString() { newState.Message = existingState.Message } @@ -380,6 +392,7 @@ func (newState *ComputeStatus) SyncEffectiveFieldsDuringCreateOrUpdate(plan Comp } func (newState *ComputeStatus) SyncEffectiveFieldsDuringRead(existingState ComputeStatus) { + newState.EffectiveMessage = existingState.EffectiveMessage if existingState.EffectiveMessage.ValueString() == newState.Message.ValueString() { newState.Message = existingState.Message } diff --git a/internal/service/catalog_tf/model.go b/internal/service/catalog_tf/model.go index d06488153..55778dfa8 100755 --- a/internal/service/catalog_tf/model.go +++ b/internal/service/catalog_tf/model.go @@ -3012,6 +3012,7 @@ func (newState *OnlineTable) SyncEffectiveFieldsDuringCreateOrUpdate(plan Online } func (newState *OnlineTable) SyncEffectiveFieldsDuringRead(existingState OnlineTable) { + newState.EffectiveTableServingUrl = existingState.EffectiveTableServingUrl if existingState.EffectiveTableServingUrl.ValueString() == newState.TableServingUrl.ValueString() { newState.TableServingUrl = existingState.TableServingUrl } @@ -3051,6 +3052,7 @@ func (newState *OnlineTableSpec) SyncEffectiveFieldsDuringCreateOrUpdate(plan On } func (newState *OnlineTableSpec) SyncEffectiveFieldsDuringRead(existingState OnlineTableSpec) { + newState.EffectivePipelineId = existingState.EffectivePipelineId if existingState.EffectivePipelineId.ValueString() == newState.PipelineId.ValueString() { newState.PipelineId = existingState.PipelineId } diff --git a/internal/service/dashboards_tf/model.go b/internal/service/dashboards_tf/model.go index 85023fe5e..b76126b18 100755 --- a/internal/service/dashboards_tf/model.go +++ b/internal/service/dashboards_tf/model.go @@ -41,6 +41,7 @@ func (newState *CreateDashboardRequest) SyncEffectiveFieldsDuringCreateOrUpdate( } func (newState *CreateDashboardRequest) SyncEffectiveFieldsDuringRead(existingState CreateDashboardRequest) { + newState.EffectiveParentPath = existingState.EffectiveParentPath if existingState.EffectiveParentPath.ValueString() == newState.ParentPath.ValueString() { newState.ParentPath = existingState.ParentPath } @@ -65,6 +66,7 @@ func (newState *CreateScheduleRequest) SyncEffectiveFieldsDuringCreateOrUpdate(p } func (newState *CreateScheduleRequest) SyncEffectiveFieldsDuringRead(existingState CreateScheduleRequest) { + newState.EffectiveDashboardId = existingState.EffectiveDashboardId if existingState.EffectiveDashboardId.ValueString() == newState.DashboardId.ValueString() { newState.DashboardId = existingState.DashboardId } @@ -90,9 +92,11 @@ func (newState *CreateSubscriptionRequest) SyncEffectiveFieldsDuringCreateOrUpda } func (newState *CreateSubscriptionRequest) SyncEffectiveFieldsDuringRead(existingState CreateSubscriptionRequest) { + newState.EffectiveDashboardId = existingState.EffectiveDashboardId if existingState.EffectiveDashboardId.ValueString() == newState.DashboardId.ValueString() { newState.DashboardId = existingState.DashboardId } + newState.EffectiveScheduleId = existingState.EffectiveScheduleId if existingState.EffectiveScheduleId.ValueString() == newState.ScheduleId.ValueString() { newState.ScheduleId = existingState.ScheduleId } @@ -175,21 +179,27 @@ func (newState *Dashboard) SyncEffectiveFieldsDuringCreateOrUpdate(plan Dashboar } func (newState *Dashboard) SyncEffectiveFieldsDuringRead(existingState Dashboard) { + newState.EffectiveCreateTime = existingState.EffectiveCreateTime if existingState.EffectiveCreateTime.ValueString() == newState.CreateTime.ValueString() { newState.CreateTime = existingState.CreateTime } + newState.EffectiveDashboardId = existingState.EffectiveDashboardId if existingState.EffectiveDashboardId.ValueString() == newState.DashboardId.ValueString() { newState.DashboardId = existingState.DashboardId } + newState.EffectiveEtag = existingState.EffectiveEtag if existingState.EffectiveEtag.ValueString() == newState.Etag.ValueString() { newState.Etag = existingState.Etag } + newState.EffectiveParentPath = existingState.EffectiveParentPath if existingState.EffectiveParentPath.ValueString() == newState.ParentPath.ValueString() { newState.ParentPath = existingState.ParentPath } + newState.EffectivePath = existingState.EffectivePath if existingState.EffectivePath.ValueString() == newState.Path.ValueString() { newState.Path = existingState.Path } + newState.EffectiveUpdateTime = existingState.EffectiveUpdateTime if existingState.EffectiveUpdateTime.ValueString() == newState.UpdateTime.ValueString() { newState.UpdateTime = existingState.UpdateTime } @@ -219,12 +229,15 @@ func (newState *DeleteScheduleRequest) SyncEffectiveFieldsDuringCreateOrUpdate(p } func (newState *DeleteScheduleRequest) SyncEffectiveFieldsDuringRead(existingState DeleteScheduleRequest) { + newState.EffectiveDashboardId = existingState.EffectiveDashboardId if existingState.EffectiveDashboardId.ValueString() == newState.DashboardId.ValueString() { newState.DashboardId = existingState.DashboardId } + newState.EffectiveEtag = existingState.EffectiveEtag if existingState.EffectiveEtag.ValueString() == newState.Etag.ValueString() { newState.Etag = existingState.Etag } + newState.EffectiveScheduleId = existingState.EffectiveScheduleId if existingState.EffectiveScheduleId.ValueString() == newState.ScheduleId.ValueString() { newState.ScheduleId = existingState.ScheduleId } @@ -268,15 +281,19 @@ func (newState *DeleteSubscriptionRequest) SyncEffectiveFieldsDuringCreateOrUpda } func (newState *DeleteSubscriptionRequest) SyncEffectiveFieldsDuringRead(existingState DeleteSubscriptionRequest) { + newState.EffectiveDashboardId = existingState.EffectiveDashboardId if existingState.EffectiveDashboardId.ValueString() == newState.DashboardId.ValueString() { newState.DashboardId = existingState.DashboardId } + newState.EffectiveEtag = existingState.EffectiveEtag if existingState.EffectiveEtag.ValueString() == newState.Etag.ValueString() { newState.Etag = existingState.Etag } + newState.EffectiveScheduleId = existingState.EffectiveScheduleId if existingState.EffectiveScheduleId.ValueString() == newState.ScheduleId.ValueString() { newState.ScheduleId = existingState.ScheduleId } + newState.EffectiveSubscriptionId = existingState.EffectiveSubscriptionId if existingState.EffectiveSubscriptionId.ValueString() == newState.SubscriptionId.ValueString() { newState.SubscriptionId = existingState.SubscriptionId } @@ -520,9 +537,11 @@ func (newState *GetScheduleRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan } func (newState *GetScheduleRequest) SyncEffectiveFieldsDuringRead(existingState GetScheduleRequest) { + newState.EffectiveDashboardId = existingState.EffectiveDashboardId if existingState.EffectiveDashboardId.ValueString() == newState.DashboardId.ValueString() { newState.DashboardId = existingState.DashboardId } + newState.EffectiveScheduleId = existingState.EffectiveScheduleId if existingState.EffectiveScheduleId.ValueString() == newState.ScheduleId.ValueString() { newState.ScheduleId = existingState.ScheduleId } @@ -551,12 +570,15 @@ func (newState *GetSubscriptionRequest) SyncEffectiveFieldsDuringCreateOrUpdate( } func (newState *GetSubscriptionRequest) SyncEffectiveFieldsDuringRead(existingState GetSubscriptionRequest) { + newState.EffectiveDashboardId = existingState.EffectiveDashboardId if existingState.EffectiveDashboardId.ValueString() == newState.DashboardId.ValueString() { newState.DashboardId = existingState.DashboardId } + newState.EffectiveScheduleId = existingState.EffectiveScheduleId if existingState.EffectiveScheduleId.ValueString() == newState.ScheduleId.ValueString() { newState.ScheduleId = existingState.ScheduleId } + newState.EffectiveSubscriptionId = existingState.EffectiveSubscriptionId if existingState.EffectiveSubscriptionId.ValueString() == newState.SubscriptionId.ValueString() { newState.SubscriptionId = existingState.SubscriptionId } @@ -583,6 +605,7 @@ func (newState *ListDashboardsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(p } func (newState *ListDashboardsRequest) SyncEffectiveFieldsDuringRead(existingState ListDashboardsRequest) { + newState.EffectivePageToken = existingState.EffectivePageToken if existingState.EffectivePageToken.ValueString() == newState.PageToken.ValueString() { newState.PageToken = existingState.PageToken } @@ -602,6 +625,7 @@ func (newState *ListDashboardsResponse) SyncEffectiveFieldsDuringCreateOrUpdate( } func (newState *ListDashboardsResponse) SyncEffectiveFieldsDuringRead(existingState ListDashboardsResponse) { + newState.EffectiveNextPageToken = existingState.EffectiveNextPageToken if existingState.EffectiveNextPageToken.ValueString() == newState.NextPageToken.ValueString() { newState.NextPageToken = existingState.NextPageToken } @@ -628,9 +652,11 @@ func (newState *ListSchedulesRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pl } func (newState *ListSchedulesRequest) SyncEffectiveFieldsDuringRead(existingState ListSchedulesRequest) { + newState.EffectiveDashboardId = existingState.EffectiveDashboardId if existingState.EffectiveDashboardId.ValueString() == newState.DashboardId.ValueString() { newState.DashboardId = existingState.DashboardId } + newState.EffectivePageToken = existingState.EffectivePageToken if existingState.EffectivePageToken.ValueString() == newState.PageToken.ValueString() { newState.PageToken = existingState.PageToken } @@ -652,6 +678,7 @@ func (newState *ListSchedulesResponse) SyncEffectiveFieldsDuringCreateOrUpdate(p } func (newState *ListSchedulesResponse) SyncEffectiveFieldsDuringRead(existingState ListSchedulesResponse) { + newState.EffectiveNextPageToken = existingState.EffectiveNextPageToken if existingState.EffectiveNextPageToken.ValueString() == newState.NextPageToken.ValueString() { newState.NextPageToken = existingState.NextPageToken } @@ -683,12 +710,15 @@ func (newState *ListSubscriptionsRequest) SyncEffectiveFieldsDuringCreateOrUpdat } func (newState *ListSubscriptionsRequest) SyncEffectiveFieldsDuringRead(existingState ListSubscriptionsRequest) { + newState.EffectiveDashboardId = existingState.EffectiveDashboardId if existingState.EffectiveDashboardId.ValueString() == newState.DashboardId.ValueString() { newState.DashboardId = existingState.DashboardId } + newState.EffectivePageToken = existingState.EffectivePageToken if existingState.EffectivePageToken.ValueString() == newState.PageToken.ValueString() { newState.PageToken = existingState.PageToken } + newState.EffectiveScheduleId = existingState.EffectiveScheduleId if existingState.EffectiveScheduleId.ValueString() == newState.ScheduleId.ValueString() { newState.ScheduleId = existingState.ScheduleId } @@ -710,6 +740,7 @@ func (newState *ListSubscriptionsResponse) SyncEffectiveFieldsDuringCreateOrUpda } func (newState *ListSubscriptionsResponse) SyncEffectiveFieldsDuringRead(existingState ListSubscriptionsResponse) { + newState.EffectiveNextPageToken = existingState.EffectiveNextPageToken if existingState.EffectiveNextPageToken.ValueString() == newState.NextPageToken.ValueString() { newState.NextPageToken = existingState.NextPageToken } @@ -782,9 +813,11 @@ func (newState *PublishedDashboard) SyncEffectiveFieldsDuringCreateOrUpdate(plan } func (newState *PublishedDashboard) SyncEffectiveFieldsDuringRead(existingState PublishedDashboard) { + newState.EffectiveDisplayName = existingState.EffectiveDisplayName if existingState.EffectiveDisplayName.ValueString() == newState.DisplayName.ValueString() { newState.DisplayName = existingState.DisplayName } + newState.EffectiveRevisionCreateTime = existingState.EffectiveRevisionCreateTime if existingState.EffectiveRevisionCreateTime.ValueString() == newState.RevisionCreateTime.ValueString() { newState.RevisionCreateTime = existingState.RevisionCreateTime } @@ -873,18 +906,23 @@ func (newState *Schedule) SyncEffectiveFieldsDuringCreateOrUpdate(plan Schedule) } func (newState *Schedule) SyncEffectiveFieldsDuringRead(existingState Schedule) { + newState.EffectiveCreateTime = existingState.EffectiveCreateTime if existingState.EffectiveCreateTime.ValueString() == newState.CreateTime.ValueString() { newState.CreateTime = existingState.CreateTime } + newState.EffectiveDashboardId = existingState.EffectiveDashboardId if existingState.EffectiveDashboardId.ValueString() == newState.DashboardId.ValueString() { newState.DashboardId = existingState.DashboardId } + newState.EffectiveEtag = existingState.EffectiveEtag if existingState.EffectiveEtag.ValueString() == newState.Etag.ValueString() { newState.Etag = existingState.Etag } + newState.EffectiveScheduleId = existingState.EffectiveScheduleId if existingState.EffectiveScheduleId.ValueString() == newState.ScheduleId.ValueString() { newState.ScheduleId = existingState.ScheduleId } + newState.EffectiveUpdateTime = existingState.EffectiveUpdateTime if existingState.EffectiveUpdateTime.ValueString() == newState.UpdateTime.ValueString() { newState.UpdateTime = existingState.UpdateTime } @@ -953,24 +991,31 @@ func (newState *Subscription) SyncEffectiveFieldsDuringCreateOrUpdate(plan Subsc } func (newState *Subscription) SyncEffectiveFieldsDuringRead(existingState Subscription) { + newState.EffectiveCreateTime = existingState.EffectiveCreateTime if existingState.EffectiveCreateTime.ValueString() == newState.CreateTime.ValueString() { newState.CreateTime = existingState.CreateTime } + newState.EffectiveCreatedByUserId = existingState.EffectiveCreatedByUserId if existingState.EffectiveCreatedByUserId.ValueInt64() == newState.CreatedByUserId.ValueInt64() { newState.CreatedByUserId = existingState.CreatedByUserId } + newState.EffectiveDashboardId = existingState.EffectiveDashboardId if existingState.EffectiveDashboardId.ValueString() == newState.DashboardId.ValueString() { newState.DashboardId = existingState.DashboardId } + newState.EffectiveEtag = existingState.EffectiveEtag if existingState.EffectiveEtag.ValueString() == newState.Etag.ValueString() { newState.Etag = existingState.Etag } + newState.EffectiveScheduleId = existingState.EffectiveScheduleId if existingState.EffectiveScheduleId.ValueString() == newState.ScheduleId.ValueString() { newState.ScheduleId = existingState.ScheduleId } + newState.EffectiveSubscriptionId = existingState.EffectiveSubscriptionId if existingState.EffectiveSubscriptionId.ValueString() == newState.SubscriptionId.ValueString() { newState.SubscriptionId = existingState.SubscriptionId } + newState.EffectiveUpdateTime = existingState.EffectiveUpdateTime if existingState.EffectiveUpdateTime.ValueString() == newState.UpdateTime.ValueString() { newState.UpdateTime = existingState.UpdateTime } @@ -989,6 +1034,7 @@ func (newState *SubscriptionSubscriberDestination) SyncEffectiveFieldsDuringCrea } func (newState *SubscriptionSubscriberDestination) SyncEffectiveFieldsDuringRead(existingState SubscriptionSubscriberDestination) { + newState.EffectiveDestinationId = existingState.EffectiveDestinationId if existingState.EffectiveDestinationId.ValueString() == newState.DestinationId.ValueString() { newState.DestinationId = existingState.DestinationId } @@ -1006,6 +1052,7 @@ func (newState *SubscriptionSubscriberUser) SyncEffectiveFieldsDuringCreateOrUpd } func (newState *SubscriptionSubscriberUser) SyncEffectiveFieldsDuringRead(existingState SubscriptionSubscriberUser) { + newState.EffectiveUserId = existingState.EffectiveUserId if existingState.EffectiveUserId.ValueInt64() == newState.UserId.ValueInt64() { newState.UserId = existingState.UserId } @@ -1094,6 +1141,7 @@ func (newState *UpdateDashboardRequest) SyncEffectiveFieldsDuringCreateOrUpdate( } func (newState *UpdateDashboardRequest) SyncEffectiveFieldsDuringRead(existingState UpdateDashboardRequest) { + newState.EffectiveEtag = existingState.EffectiveEtag if existingState.EffectiveEtag.ValueString() == newState.Etag.ValueString() { newState.Etag = existingState.Etag } @@ -1130,12 +1178,15 @@ func (newState *UpdateScheduleRequest) SyncEffectiveFieldsDuringCreateOrUpdate(p } func (newState *UpdateScheduleRequest) SyncEffectiveFieldsDuringRead(existingState UpdateScheduleRequest) { + newState.EffectiveDashboardId = existingState.EffectiveDashboardId if existingState.EffectiveDashboardId.ValueString() == newState.DashboardId.ValueString() { newState.DashboardId = existingState.DashboardId } + newState.EffectiveEtag = existingState.EffectiveEtag if existingState.EffectiveEtag.ValueString() == newState.Etag.ValueString() { newState.Etag = existingState.Etag } + newState.EffectiveScheduleId = existingState.EffectiveScheduleId if existingState.EffectiveScheduleId.ValueString() == newState.ScheduleId.ValueString() { newState.ScheduleId = existingState.ScheduleId } diff --git a/internal/service/jobs_tf/model.go b/internal/service/jobs_tf/model.go index 35f110fbe..295d1e1a9 100755 --- a/internal/service/jobs_tf/model.go +++ b/internal/service/jobs_tf/model.go @@ -43,6 +43,7 @@ func (newState *BaseJob) SyncEffectiveFieldsDuringCreateOrUpdate(plan BaseJob) { } func (newState *BaseJob) SyncEffectiveFieldsDuringRead(existingState BaseJob) { + newState.EffectiveEffectiveBudgetPolicyId = existingState.EffectiveEffectiveBudgetPolicyId if existingState.EffectiveEffectiveBudgetPolicyId.ValueString() == newState.EffectiveBudgetPolicyId.ValueString() { newState.EffectiveBudgetPolicyId = existingState.EffectiveBudgetPolicyId } @@ -944,6 +945,7 @@ func (newState *Job) SyncEffectiveFieldsDuringCreateOrUpdate(plan Job) { } func (newState *Job) SyncEffectiveFieldsDuringRead(existingState Job) { + newState.EffectiveEffectiveBudgetPolicyId = existingState.EffectiveEffectiveBudgetPolicyId if existingState.EffectiveEffectiveBudgetPolicyId.ValueString() == newState.EffectiveBudgetPolicyId.ValueString() { newState.EffectiveBudgetPolicyId = existingState.EffectiveBudgetPolicyId } diff --git a/internal/service/provisioning_tf/model.go b/internal/service/provisioning_tf/model.go index be8e5f0c2..17d8bbc18 100755 --- a/internal/service/provisioning_tf/model.go +++ b/internal/service/provisioning_tf/model.go @@ -342,6 +342,7 @@ func (newState *Credential) SyncEffectiveFieldsDuringCreateOrUpdate(plan Credent } func (newState *Credential) SyncEffectiveFieldsDuringRead(existingState Credential) { + newState.EffectiveCreationTime = existingState.EffectiveCreationTime if existingState.EffectiveCreationTime.ValueInt64() == newState.CreationTime.ValueInt64() { newState.CreationTime = existingState.CreationTime } @@ -382,6 +383,7 @@ func (newState *CustomerManagedKey) SyncEffectiveFieldsDuringCreateOrUpdate(plan } func (newState *CustomerManagedKey) SyncEffectiveFieldsDuringRead(existingState CustomerManagedKey) { + newState.EffectiveCreationTime = existingState.EffectiveCreationTime if existingState.EffectiveCreationTime.ValueInt64() == newState.CreationTime.ValueInt64() { newState.CreationTime = existingState.CreationTime } @@ -739,9 +741,11 @@ func (newState *Network) SyncEffectiveFieldsDuringCreateOrUpdate(plan Network) { } func (newState *Network) SyncEffectiveFieldsDuringRead(existingState Network) { + newState.EffectiveCreationTime = existingState.EffectiveCreationTime if existingState.EffectiveCreationTime.ValueInt64() == newState.CreationTime.ValueInt64() { newState.CreationTime = existingState.CreationTime } + newState.EffectiveVpcStatus = existingState.EffectiveVpcStatus if existingState.EffectiveVpcStatus.ValueString() == newState.VpcStatus.ValueString() { newState.VpcStatus = existingState.VpcStatus } @@ -871,9 +875,11 @@ func (newState *StorageConfiguration) SyncEffectiveFieldsDuringCreateOrUpdate(pl } func (newState *StorageConfiguration) SyncEffectiveFieldsDuringRead(existingState StorageConfiguration) { + newState.EffectiveAccountId = existingState.EffectiveAccountId if existingState.EffectiveAccountId.ValueString() == newState.AccountId.ValueString() { newState.AccountId = existingState.AccountId } + newState.EffectiveCreationTime = existingState.EffectiveCreationTime if existingState.EffectiveCreationTime.ValueInt64() == newState.CreationTime.ValueInt64() { newState.CreationTime = existingState.CreationTime } @@ -1135,12 +1141,15 @@ func (newState *Workspace) SyncEffectiveFieldsDuringCreateOrUpdate(plan Workspac } func (newState *Workspace) SyncEffectiveFieldsDuringRead(existingState Workspace) { + newState.EffectiveCreationTime = existingState.EffectiveCreationTime if existingState.EffectiveCreationTime.ValueInt64() == newState.CreationTime.ValueInt64() { newState.CreationTime = existingState.CreationTime } + newState.EffectiveWorkspaceStatus = existingState.EffectiveWorkspaceStatus if existingState.EffectiveWorkspaceStatus.ValueString() == newState.WorkspaceStatus.ValueString() { newState.WorkspaceStatus = existingState.WorkspaceStatus } + newState.EffectiveWorkspaceStatusMessage = existingState.EffectiveWorkspaceStatusMessage if existingState.EffectiveWorkspaceStatusMessage.ValueString() == newState.WorkspaceStatusMessage.ValueString() { newState.WorkspaceStatusMessage = existingState.WorkspaceStatusMessage } diff --git a/internal/service/settings_tf/model.go b/internal/service/settings_tf/model.go index 3ca9895b8..71b73ba25 100755 --- a/internal/service/settings_tf/model.go +++ b/internal/service/settings_tf/model.go @@ -1543,24 +1543,31 @@ func (newState *NccAzurePrivateEndpointRule) SyncEffectiveFieldsDuringCreateOrUp } func (newState *NccAzurePrivateEndpointRule) SyncEffectiveFieldsDuringRead(existingState NccAzurePrivateEndpointRule) { + newState.EffectiveConnectionState = existingState.EffectiveConnectionState if existingState.EffectiveConnectionState.ValueString() == newState.ConnectionState.ValueString() { newState.ConnectionState = existingState.ConnectionState } + newState.EffectiveCreationTime = existingState.EffectiveCreationTime if existingState.EffectiveCreationTime.ValueInt64() == newState.CreationTime.ValueInt64() { newState.CreationTime = existingState.CreationTime } + newState.EffectiveDeactivated = existingState.EffectiveDeactivated if existingState.EffectiveDeactivated.ValueBool() == newState.Deactivated.ValueBool() { newState.Deactivated = existingState.Deactivated } + newState.EffectiveDeactivatedAt = existingState.EffectiveDeactivatedAt if existingState.EffectiveDeactivatedAt.ValueInt64() == newState.DeactivatedAt.ValueInt64() { newState.DeactivatedAt = existingState.DeactivatedAt } + newState.EffectiveEndpointName = existingState.EffectiveEndpointName if existingState.EffectiveEndpointName.ValueString() == newState.EndpointName.ValueString() { newState.EndpointName = existingState.EndpointName } + newState.EffectiveRuleId = existingState.EffectiveRuleId if existingState.EffectiveRuleId.ValueString() == newState.RuleId.ValueString() { newState.RuleId = existingState.RuleId } + newState.EffectiveUpdatedTime = existingState.EffectiveUpdatedTime if existingState.EffectiveUpdatedTime.ValueInt64() == newState.UpdatedTime.ValueInt64() { newState.UpdatedTime = existingState.UpdatedTime } @@ -1672,12 +1679,15 @@ func (newState *NetworkConnectivityConfiguration) SyncEffectiveFieldsDuringCreat } func (newState *NetworkConnectivityConfiguration) SyncEffectiveFieldsDuringRead(existingState NetworkConnectivityConfiguration) { + newState.EffectiveCreationTime = existingState.EffectiveCreationTime if existingState.EffectiveCreationTime.ValueInt64() == newState.CreationTime.ValueInt64() { newState.CreationTime = existingState.CreationTime } + newState.EffectiveNetworkConnectivityConfigId = existingState.EffectiveNetworkConnectivityConfigId if existingState.EffectiveNetworkConnectivityConfigId.ValueString() == newState.NetworkConnectivityConfigId.ValueString() { newState.NetworkConnectivityConfigId = existingState.NetworkConnectivityConfigId } + newState.EffectiveUpdatedTime = existingState.EffectiveUpdatedTime if existingState.EffectiveUpdatedTime.ValueInt64() == newState.UpdatedTime.ValueInt64() { newState.UpdatedTime = existingState.UpdatedTime } diff --git a/internal/service/sharing_tf/model.go b/internal/service/sharing_tf/model.go index 1cb502202..0192deeaa 100755 --- a/internal/service/sharing_tf/model.go +++ b/internal/service/sharing_tf/model.go @@ -892,6 +892,7 @@ func (newState *ShareInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan ShareInf } func (newState *ShareInfo) SyncEffectiveFieldsDuringRead(existingState ShareInfo) { + newState.EffectiveOwner = existingState.EffectiveOwner if existingState.EffectiveOwner.ValueString() == newState.Owner.ValueString() { newState.Owner = existingState.Owner } @@ -1000,15 +1001,19 @@ func (newState *SharedDataObject) SyncEffectiveFieldsDuringCreateOrUpdate(plan S } func (newState *SharedDataObject) SyncEffectiveFieldsDuringRead(existingState SharedDataObject) { + newState.EffectiveCdfEnabled = existingState.EffectiveCdfEnabled if existingState.EffectiveCdfEnabled.ValueBool() == newState.CdfEnabled.ValueBool() { newState.CdfEnabled = existingState.CdfEnabled } + newState.EffectiveHistoryDataSharingStatus = existingState.EffectiveHistoryDataSharingStatus if existingState.EffectiveHistoryDataSharingStatus.ValueString() == newState.HistoryDataSharingStatus.ValueString() { newState.HistoryDataSharingStatus = existingState.HistoryDataSharingStatus } + newState.EffectiveSharedAs = existingState.EffectiveSharedAs if existingState.EffectiveSharedAs.ValueString() == newState.SharedAs.ValueString() { newState.SharedAs = existingState.SharedAs } + newState.EffectiveStartVersion = existingState.EffectiveStartVersion if existingState.EffectiveStartVersion.ValueInt64() == newState.StartVersion.ValueInt64() { newState.StartVersion = existingState.StartVersion } @@ -1130,6 +1135,7 @@ func (newState *UpdateShare) SyncEffectiveFieldsDuringCreateOrUpdate(plan Update } func (newState *UpdateShare) SyncEffectiveFieldsDuringRead(existingState UpdateShare) { + newState.EffectiveOwner = existingState.EffectiveOwner if existingState.EffectiveOwner.ValueString() == newState.Owner.ValueString() { newState.Owner = existingState.Owner }