diff --git a/apstra/blueprint/device_allocation_system_attributes.go b/apstra/blueprint/device_allocation_system_attributes.go index 79be5ab0..52e9ac1c 100644 --- a/apstra/blueprint/device_allocation_system_attributes.go +++ b/apstra/blueprint/device_allocation_system_attributes.go @@ -429,8 +429,8 @@ func (o *DeviceAllocationSystemAttributes) setProperties(ctx context.Context, bp func (o *DeviceAllocationSystemAttributes) setTags(ctx context.Context, state *DeviceAllocationSystemAttributes, bp *apstra.TwoStageL3ClosClient, nodeId apstra.ObjectId, diags *diag.Diagnostics) { // not a Computed value, so IsNull() will suffice - if o.Tags.IsNull() && len(state.Tags.Elements()) == 0 { - // tags not supplied by user indicates we intend to clear them + if len(o.Tags.Elements()) == 0 && (state == nil || len(state.Tags.Elements()) == 0) { + // user supplied no tags (requiring us to clear them), but state indicates no tags exist return } diff --git a/apstra/resource_datacenter_device_allocation_test.go b/apstra/resource_datacenter_device_allocation_test.go index 420bf740..60555aaa 100644 --- a/apstra/resource_datacenter_device_allocation_test.go +++ b/apstra/resource_datacenter_device_allocation_test.go @@ -492,6 +492,24 @@ func TestResourceDatacenterDeviceAllocation(t *testing.T) { }, }, }, + "bug_584": { + steps: []testStep{ + { + config: deviceAllocation{ + blueprintId: bpClient.Id().String(), + nodeName: "l2_one_access_001_leaf1", + initialInterfaceMapId: "Juniper_vQFX__AOS-7x10-Leaf", + systemAttributes: &systemAttributes{ + deployMode: "drain", + }, + }, + checks: []resource.TestCheckFunc{ + resource.TestCheckResourceAttr(resourceDataCenterDeviceAllocationRefName, "blueprint_id", bpClient.Id().String()), + resource.TestCheckResourceAttr(resourceDataCenterDeviceAllocationRefName, "deploy_mode", utils.StringersToFriendlyString(apstra.NodeDeployModeDrain)), + }, + }, + }, + }, } for tName, tCase := range testCases {