Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Commit c57d85c

Browse files
authored
Merge pull request #305 from packethost/ignore-next-available
fix BC break with hardware_reservation_id = next-available handling
2 parents a57d33e + a903c77 commit c57d85c

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1+
## 3.2.1 (December 10, 2020)
2+
3+
BUG FIXES:
4+
- [#304](https://github.com/packethost/terraform-provider-packet/issues/304) Upon updating to 3.2.0, the breaking change would taint any devices with a stated `hardware_reservation_id = "next-available"` value and a computed UUID, before 3.2.0 this diff was ignored by the provider. The 3.1.0 diff behavior has been restored, removing the breaking change.
5+
16
## 3.2.0 (December 02, 2020)
27

38
BREAKING CHANGES:
4-
- attribute `hardware_reservation_id` of the `packet_device` resource is not intended to be read anymore. Users should read `deployed_hardware_reservation_id` to find out to which hardware reservation a device was deployed.
9+
- [#289](https://github.com/packethost/terraform-provider-packet/issues/289) `packet_device` attribute `hardware_reservation_id` is now for stating the intended value. The `hardware_reservation_id` of the deployed device can now be found in the computed `deployed_hardware_reservation_id` field.
510

611
FEATURES:
712
- [#294](https://github.com/packethost/terraform-provider-packet/pull/294) New parameters `tags` and `ipxe_script_url` for `packet_spot_market_request`

packet/resource_packet_device.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,29 @@ func resourcePacketDevice() *schema.Resource {
245245
Optional: true,
246246
ForceNew: true,
247247
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
248+
// backward compatibility for < 3.2.0:
249+
// removing hardware_reservation_id did not force recreation
250+
// (probably because of Computed:true, removed in 3.2.0)
251+
if new == "" {
252+
return true
253+
}
254+
248255
dhwr, ok := d.GetOk("deployed_hardware_reservation_id")
256+
257+
// ignore changes to "next-available" when the state matches
258+
// the deployed hardware (for "< 3.2.0" compatibility)
259+
if ok && new == "next-available" && dhwr == old {
260+
return true
261+
}
262+
263+
// preseve legacy behavior to avoid BC break:
264+
// ignore moves from UUID -> next-available
265+
if new == "next-available" && len(old) > 0 {
266+
return true
267+
}
268+
269+
// ignore changes to hardware_reservation_id when new
270+
// matches the deployed hardware
249271
return ok && dhwr == new
250272
},
251273
},

0 commit comments

Comments
 (0)