Add existing resource support to more Azure resources#7424
Merged
Conversation
Open
3 tasks
davidfowl
reviewed
Feb 6, 2025
| /// <param name="createExisting">A callback to create the existing resource.</param> | ||
| /// <param name="createNew">A callback to create the new resource.</param> | ||
| /// <returns>The provisioned resource.</returns> | ||
| public static T CreateExistingOrNewProvisionableResource<T>(this AzureResourceInfrastructure infrastructure, Func<string, ProvisioningParameter, T> createExisting, Func<AzureResourceInfrastructure, T> createNew) |
Contributor
There was a problem hiding this comment.
I'm struggle a bit with this being a public API but it's not the end of the world I guess...
Member
There was a problem hiding this comment.
What if we didn't make it an extension method? Then it wouldn't show up for normal developers, only for devs that were looking for it (which probably will only ever be us).
Contributor
Author
There was a problem hiding this comment.
I considered internal and IVT for this but that felt a little bi too much.
I do like the idea of not making it an extension method to hide it a bit better.
davidfowl
approved these changes
Feb 6, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This PR adds support for the existing Azure resource feature introduced in #7249 to more resources.
We introduce a
CreateExistingOrNewProvisionableResourceexisting method that encapsulates the logic for wiring up an existing or new resource definition based on the existence of the annotation.Note: SQL Server and Azure Redis will be done in a separate PR since they have some unique interactions with role assignments/access perms.