-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: finish moving device resource off of packngo #501
Conversation
7958820
to
23f7340
Compare
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #501 +/- ##
==========================================
- Coverage 60.11% 59.06% -1.06%
==========================================
Files 99 96 -3
Lines 20045 19855 -190
==========================================
- Hits 12051 11727 -324
- Misses 7691 7832 +141
+ Partials 303 296 -7 ☔ View full report in Codecov by Sentry. |
23f7340
to
f0d1583
Compare
f0d1583
to
4d1e997
Compare
4d1e997
to
bf81d6d
Compare
bf81d6d
to
dcacfe4
Compare
dcacfe4
to
08ce405
Compare
08ce405
to
57a7d81
Compare
57a7d81
to
e689b16
Compare
e689b16
to
5865bab
Compare
5865bab
to
febbae9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
febbae9
to
c0357d4
Compare
c0357d4
to
cebf38a
Compare
cebf38a
to
5bab641
Compare
5bab641
to
1a36ef1
Compare
meta.(*config.Config).AddModuleToMetalGoUserAgent(d) | ||
client := meta.(*config.Config).Metalgo | ||
|
||
ur := metalv1.DeviceUpdateInput{} | ||
|
||
if d.HasChange("locked") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So...after digging into what it means for a device to be locked and confirming that we don't have to use a separate update request to change the lock status, it turns out that locked
is a computed attribute for a metal_device
resource, so it's not actually possible to hit this code path anyway.
So: do we want to stick with the existing behavior that locked
can't be changed or do we want to support locking/unlocking devices in terraform?
For reference, this is the information we got about what locking does:
It seems that locking a device prevents you from:
- Delete/deprovision the device
- Reinstall the device
- Prevents an instance with a termination time set to be reclaimed, even if the termination time was reached (for spot instances, we will reclaim it anyway)
- Perform a Firmware update on the device (this feature is not GA yet)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like it's a core state for our devices to support and so terraform should be able to do it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The list of lock affecting features is helpful context. Without that we may expect behaviors that are not present today: https://feedback.equinixdigital.com/instances/p/expand-lock-feature-for-metal-servers.
It's worth considering the ways Terraform and a Portal user would interact through EM API device locking (not to be confused with Terraform state locking).
If Terraform takes an "optional" (default=false) behavior, rather than computed, then plan/apply from Terraform would inform users that an externally applied lock
is going to be reset upon change.
When Terraform config requests lock
, then any API changes that are incompatible with lock
would fail until the Terraform config is modified to lock=false
(or the lock
line is removed).
I'm not seeing any problems in taking this approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, sounds like we're all agreed; I'm going to update the resource so that locked
can be set and update the docs accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I enabled locking/unlocking a device resource; this PR has been updated but here's a direct link to the commit that has those changes: 836f1f0
I opted to make locked
optional and computed, rather than optional with a default. IMO changing it from computed to default has a bigger impact on existing users, because if we switch to a default of false then any terraform user who currently has a locked device is at risk for accidentally unlocking the device as a result of a non-major-version provider upgrade.
The only E2E failure that doesn't look like flake, but also looks to be unrelated:
|
We previously migrated the Equinix Metal device data source and the read pathways for the resource from
packngo
tometal-go
(and then toequinix-sdk-go
). This finishes the migration of the device resource by replacingpackngo
withequinix-sdk-go
in the create, update, and delete pathways for that resource.