Skip to content

Seed number_of_retries and retry_interval when importing aviatrix_edge_spoke_external_device_conn - #2484

Open
eastagiletracker wants to merge 1 commit into
AviatrixSystems:masterfrom
eastagiletracker:agile-board/edge-spoke-external-device-conn-import-retry-defaults
Open

eastagiletracker wants to merge 1 commit into
AviatrixSystems:masterfrom
eastagiletracker:agile-board/edge-spoke-external-device-conn-import-retry-defaults

Conversation

@eastagiletracker

Copy link
Copy Markdown

This PR proposes seeding number_of_retries and retry_interval when importing an aviatrix_edge_spoke_external_device_conn, so an imported connection stops reporting a change that no apply can settle (Fixes #2482). We include this PR work along with a full history of your repo at https://eastagiletracker.com/projects/293. You can sign in with your GitHub ID to claim ownership of the project.

What was wrong

number_of_retries and retry_interval are provider-side knobs: they only drive the create retry loop in resourceAviatrixEdgeSpokeExternalDeviceConnCreate and resourceAviatrixEdgeSpokeExternalDeviceConnEnableHa, and the Controller never stores them. The resource imported through schema.ImportStatePassthroughContext, and the Read function has nothing to read them back from, so both attributes stayed absent from the imported state while the configuration kept resolving them to their schema defaults. Every plan after the import then reported + number_of_retries = 0 and + retry_interval = 300 regardless of what the configuration said, leaving lifecycle { ignore_changes = [...] } as the only workaround.

The change

Importer.StateContext now points at resourceAviatrixEdgeSpokeExternalDeviceConnImport, which seeds both attributes with their schema defaults and then delegates to schema.ImportStatePassthroughContext (so the "missing import ID" check is unchanged). The two defaults moved into shared constants that the schema and the importer both use, so they cannot drift apart. Nothing on the create, read, update or delete paths is touched: the seeding runs only during an import, where the state starts empty, so a connection that is already in state keeps whatever value it was applied with. A configuration that sets an explicit non-default value still wins on the first plan after the import, and settles from there.

I also added a row to the 10.1.0 Bug Fixes table in docs/guides/release-note.md, per the release-notes item in the contribution checklist — happy to restate it against an internal AVX id if you prefer.

Reproducing and verifying

Both new tests exercise the real Importer.StateContext of the registered resource, with no Controller involved. The first asserts the imported state carries the two attributes; the second plans that imported state against a configuration that omits them and asserts nothing changes — that is the reported symptom, at plan level.

On master at 1165aa5f the second test reports exactly the diff from the issue:

$ go test ./aviatrix/ -run TestEdgeSpokeExternalDeviceConnImport -v
--- FAIL: TestEdgeSpokeExternalDeviceConnImport_SeedsRetryDefaults
    Error:    Not equal: expected: "0"  actual  : ""
    Messages: number_of_retries should be seeded on import
--- FAIL: TestEdgeSpokeExternalDeviceConnImport_NoPerpetualRetryDiff
    Error:    Not equal: expected: ""   actual  : "300"
    Messages: plan should not change retry_interval after import
FAIL

With the change applied both pass, and the full suite is unchanged against the pre-change baseline — go test ./... was green before (ok aviatrix, ok goaviatrix) and is green after, with no new failures. go vet ./aviatrix/ is clean and gofumpt -l flags none of the touched files. The acceptance test needs a live Controller, so I could not run it here; the fix is what makes the imported state match the applied state for these two attributes, which is what the existing ImportState/ImportStateVerify step in TestAccAviatrixEdgeSpokeExternalDeviceConn_basic compares.

How this was managed

We tracked this work on a story on a live board built from this repository's own issues and pull requests — 2477 stories and 18 labels imported: the story for this fix is https://eastagiletracker.com/projects/293/stories/184161 and the board it lives on is https://eastagiletracker.com/projects/293.

board

If you'd rather not receive contributions like this, reply no-more-prs on this pull request and we won't open any further ones on your repositories.


Lawrence W. Sinclair
CEO / East Agile
linkedin.com/in/lwsinclair/
eastagile.com

…e_conn

number_of_retries and retry_interval drive the provider-side create retry
loop and are not stored by the Controller, so importing a connection left
them out of the state while the configuration kept applying the schema
defaults. Every plan after the import then reported

  + number_of_retries = 0
  + retry_interval    = 300

which no apply could settle. The importer now seeds both attributes with
their schema defaults, and the defaults are shared constants so the two
cannot drift apart.
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.

aviatrix_edge_spoke_external_device_conn — perpetual diff on number_of_retries and retry_interval after import

1 participant