Skip to content

Commit

Permalink
Merge pull request #220 from equinix/equinix_metal_reserved_ip_block-…
Browse files Browse the repository at this point in the history
…client

fix client type assertion in equinix_metal_reserved_ip_block
  • Loading branch information
ocobles authored Jul 7, 2022
2 parents cb4ba55 + 24f52e6 commit a7ecacd
Show file tree
Hide file tree
Showing 20 changed files with 242 additions and 146 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 1.6.1 (Jul 7, 2022)

BUG FIXES:

- Fix client type assertion in equinix_metal_reserved_ip_block [#220](https://github.com/equinix/terraform-provider-equinix/pull/220)

## 1.6.0 (Jul 6, 2022)

FEATURES:
Expand Down
6 changes: 2 additions & 4 deletions cmd/migration-tool/version.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
package main

var (
// Version is set at build-time in the release process
Version = "dev"
)
// Version is set at build-time in the release process
var Version = "dev"
8 changes: 4 additions & 4 deletions equinix/data_source_metal_device_acc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ resource "equinix_metal_device" "test" {
hostname = "tfacc-test-device"
plan = local.plan
metro = local.metro
operating_system = "ubuntu_16_04"
operating_system = local.os
billing_cycle = "hourly"
project_id = "${equinix_metal_project.test.id}"
termination_time = "%s"
Expand All @@ -65,7 +65,7 @@ resource "equinix_metal_device" "test" {
data "equinix_metal_device" "test" {
project_id = equinix_metal_project.test.id
hostname = equinix_metal_device.test.hostname
}`, confAccMetalDevice_base(preferable_plans, preferable_metros), projSuffix, testDeviceTerminationTime())
}`, confAccMetalDevice_base(preferable_plans, preferable_metros, preferable_os), projSuffix, testDeviceTerminationTime())
}

func TestAccDataSourceMetalDevice_byID(t *testing.T) {
Expand Down Expand Up @@ -109,7 +109,7 @@ resource "equinix_metal_device" "test" {
hostname = "tfacc-test-device"
plan = local.plan
metro = local.metro
operating_system = "ubuntu_16_04"
operating_system = local.os
billing_cycle = "hourly"
project_id = "${equinix_metal_project.test.id}"
termination_time = "%s"
Expand All @@ -124,5 +124,5 @@ resource "equinix_metal_device" "test" {
data "equinix_metal_device" "test" {
device_id = equinix_metal_device.test.id
}`, confAccMetalDevice_base(preferable_plans, preferable_metros), projSuffix, testDeviceTerminationTime())
}`, confAccMetalDevice_base(preferable_plans, preferable_metros, preferable_os), projSuffix, testDeviceTerminationTime())
}
6 changes: 3 additions & 3 deletions equinix/data_source_metal_ip_block_ranges_acc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ resource "equinix_metal_device" "test" {
hostname = "tfacc-device-ip-test"
plan = local.plan
facilities = local.facilities
operating_system = "ubuntu_16_04"
operating_system = local.os
billing_cycle = "hourly"
project_id = equinix_metal_project.test.id
termination_time = "%s"
lifecycle {
ignore_changes = [
plan,
metro,
facilities,
]
}
}
Expand All @@ -68,5 +68,5 @@ resource "equinix_metal_ip_attachment" "test" {
device_id = equinix_metal_device.test.id
cidr_notation = cidrsubnet(data.equinix_metal_ip_block_ranges.test.ipv6.0, 8, 2)
}
`, confAccMetalDevice_base(preferable_plans, preferable_metros), name, testDeviceTerminationTime())
`, confAccMetalDevice_base(preferable_plans, preferable_metros, preferable_os), name, testDeviceTerminationTime())
}
8 changes: 4 additions & 4 deletions equinix/data_source_metal_port_acc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ resource "equinix_metal_device" "test" {
hostname = "tfacc-test-device-port"
plan = local.plan
metro = local.metro
operating_system = "ubuntu_20_04"
operating_system = local.os
billing_cycle = "hourly"
project_id = equinix_metal_project.test.id
termination_time = "%s"
Expand All @@ -56,7 +56,7 @@ data "equinix_metal_port" "test" {
name = "eth0"
}
`, confAccMetalDevice_base(preferable_plans, preferable_metros), name, testDeviceTerminationTime())
`, confAccMetalDevice_base(preferable_plans, preferable_metros, preferable_os), name, testDeviceTerminationTime())
}

