-
Notifications
You must be signed in to change notification settings - Fork 682
Require resource group on existing azure resources #7733
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
Conversation
Since, by default, publishing a .NET Asipre app will create a new resource group, not specifying a resource group won't work - since the current resource group hasn't been created yet. Because of this, require callers to explicitly specify the resource group to use. They can still say `null` to mean "use the current" if that's really what they want.
@@ -74,7 +74,7 @@ public static IResourceBuilder<T> RunAsExisting<T>(this IResourceBuilder<T> buil | |||
/// <param name="nameParameter">The name of the existing resource.</param> | |||
/// <param name="resourceGroupParameter">The name of the existing resource group, or <see langword="null"/> to use the current resource group.</param> | |||
/// <returns>The resource builder with the existing resource annotation added.</returns> | |||
public static IResourceBuilder<T> PublishAsExisting<T>(this IResourceBuilder<T> builder, IResourceBuilder<ParameterResource> nameParameter, IResourceBuilder<ParameterResource>? resourceGroupParameter = null) | |||
public static IResourceBuilder<T> PublishAsExisting<T>(this IResourceBuilder<T> builder, IResourceBuilder<ParameterResource> nameParameter, IResourceBuilder<ParameterResource>? resourceGroupParameter) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to make the same change for the RunAsExisting
methods? If someone specifies a Azure:ResourceGroup
in their user secrets (and not a Prefix), the resource group can be existing. So it is more likely to work if you don't specify a resource group.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given @mitchdenny's comment #7733 (comment), I think we should make the same change to RunAsExisting. It gives us room to take a single string to mean the whole resourceID in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed
/backport to release/9.1 |
Started backporting to release/9.1: https://github.com/dotnet/aspire/actions/runs/13465391305 |
We can probably let this go in as is but have we considered using a fully qualified resource ID as well? Given that scenario how would we disambiguate the APIs (since both would just be parameters). |
In case it wasn't obvious the reason for my question was around using existing resources that might be in a different sub which is actually pretty common. |
I believe we talked about that orginally, but went with "resourceName" and "resourceGroup" separately.
This change actually makes it easier becuase in the future we can add an overload that takes a single string which is the full resource ID. If we are going to do that, we should also make this same change to the |
/backport to release/9.1 |
Started backporting to release/9.1: https://github.com/dotnet/aspire/actions/runs/13465537766 |
Very good point. |
Since, by default, publishing a .NET Asipre app will create a new resource group, not specifying a resource group won't work - since the current resource group hasn't been created yet. Because of this, require callers to explicitly specify the resource group to use. They can still say
null
to mean "use the current" if that's really what they want.Checklist
doc-idea
template):