Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: equinix_metal_vlan breaks when metro is upper case or description is not specified #633

Closed
dnoland1 opened this issue Apr 1, 2024 · 0 comments · Fixed by #642
Closed
Labels
bug Something isn't working

Comments

@dnoland1
Copy link

dnoland1 commented Apr 1, 2024

Terraform Version

Terraform 1.7.4 on darwin_arm64

Equinix Provider Version

1.34.0

Effected Terraform Resources

equinix_metal_vlan

Terraform Config Files

resource "equinix_metal_vlan" "vlans" {
  count      = 2
  project_id = local.project_id
  metro      = "TY"
}

Debug Output

╷
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to equinix_metal_vlan.vlans[1], provider "provider[\"registry.terraform.io/equinix/equinix\"]" produced an unexpected new value: .metro: was cty.StringVal("TY"), but now cty.StringVal("ty").
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

Panic Output

No response

Expected Behavior

No error

Actual Behavior

Received error

Steps to Reproduce

Specify metro in uppercase as it's defined in the documentation at
List of metros: https://deploy.equinix.com/developers/docs/metal/locations/metros/#metros-quick-reference

Works fine in provider 1.24.0. If a put metro in lower case, then I get the error:

╷
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to equinix_metal_vlan.vlans[0], provider "provider[\"registry.terraform.io/equinix/equinix\"]" produced an unexpected new value: .description: was null, but now cty.StringVal("").
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

Could workaround above bug by adding description = "" to the equinix_metal_vlan resource, but according to the docs at https://registry.terraform.io/providers/equinix/equinix/latest/docs/resources/equinix_metal_vlan#description , it's supposed to be an optional attribute.

@dnoland1 dnoland1 added the bug Something isn't working label Apr 1, 2024
@dnoland1 dnoland1 changed the title [Bug]: equinix_metal_vlan breaks when metro is upper case [Bug]: equinix_metal_vlan breaks when metro is upper case or description is not specified Apr 1, 2024
ctreatma added a commit that referenced this issue Apr 10, 2024
When the equinix_metal_vlan resource was migrated (#578) from
terraform-plugin-sdk/v2 (SDKv2) to terraform-plugin-framework
(framework), some unintended behavior was introduced around the
description and metro attributes.

For equinix_metal_vlan resources under SDKv2, description was an
optional attribute and metro was case insensitive, but after migration
from SDKv2 to framework, the description was set to `""` when the
attribute was omitted, and metro was required to be lower-case to avoid
terraform errors.

This updates the VLAN model parsing function so that:
- if there is already metro value configured in state and it is equal to
the value received from the API or from the config, ignoring case, then
the value that is already in state is used instead of the value from the
API
- if there is no description in the API response, the description
property is omitted entirely instead of being set to an empty string

`TestAccMetalVlan_NoDescription` has been added to validate the resource
behavior when the description is omitted and `TestAccMetalVlan_metro`
has been updated to validate behavior when metro is specified in
uppercase.

Fixes #633
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant