Skip to content

Commit

Permalink
update code
Browse files Browse the repository at this point in the history
  • Loading branch information
neil-yechenwei committed Feb 26, 2024
1 parent 704b144 commit c4a3ad3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(),
})
}

Expand Down

0 comments on commit c4a3ad3

Please sign in to comment.