From c4a3ad36f825ae5c19de81a7f3c4e0a81347b8cb Mon Sep 17 00:00:00 2001 From: neil-yechenwei Date: Mon, 26 Feb 2024 09:50:55 +0800 Subject: [PATCH] update code --- ...al_machine_manager_availability_set_resource.go | 8 +++++--- ...chine_manager_availability_set_resource_test.go | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_availability_set_resource.go b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_availability_set_resource.go index 4ed8116e1f74..3ca3126bf673 100644 --- a/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_availability_set_resource.go +++ b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_availability_set_resource.go @@ -148,7 +148,7 @@ func (r SystemCenterVirtualMachineManagerAvailabilitySetResource) Read() sdk.Res state.CustomLocationId = pointer.From(model.ExtendedLocation.Name) state.Tags = pointer.From(model.Tags) - scvmmServerId, err := vmmservers.ParseVMmServerID(pointer.From(model.Properties.VMmServerId)) + scvmmServerId, err := vmmservers.ParseVMmServerIDInsensitively(pointer.From(model.Properties.VMmServerId)) if err != nil { return err } @@ -176,8 +176,10 @@ func (r SystemCenterVirtualMachineManagerAvailabilitySetResource) Update() sdk.R return fmt.Errorf("decoding: %+v", err) } - parameters := availabilitysets.ResourcePatch{ - Tags: pointer.To(model.Tags), + parameters := availabilitysets.ResourcePatch{} + + if metadata.ResourceData.HasChange("tags") { + parameters.Tags = pointer.To(model.Tags) } if err := client.UpdateThenPoll(ctx, *id, parameters); err != nil { diff --git a/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_availability_set_resource_test.go b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_availability_set_resource_test.go index a5f77241176e..6f81943dc9f4 100644 --- a/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_availability_set_resource_test.go +++ b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_availability_set_resource_test.go @@ -83,6 +83,13 @@ func testAccSystemCenterVirtualMachineManagerAvailabilitySet_update(t *testing.T r := SystemCenterVirtualMachineManagerAvailabilitySetResource{} data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), { Config: r.complete(data), Check: acceptance.ComposeTestCheckFunc( @@ -97,6 +104,13 @@ func testAccSystemCenterVirtualMachineManagerAvailabilitySet_update(t *testing.T ), }, data.ImportStep(), + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), }) }