diff --git a/equinix/resource_network_device_link.go b/equinix/resource_network_device_link.go index 64639086f..7f03fc586 100644 --- a/equinix/resource_network_device_link.go +++ b/equinix/resource_network_device_link.go @@ -3,6 +3,7 @@ package equinix import ( "context" "fmt" + "strings" "time" "github.com/equinix/terraform-provider-equinix/internal/config" @@ -106,7 +107,7 @@ func resourceNetworkDeviceLink() *schema.Resource { UpdateContext: resourceNetworkDeviceLinkUpdate, DeleteContext: resourceNetworkDeviceLinkDelete, Importer: &schema.ResourceImporter{ - State: schema.ImportStatePassthrough, + StateContext: schema.ImportStatePassthroughContext, }, Schema: createNetworkDeviceLinkResourceSchema(), Timeouts: &schema.ResourceTimeout{ @@ -154,8 +155,11 @@ func createNetworkDeviceLinkResourceSchema() map[string]*schema.Schema { Optional: true, ForceNew: true, Default: "PRIMARY", - ValidateFunc: validation.StringInSlice([]string{"PRIMARY", "SECONDARY", "HYBRID"}, false), - Description: networkDeviceLinkDescriptions["RedundancyType"], + ValidateFunc: validation.StringInSlice([]string{"PRIMARY", "SECONDARY", "HYBRID"}, true), + DiffSuppressFunc: func(_, old, new string, _ *schema.ResourceData) bool { + return old == strings.ToUpper(new) + }, + Description: networkDeviceLinkDescriptions["RedundancyType"], }, networkDeviceLinkSchemaNames["Devices"]: { Type: schema.TypeSet, @@ -322,7 +326,7 @@ func resourceNetworkDeviceLinkCreate(ctx context.Context, d *schema.ResourceData return diags } -func resourceNetworkDeviceLinkRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { +func resourceNetworkDeviceLinkRead(_ context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { client := m.(*config.Config).Ne m.(*config.Config).AddModuleToNEUserAgent(&client, d) var diags diag.Diagnostics @@ -481,7 +485,7 @@ func expandNetworkDeviceLinkDevices(devices *schema.Set) []ne.DeviceLinkGroupDev return transformed } -func flattenNetworkDeviceLinkDevices(currentDevices *schema.Set, devices []ne.DeviceLinkGroupDevice) interface{} { +func flattenNetworkDeviceLinkDevices(_ *schema.Set, devices []ne.DeviceLinkGroupDevice) interface{} { transformed := make([]interface{}, 0, len(devices)) for i := range devices { transformedDevice := map[string]interface{}{