-
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
check for forbidden in equinix_metal_device read #235
Conversation
Codecov Report
@@ Coverage Diff @@
## master #235 +/- ##
==========================================
- Coverage 59.94% 59.02% -0.92%
==========================================
Files 73 73
Lines 12564 12565 +1
==========================================
- Hits 7531 7417 -114
- Misses 4739 4868 +129
+ Partials 294 280 -14
Continue to review full report at Codecov.
|
Go tests are failing:
|
Updated with desired behavior: If it's a new resource (create), then remote operation error (in that case 404 Not Found) should be returned to prevent terraform sdk from returning a more opaque error "Provider produced inconsistent result after apply" |
check for forbidden in equinix_metal_device read
Create and Delete functions were already checking for 404s/403s, however it may occur a device is in failed state for external changes from the portal or any way out of terraform, returning a 403s in a refresh/plan/apply (read) action.
Added 403 check on read function and to remove resource from terraform state without errors. It will also check isNewResource to prevent the terraform import from failing silently.
Added a mock for packngo.DeviceService, with only implementation of the GET method. Other methods can be implemented gradually in the future according to the tests needs.
Fix #233