Skip to content

feat!: remove deprecated Network Edge attributes#1008

Open
displague wants to merge 1 commit intomainfrom
remove-deprecated-network-edge
Open

feat!: remove deprecated Network Edge attributes#1008
displague wants to merge 1 commit intomainfrom
remove-deprecated-network-edge

Conversation

@displague
Copy link
Copy Markdown
Member

@displague displague commented Apr 6, 2026

Remove deprecated attributes from equinix_network_acl_template and
equinix_network_device_link resources ahead of the next major release.

equinix_network_acl_template:

  • Remove metro_code attribute (was: Metro Code is no longer required)
  • Remove device_id computed attribute (replaced by device_details)
  • Remove inbound_rule.source_type computed attribute (was not returned)
  • Remove inbound_rule.subnets attribute (replaced by inbound_rule.subnet)
  • Simplify flattenACLTemplateInboundRules to drop the now-unused existingRules argument and checkExistingSubnets helper
  • Fix ImportStatePassthrough -> ImportStatePassthroughContext

equinix_network_device_link:

  • Remove link block (replaced by metro_link)
  • Remove link.src_zone_code attribute (was not required)
  • Remove link.dst_zone_code attribute (was not required)
  • Remove associated expand/flatten/hash functions and schema helpers

Update example_1.tf for equinix_network_device_link to use metro_link
Regenerate docs via make docs.

Co-authored-by: Copilot [email protected]

 Remove deprecated attributes from equinix_network_acl_template and
 equinix_network_device_link resources ahead of the next major release.

 equinix_network_acl_template:
 - Remove metro_code attribute (was: Metro Code is no longer required)
 - Remove device_id computed attribute (replaced by device_details)
 - Remove inbound_rule.source_type computed attribute (was not returned)
 - Remove inbound_rule.subnets attribute (replaced by inbound_rule.subnet)
 - Simplify flattenACLTemplateInboundRules to drop the now-unused
   existingRules argument and checkExistingSubnets helper
 - Fix ImportStatePassthrough -> ImportStatePassthroughContext

 equinix_network_device_link:
 - Remove link block (replaced by metro_link)
 - Remove link.src_zone_code attribute (was not required)
 - Remove link.dst_zone_code attribute (was not required)
 - Remove associated expand/flatten/hash functions and schema helpers

 Update example_1.tf for equinix_network_device_link to use metro_link.
 Regenerate docs via make docs.

 Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings April 6, 2026 15:56
@displague displague requested a review from a team as a code owner April 6, 2026 15:56
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 6, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 41.97%. Comparing base (31781d0) to head (fad5a94).

Files with missing lines Patch % Lines
equinix/resource_network_acl_template.go 40.00% 2 Missing and 1 partial ⚠️
equinix/resource_network_device_link.go 66.66% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1008       +/-   ##
===========================================
+ Coverage   28.72%   41.97%   +13.24%     
===========================================
  Files         252      252               
  Lines       29225    29079      -146     
===========================================
+ Hits         8394    12205     +3811     
+ Misses      20677    16378     -4299     
- Partials      154      496      +342     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes deprecated attributes/blocks from the legacy (SDKv2) Network Edge resources equinix_network_acl_template and equinix_network_device_link in preparation for the next major provider release, with corresponding updates to examples and generated docs.

Changes:

  • Dropped deprecated schema attributes from equinix_network_acl_template (e.g., metro_code, device_id, inbound rule deprecated fields) and simplified inbound rule flattening.
  • Dropped deprecated link block from equinix_network_device_link, leaving metro_link as the supported inter/intra-metro connection block.
  • Updated example + regenerated docs/templates to reflect the new schemas.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
templates/resources/network_device_link.md.tmpl Removes deprecated link docs section; keeps metro_link docs.
templates/resources/network_acl_template.md.tmpl Removes docs for deprecated ACL template attributes and inbound rule fields.
examples/resources/equinix_network_device_link/example_1.tf Updates example config to use metro_link instead of link.
equinix/resource_network_device_link.go Removes deprecated link schema + expand/flatten helpers; updates update/create/read paths.
equinix/resource_network_device_link_test.go Updates unit tests to stop asserting removed link behavior.
equinix/resource_network_acl_template.go Removes deprecated ACL template schema attributes; simplifies inbound rules flattening; fixes importer to ImportStatePassthroughContext.
equinix/resource_network_acl_template_test.go Updates unit tests to match removed fields and new flatten function signature.
docs/resources/network_device_link.md Regenerated docs reflecting metro_link usage and removal of link.
docs/resources/network_acl_template.md Regenerated docs reflecting removal of deprecated ACL template attributes.
Comments suppressed due to low confidence (3)

equinix/resource_network_device_link.go:162

  • metro_link is a TypeSet but the schema does not specify a Set hash function, while the read/flatten path tries to match existing items via networkDeviceLinkMetroLinkHash(...). Without setting Set: networkDeviceLinkMetroLinkHash, the hashes used by Terraform for the set won't match the custom hash used in flattenNetworkDeviceLinkMetroLinks, so account_number likely won't be carried forward and diffs will persist.
		networkDeviceLinkSchemaNames["MetroLinks"]: {
			Type:     schema.TypeSet,
			Optional: true,
			Elem: &schema.Resource{
				Schema: createNetworkDeviceLinkMetroResourceSchema(),
			},
			Description: networkDeviceLinkDescriptions["MetroLinks"],
		},