func TestAccDataSourceMetalPort_byId(t *testing.T) {
Expand Down Expand Up @@ -89,7 +89,7 @@ resource "equinix_metal_device" "test" {
hostname = "tfacc-test-device-port"
plan = local.plan
metro = local.metro
operating_system = "ubuntu_20_04"
operating_system = local.os
billing_cycle = "hourly"
project_id = equinix_metal_project.test.id
termination_time = "%s"
Expand All @@ -105,5 +105,5 @@ resource "equinix_metal_device" "test" {
data "equinix_metal_port" "test" {
port_id = equinix_metal_device.test.ports[0].id
}
`, confAccMetalDevice_base(preferable_plans, preferable_metros), name, testDeviceTerminationTime())
`, confAccMetalDevice_base(preferable_plans, preferable_metros, preferable_os), name, testDeviceTerminationTime())
}
4 changes: 2 additions & 2 deletions equinix/data_source_metal_precreated_ip_block_acc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ resource "equinix_metal_device" "test" {
hostname = "tfacc-test-device-ip-blockt"
plan = local.plan
metro = local.metro
operating_system = "ubuntu_16_04"
operating_system = local.os
billing_cycle = "hourly"
project_id = equinix_metal_project.test.id
termination_time = "%s"
Expand All @@ -70,5 +70,5 @@ resource "equinix_metal_ip_attachment" "test" {
device_id = equinix_metal_device.test.id
cidr_notation = cidrsubnet(data.equinix_metal_precreated_ip_block.test.cidr_notation,8,2)
}
`, confAccMetalDevice_base(preferable_plans, preferable_metros), name, testDeviceTerminationTime())
`, confAccMetalDevice_base(preferable_plans, preferable_metros, preferable_os), name, testDeviceTerminationTime())
}
34 changes: 25 additions & 9 deletions equinix/data_source_metal_spot_market_request_acc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func TestAccDataSourceMetalSpotMarketRequest_basic(t *testing.T) {

func testAccDataSourceMetalSpotMarketRequestConfig_basic(projSuffix string) string {
return fmt.Sprintf(`
%s
resource "equinix_metal_project" "test" {
name = "tfacc-spot_market_request-%s"
Expand All @@ -58,50 +59,65 @@ resource "equinix_metal_project" "test" {
resource "equinix_metal_spot_market_request" "req" {
project_id = "${equinix_metal_project.test.id}"
max_bid_price = 0.01
facilities = ["da11"]
facilities = local.facilities
devices_min = 1
devices_max = 1
wait_for_devices = false
instance_parameters {
hostname = "tfacc-testspot"
billing_cycle = "hourly"
operating_system = "ubuntu_20_04"
plan = "c3.medium.x86"
operating_system = local.os
plan = local.plan
}
lifecycle {
ignore_changes = [
instance_parameters,
facilities,
]
}
}
data "equinix_metal_spot_market_request" "dreq" {
request_id = equinix_metal_spot_market_request.req.id
}
`, projSuffix)
`, confAccMetalDevice_base(preferable_plans, preferable_metros, preferable_os), projSuffix)
}

func testAccDataSourceMetalSpotMarketRequestConfig_metro(projSuffix string) string {
return fmt.Sprintf(`
%s
resource "equinix_metal_project" "test" {
name = "tfacc-spot_market_request-%s"
}
resource "equinix_metal_spot_market_request" "req" {
project_id = "${equinix_metal_project.test.id}"
project_id = equinix_metal_project.test.id
max_bid_price = 0.01
metro = "da"
metro = local.metro
devices_min = 1
devices_max = 1
wait_for_devices = false
instance_parameters {
hostname = "tfacc-testspot"
billing_cycle = "hourly"
operating_system = "ubuntu_20_04"
plan = "c3.medium.x86"
operating_system = local.os
plan = local.plan
}
lifecycle {
ignore_changes = [
instance_parameters,
metro,
]
}
}
data "equinix_metal_spot_market_request" "dreq" {
request_id = equinix_metal_spot_market_request.req.id
}
`, projSuffix)
`, confAccMetalDevice_base(preferable_plans, preferable_metros, preferable_os), projSuffix)
}
3 changes: 3 additions & 0 deletions equinix/data_source_network_device.go
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,9 @@ func dataSourceNetworkDeviceRead(ctx context.Context, d *schema.ResourceData, m
uuid := uuidIf.(string)

validDeviceStatusList, err := getNeDeviceStatusList(d.Get(neDeviceSchemaNames["ValidStatusList"]).(string))
if err != nil {
return diag.Errorf("cannot get network device status list due to '%v'", err)
}

if nameExists {
primary, err = getDeviceByName(name, conf, validDeviceStatusList)
Expand Down
4 changes: 2 additions & 2 deletions equinix/resource_metal_bgp_setup_acc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ resource "equinix_metal_device" "test" {
hostname = "tfacc-test-bgp-sesh"
plan = local.plan
facilities = local.facilities
operating_system = "ubuntu_16_04"
operating_system = local.os
billing_cycle = "hourly"
project_id = "${equinix_metal_project.test.id}"
termination_time = "%s"
Expand Down Expand Up @@ -110,5 +110,5 @@ resource "equinix_metal_bgp_session" "test6" {
data "equinix_metal_device_bgp_neighbors" "test" {
device_id = equinix_metal_bgp_session.test4.device_id
}
`, confAccMetalDevice_base(preferable_plans, preferable_metros), name, testDeviceTerminationTime())
`, confAccMetalDevice_base(preferable_plans, preferable_metros, preferable_os), name, testDeviceTerminationTime())
}
Loading

0 comments on commit a7ecacd

Please sign in to comment.