Skip to content

Commit

Permalink
feat: officially deprecate the metal_device_network_type resource (#773)
Browse files Browse the repository at this point in the history
  • Loading branch information
ctreatma authored Sep 13, 2024
1 parent 692594c commit f303197
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
5 changes: 4 additions & 1 deletion docs/resources/metal_device_network_type.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
8 changes: 5 additions & 3 deletions equinix/resource_metal_device_network_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
5 changes: 4 additions & 1 deletion templates/resources/metal_device_network_type.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit f303197

Please sign in to comment.