equinix / terraform-provider-equinix

Terraform Equinix provider
https://deploy.equinix.com/labs/terraform-provider-equinix/
MIT License
46 stars 45 forks source link

fix: convert metal_connection delete to equinix-sdk-go #721

Closed ctreatma closed 4 months ago

ctreatma commented 4 months ago

This issue came out of investigation into Metal acceptance test failures in which the tests appear to be failing because a connection that was deleted came back from the API with status deleted

=== NAME TestAccMetalConnection_sharedVlan resource_test.go:256: Error running post-test destroy, there may be dangling resources: exit status 1

    Error: Failed to delete Metal Connection 3e4601f8-5aa3-4696-bfc9-363dbb14554e

    Connection 3e4601f8-5aa3-4696-bfc9-363dbb14554e is in undexpected state
    deleted

--- FAIL: TestAccMetalConnection_sharedVlan (25.25s)

The metal_connection resource and data source were previously migrated from the deprecated packngo SDK to equinix-sdk-go, but in that migration the Delete function for the metal_connection resource was missed.

This updates the resource Delete function to use equinix-sdk-go instead of packngo. This requires adding a state waiter to replicate the wait functionality that was built in to packngo. As part of this migration, the waiter is updated to allow the deleted status that can be returned by the API for a deleted connection.

codecov-commenter commented 4 months ago

:warning: Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 0% with 31 lines in your changes missing coverage. Please review.

Project coverage is 34.40%. Comparing base (f8c2ab9) to head (8c1d06a).

Files Patch % Lines
internal/resources/metal/connection/resource.go 0.00% 31 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #721 +/- ## ========================================== - Coverage 34.44% 34.40% -0.04% ========================================== Files 151 151 Lines 20710 20734 +24 ========================================== Hits 7133 7133 - Misses 13415 13439 +24 Partials 162 162 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.