equinix/resource_network_device_link.go:527

  • networkDeviceLinkMetroLinkKey uses networkDeviceLinkConnectionSchemaNames[...] when v is a map[string]interface{}. That map does not contain a "MetroCode" key (it uses src/dst metro codes), so the computed key/hash will be wrong and break matching of existing metro_link items. Use networkDeviceLinkMetroSchemaNames["MetroCode"|"Throughput"|"ThroughputUnit"] for the map case.
func networkDeviceLinkMetroLinkKey(v interface{}) string {
	if v, ok := v.(ne.DeviceLinkGroupMetroLink); ok {
		return fmt.Sprintf("%s-%s-%s",
			ne.StringValue(v.MetroCode),
			ne.StringValue(v.Throughput),
			ne.StringValue(v.ThroughputUnit))
	}
	if v, ok := v.(map[string]interface{}); ok {
		return fmt.Sprintf("%s-%s-%s",
			v[networkDeviceLinkConnectionSchemaNames["MetroCode"]],
			v[networkDeviceLinkConnectionSchemaNames["Throughput"]],
			v[networkDeviceLinkConnectionSchemaNames["ThroughputUnit"]])
	}

equinix/resource_network_acl_template.go:140

  • inbound_rule.subnet is marked Optional: true in the schema, but the docs/templates in this PR describe it as required (and with subnets removed there's no longer an alternate source definition). Consider making subnet required to match the documented contract and avoid sending incomplete rules to the API.
		networkACLTemplateInboundRuleSchemaNames["Subnet"]: {
			Type:         schema.TypeString,
			Optional:     true,
			Description:  networkACLTemplateInboundRuleDescriptions["Subnet"],
			ValidateFunc: validation.IsCIDR,
		},

@@ -171,16 +152,6 @@
Set: networkDeviceLinkDeviceHash,
Description: networkDeviceLinkDescriptions["Device"],
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

device schema field pulls its Description from networkDeviceLinkDescriptions["Device"], but the map key is "Devices" (plural). As-is, the description will be empty and docs generation may omit/lose this field description. Use the existing "Devices" key (or rename the map key consistently).

Suggested change
Description: networkDeviceLinkDescriptions["Device"],
Description: networkDeviceLinkDescriptions["Devices"],

Copilot uses AI. Check for mistakes.
Comment on lines 77 to 82
var networkDeviceLinkMetroDescriptions = map[string]string{
"AccountNumber": "Billing account number to be used for connection charges",
"metroCode": "Connection source metro code",
"Throughput": "Connection throughput",
"ThroughputUnit": "Connection throughput unit",
}
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

networkDeviceLinkMetroDescriptions defines the metro code description under key "metroCode", but the schema looks up networkDeviceLinkMetroDescriptions["MetroCode"]. This mismatch makes the metro_code field description empty; align the map key with the lookup ("MetroCode").

Copilot uses AI. Check for mistakes.
if err := d.Set(networkDeviceLinkSchemaNames["Links"], flattenNetworkDeviceLinkConnections(d.Get(networkDeviceLinkSchemaNames["Devices"]).(*schema.Set), link.Links)); err != nil {
return fmt.Errorf("error setting Links: %s", err)
}
if err := d.Set(networkDeviceLinkSchemaNames["MetroLinks"], flattenNetworkDeviceLinkMetroLinks(d.Get(networkDeviceLinkSchemaNames["Devices"]).(*schema.Set), link.MetroLinks)); err != nil {
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updateNetworkDeviceLinkResource passes the device set into flattenNetworkDeviceLinkMetroLinks(...) as the currentConnections argument. This prevents matching existing metro_link entries (and therefore preserving account_number, which appears to be write-only/not returned), causing persistent diffs and potentially invalid state. Pass the current metro_link set instead (e.g., d.Get(networkDeviceLinkSchemaNames["MetroLinks"]).(*schema.Set)).

Suggested change
if err := d.Set(networkDeviceLinkSchemaNames["MetroLinks"], flattenNetworkDeviceLinkMetroLinks(d.Get(networkDeviceLinkSchemaNames["Devices"]).(*schema.Set), link.MetroLinks)); err != nil {
if err := d.Set(networkDeviceLinkSchemaNames["MetroLinks"], flattenNetworkDeviceLinkMetroLinks(d.Get(networkDeviceLinkSchemaNames["MetroLinks"]).(*schema.Set), link.MetroLinks)); err != nil {

Copilot uses AI. Check for mistakes.
@displague
Copy link
Copy Markdown
Member Author

Ideally this is merged in the same release as #1006

@displague
Copy link
Copy Markdown
Member Author

@rling-equinix these Copilot recommendations were unexpected but seem like they could address long standing bugs (if accurate). You are more familiar with the helpers in use so I defer to your judgement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants