From f303197fdec11f69584257a46900534adae2ce4c Mon Sep 17 00:00:00 2001 From: Charles Treatman Date: Fri, 13 Sep 2024 14:14:30 -0500 Subject: [PATCH] feat: officially deprecate the metal_device_network_type resource (#773) --- docs/resources/metal_device_network_type.md | 5 ++++- equinix/resource_metal_device_network_type.go | 8 +++++--- templates/resources/metal_device_network_type.md.tmpl | 5 ++++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/docs/resources/metal_device_network_type.md b/docs/resources/metal_device_network_type.md index 340c3d2db..85d3ada8d 100644 --- a/docs/resources/metal_device_network_type.md +++ b/docs/resources/metal_device_network_type.md @@ -2,7 +2,10 @@ subcategory: "Metal" --- -# equinix_metal_device_network_type (Resource) +# equinix_metal_device_network_type (Resource, Deprecated) + +**NOTE:** The metal_device_network_type resource is deprecated and will be removed in v3 of this provider. Please use metal_port instead. See the [Metal Device Network Types guide](https://registry.terraform.io/providers/equinix/equinix/latest/docs/guides/network_types) for more info. + This resource controls network type of Equinix Metal devices. diff --git a/equinix/resource_metal_device_network_type.go b/equinix/resource_metal_device_network_type.go index ebfae36e6..6282824b2 100644 --- a/equinix/resource_metal_device_network_type.go +++ b/equinix/resource_metal_device_network_type.go @@ -20,9 +20,10 @@ func resourceMetalDeviceNetworkType() *schema.Resource { Delete: resourceMetalDeviceNetworkTypeDelete, Update: resourceMetalDeviceNetworkTypeUpdate, Importer: &schema.ResourceImporter{ + //nolint State: schema.ImportStatePassthrough, }, - + DeprecationMessage: "The metal_device_network_type resource is deprecated and will be removed in v3 of this provider. Please use metal_port instead. See the [Metal Device Network Types guide](https://registry.terraform.io/providers/equinix/equinix/latest/docs/guides/network_types) for more info", Schema: map[string]*schema.Schema{ "device_id": { Type: schema.TypeString, @@ -67,6 +68,7 @@ func getAndPossiblySetNetworkType(d *schema.ResourceData, c *packngo.Client, tar } if devType != targetType { + //nolint _, err := c.DevicePorts.DeviceToNetworkType(devID, targetType) if err != nil { return err @@ -112,9 +114,9 @@ func resourceMetalDeviceNetworkTypeRead(d *schema.ResourceData, meta interface{} devNType = "hybrid-bonded" } - d.Set("type", devNType) + err = d.Set("type", devNType) - return nil + return err } func resourceMetalDeviceNetworkTypeUpdate(d *schema.ResourceData, meta interface{}) error { diff --git a/templates/resources/metal_device_network_type.md.tmpl b/templates/resources/metal_device_network_type.md.tmpl index 1f6056aad..c33649bb9 100644 --- a/templates/resources/metal_device_network_type.md.tmpl +++ b/templates/resources/metal_device_network_type.md.tmpl @@ -6,7 +6,10 @@ subcategory: "Metal" For example, the {{ .SchemaMarkdown }} template can be used to replace manual schema documentation if descriptions of schema attributes are added in the provider source code. */ -}} -# equinix_metal_device_network_type (Resource) +# equinix_metal_device_network_type (Resource, Deprecated) + +**NOTE:** The metal_device_network_type resource is deprecated and will be removed in v3 of this provider. Please use metal_port instead. See the [Metal Device Network Types guide](https://registry.terraform.io/providers/equinix/equinix/latest/docs/guides/network_types) for more info. + This resource controls network type of Equinix Metal devices.