fix: add logic to skip subnet update under certain conditions #4084
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.
Which issue this PR addresses:
Fixes https://issues.redhat.com/browse/ARO-15009
What this PR does / why we need it:
This commit addresses the need for the subnet/write permissions. Currently, in all scenarios, the subnet/write permission is used via the subnet.CreateOrUpdate method. This change adds logic to determine if the values are already set to Disabled and skips running the subnet.CreateOrUpdate method if it is already set appropriately. This will save the need to make an extra API call and also allow users to configure things like Azure policy where subnet/write permissions are not needed.
Test plan for issue:
Currently awaiting access for the Dev ARO-RP shared environment. Once I get access I can run a full E2E test and comment with the results.
Is there any documentation that needs to be updated for this PR?
No documentation needs to be updated, as the end user experience looks identical.
How do you know this will function as expected in production?
No change to the existing logic is introduced. We are only introducing a skip of the API call to create or update a subnet if it does not currently match a desired stated of "Disabled".