Only add singleton list API converters for the existing APIs #767
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of your changes
Only apply the CRD API conversions for converting between singleton list & embedded object APIs for the already existing resources with the generated singleton list CRD APIs.
When we try to add a new Terraform resource with a singleton list in its schema, currently, we need to do a manual configuration such as the following:
, so that the API converters registered are removed and versioning starts with
v1beta1
instead ofv1beta2
(for such new resources, thev1beta1
version does not already exist).This PR records the names of resources with previous CRD APIs containing (now converted) singleton lists so that the API converters are only registered for them.
This makes adding new resources with singleton lists in their Terraform schemas easier by removing the need to do a manual configuration like shown above.
The newly introduced list should mostly be immutable (it records a set of existing resources with a specific condition at a point in time). Bugs may result in exceptions where we may need to update this list. In other words, new resources should normally be never added to this list, doing so will result in an invalid configuration.
This PR also removes the relevant manual configuration done for the
azurerm_pim_eligible_role_assignment
&azurerm_pim_active_role_assignment
Terraform resources.I have:
make reviewable
to ensure this PR is ready for review.backport release-x.y
labels to auto-backport this PR if necessary.How has this code been tested
Via an uptest run for the
Subnet.v1beta2.network
resource here. Also observed no configuration changes* for thePimActiveRoleAssignment.authorization
&PimEligibleRoleAssignment.authorization
resources.*: The only configuration change is an identity API conversion being registered between all the API versions of these two resources (previously the manual conversion had deleted all API conversions including the identity conversion). However, these two resources each have single CRD API versions (
v1beta1
) so the API conversion configuration is effectively a noop, and the identity conversion is by default set for all resources.