Skip to content

ENG-36170: Read and send the IX fields that import and Update drop - #533

Open
Phil-Browne wants to merge 11 commits into
mainfrom
feature/ENG-36170-ix-read-and-send-fields
Open

Phil-Browne wants to merge 11 commits into
mainfrom
feature/ENG-36170-ix-read-and-send-fields

Conversation

@Phil-Browne

@Phil-Browne Phil-Browne commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

User-Facing Summary

This PR maps and sends the megaport_ix fields that import and Update dropped.

Prior to this PR, every apply after an IX import would fail with "Provider produced inconsistent result after apply".

Changes

  • Map mac_address, shutdown, cost_centre, and reverse_dns in the read call
  • Fill requested_product_uid from the plan when state has none
  • Send cost_centre, public_graph, and reverse_dns in Update
  • Send them from Create in a follow-up update
    • The megaportgo IX order has no field for them.
  • Plan reverse_dns as unknown when the ASN changes

Type of Change

  • 🚀 New Feature
  • ✨ Enhancement
  • 🐛 Bug Fix
  • 📚 Documentation Update
  • 🏗️ Chore / Other

Related Issues

ENG-36170, ENG-36183

How to Test

On staging I ran the IX acceptance tests, which now cover an apply after import and a provider upgrade.

Known limitation: clearing cost_centre or reverse_dns now fails at plan.

Scope of change: customer-facing yes, existing automated coverage yes.

The read call now maps the MAC address, shutdown, cost centre, and reverse DNS. Update sends cost centre, public graph, and reverse DNS, and fills requested_product_uid from the plan when an import left it null. The IX order cannot carry those three settings, so Create sets them with an update after the order.
The basic test now sets and changes the three settings and the MAC, verifies shutdown and mac_address on import, and applies after a real import. The upgrade test plans a config created by the latest release with this build.
The API lowercases the MAC and adds a trailing dot to reverse DNS. The read call now keeps the value in state when only that form differs, and Update sends neither value for a form-only change.
The SDK drops an empty cost_centre or reverse_dns from the update, so Update now returns a clear error instead of an inconsistent result. Update also skips an unknown shutdown, and reverse DNS compares without case.
…an accurate

The cost_centre clear check moves to ModifyPlan, which also marks the default reverse DNS unknown when the ASN changes. The schema rejects an empty reverse_dns, and the settings no longer copy a null state value into the plan.
…N change

The API rebuilds the reverse DNS on an ASN change only when it holds the Megaport default. ModifyPlan now follows that rule, and it rejects a config that pins the default across the change. The upgrade acceptance test changes the ASN to show the rebuild on staging.
Terraform plans again at apply with the known ASN, so the error still fires on a real change. The error title now fits a config that sets the new default name too.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The change permits an oversized cost_centre to fail only after purchasing a billable IX, and lacks failure-injection tests verifying UID retention and recovery after post-purchase update or GetIX failures.

2 open issues
What changed in this PR

This PR fixes dropped fields in megaport_ix so imported resources and later applies retain their settings consistently.

Changes:

  • Hydrates missing IX fields and preserves equivalent MAC address and reverse-DNS formatting.
  • Sends settings during Update and through a follow-up Create update, with planning rules for unsupported clearing and ASN changes.
  • Adds unit and acceptance coverage for settings, apply after import, and provider upgrades.
File Description
internal/​provider/​testdata/​acceptance-suites.json Registers the IX upgrade acceptance test.
internal/​provider/​ixs_data_source_test.go Extends the shared IX mock to support creation and settings updates.
internal/​provider/​ix_resource.go Fixes field mapping, settings updates, import state, and planning behavior.
internal/​provider/​ix_resource_test.go Expands acceptance coverage for settings, imports, and upgrades.
internal/​provider/​ix_resource_fields_test.go Adds unit coverage for mapping, normalization, planning, and settings requests.
docs/​resources/​ix.md Documents default reverse-DNS behavior.

Review effort: Balanced

Comment thread internal/provider/ix_resource.go Resolved
Comment thread internal/provider/ix_resource.go Resolved
…llow-up update

The SDK refuses a longer cost_centre in UpdateIX, so Create would order the IX and then fail on the follow-up update.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

There are no active review issues for the IX field-handling changes.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

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