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

Support virtual network resource without bindings; Improve config version constraints #919

Merged

Conversation

chrismarget-j
Copy link
Collaborator

@chrismarget-j chrismarget-j commented Oct 12, 2024

This PR started life as the simple (HA!) task of dropping the requirement for VN bindings with Apstra 5.0.0.

Then things got hairy.

The full scope of the damage:

  • A null binding set is only valid with Apstra 5.x. The existing config validation scheme relies on Constraints from the github.com/hashicorp/go-version package... Which don't work with Apstra's non-semver versioning strategy. The config validation scheme has been migrated from the apiversions package to the compatibility package, and now uses Constraints from the githubub.com/chrismarget-j/version-constraints package.
  • Migrating existing uses of the config validation scheme revealed many constraints which are obsolete since we dropped Apstra 4.1.x support. Those constraints have been deleted.
  • The bindings attribute has been changed from Required to Optional. A SizeAtLeast(1) validator remains, so it's not permitted to specify an empty binding set.
  • Bindings created other ways will be picked up during Read(). We prevent state churn by wiping out those bindings when none are present in the state. This required exporting the VnBinding.AttrTypes() method.
  • The test for apstra_datacenter_virtual_network has been rewritten to current style.

Tests are passing with 4.2.0, 4.2.1, 4.2.1.1, 4.2.2, 5.0.0

Closes #912
Closes #920

- migrate config constraints from `apiversions` to `compatibility`
- convert constraint objects from hashicorp's to chrismarget-j's
- eliminate obsolete version constraints (4.1.x-specific and >= 4.2.0 stuff)
- add 5.x version constraint for VN with no bindings
@chrismarget-j chrismarget-j linked an issue Oct 12, 2024 that may be closed by this pull request
@chrismarget-j chrismarget-j marked this pull request as draft October 12, 2024 03:18
@chrismarget-j chrismarget-j changed the title WIP: Update config validation against API version Support virtual network resource without bindings; Improve config version constraints Oct 14, 2024
@chrismarget-j chrismarget-j marked this pull request as ready for review October 14, 2024 21:22
@chrismarget-j chrismarget-j merged commit ffca275 into main Oct 16, 2024
1 check passed
@chrismarget-j chrismarget-j deleted the 912-allow-vn-creation-with-no-bindings-when-apstra-5x branch October 16, 2024 23:43
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.

resource virtual network validation Allow VN creation with no bindings when Apstra 5.x
2 participants