-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use
metal-go
for the device and BGP neighbors data sources
This updates the device data source and the device BGP neighbors data source to use `metal-go` instead of `packngo`. As part of this migration, the device data source gains the new `sos_hostname` attribute which enables customers to reduce their reliance on the deprecated `facility` attribute, which was previously necessary in order to compute the SOS hostname for a device. There were no tests for the BGP neighbors data source, so those are added here as well.
- Loading branch information
Showing
7 changed files
with
197 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
equinix/data_source_metal_device_bgp_neighbors_acc_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package equinix | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
) | ||
|
||
func TestAccDataSourceMetalDeviceBgpNeighbors(t *testing.T) { | ||
projectName := fmt.Sprintf("ds-device-%s", acctest.RandString(10)) | ||
|
||
resource.ParallelTest(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
ExternalProviders: testExternalProviders, | ||
Providers: testAccProviders, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccDataSourceMetalDeviceBgpNeighborsConfig(projectName), | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttrSet( | ||
"data.equinix_metal_device_bgp_neighbors.test", "bgp_neighbors.#"), | ||
), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testAccDataSourceMetalDeviceBgpNeighborsConfig(projectName string) string { | ||
return fmt.Sprintf(` | ||
%s | ||
data "equinix_metal_device_bgp_neighbors" "test" { | ||
device_id = equinix_metal_device.test.id | ||
} | ||
output "bgp_neighbors_listing" { | ||
value = data.equinix_metal_device_bgp_neighbors.test.bgp_neighbors | ||
} | ||
`, testDataSourceMetalDeviceConfig_basic(projectName)) | ||
} |
Oops, something went wrong.