Skip to content

Add existing resource support to more Azure resources#7424

Merged
davidfowl merged 1 commit intomainfrom
safia/more-existing-resources
Feb 6, 2025
Merged

Add existing resource support to more Azure resources#7424
davidfowl merged 1 commit intomainfrom
safia/more-existing-resources

Conversation

@captainsafia
Copy link
Copy Markdown
Contributor

This PR adds support for the existing Azure resource feature introduced in #7249 to more resources.

We introduce a CreateExistingOrNewProvisionableResource existing 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.

/// <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)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm struggle a bit with this being a public API but it's not the end of the world I guess...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 davidfowl merged commit bee8e74 into main Feb 6, 2025
@davidfowl davidfowl deleted the safia/more-existing-resources branch February 6, 2025 05:45
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 9, 2025
@github-actions github-actions Bot added the area-integrations Issues pertaining to Aspire Integrations packages label Mar 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-integrations Issues pertaining to Aspire Integrations packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants