diff --git a/internal/providers/pluginfw/products/app/resource_app.go b/internal/providers/pluginfw/products/app/resource_app.go index 0bd570b59..180241e75 100644 --- a/internal/providers/pluginfw/products/app/resource_app.go +++ b/internal/providers/pluginfw/products/app/resource_app.go @@ -159,7 +159,7 @@ func (a *resourceApp) Update(ctx context.Context, req resource.UpdateRequest, re if resp.Diagnostics.HasError() { return } - _, err := w.Apps.Update(ctx, apps.UpdateAppRequest{App: &appGoSdk, Name: app.Name.ValueString()}) + response, err := w.Apps.Update(ctx, apps.UpdateAppRequest{App: &appGoSdk, Name: app.Name.ValueString()}) if err != nil { resp.Diagnostics.AddError("failed to update app", err.Error()) return @@ -167,7 +167,7 @@ func (a *resourceApp) Update(ctx context.Context, req resource.UpdateRequest, re // Store the updated version of the app in state var newApp apps_tf.App - resp.Diagnostics.Append(converters.GoSdkToTfSdkStruct(ctx, appGoSdk, &newApp)...) + resp.Diagnostics.Append(converters.GoSdkToTfSdkStruct(ctx, response, &newApp)...) if resp.Diagnostics.HasError() { return } diff --git a/internal/providers/pluginfw/products/app/resource_app_acc_test.go b/internal/providers/pluginfw/products/app/resource_app_acc_test.go index fbbcd7838..19f37bf91 100644 --- a/internal/providers/pluginfw/products/app/resource_app_acc_test.go +++ b/internal/providers/pluginfw/products/app/resource_app_acc_test.go @@ -6,6 +6,8 @@ import ( "testing" "github.com/databricks/terraform-provider-databricks/internal/acceptance" + "github.com/hashicorp/terraform-plugin-testing/terraform" + "github.com/stretchr/testify/assert" ) const baseResources = ` @@ -118,14 +120,24 @@ is required`)), } func TestAccAppResource(t *testing.T) { + var updateTime string acceptance.LoadWorkspaceEnv(t) if acceptance.IsGcp(t) { acceptance.Skipf(t)("not available on GCP") } acceptance.WorkspaceLevel(t, acceptance.Step{ Template: makeTemplate("My app"), + Check: func(s *terraform.State) error { + updateTime = s.RootModule().Resources["databricks_app.this"].Primary.Attributes["update_time"] + return nil + }, }, acceptance.Step{ Template: makeTemplate("My new app"), + Check: func(s *terraform.State) error { + var newUpdateTime = s.RootModule().Resources["databricks_app.this"].Primary.Attributes["update_time"] + assert.NotEqual(t, updateTime, newUpdateTime) + return nil + }, }, acceptance.Step{ ImportState: true, ResourceName: "databricks_app.this",