CommunityToolkit / CommunityToolkit/Aspire

Allow specifying a custom sidecar resource name via DaprSidecarOptions.SidecarName

Open
#1,264 0 comments 1 reaction 2 assignees Claimed by @FullStackChef View on GitHub
Dominant language
C#
Stars
627
Forks
196
Avg merge
2d 11h
Merged PRs (30d)
35

Description

### Related to an existing integration?

Yes

### Existing integration

Dapr

### Overview

Currently, the sidecar resource name is always `{resourceName}-dapr` and the CLI resource name is `{resourceName}-cli`. These names are derived from the parent resource, not from the Dapr app-id, so in the Aspire dashboard you see names that don't match your actual Dapr configuration (e.g., `frontend-dapr-cli` instead of something meaningful).

Adding a `SidecarName` property to `DaprSidecarOptions` would let developers align the Aspire resource name with their Dapr app-id, or set any custom name. When null or whitespace, the current default `{resourceName}-dapr` is preserved.

### Usage example

```csharp
// Via DaprSidecarOptions
builder.AddProject("my-service")
.WithDaprSidecar(new DaprSidecarOptions
{
SidecarName = "my-custom-sidecar",
AppId = "my-service"
});

// Via new callback overload with explicit name
builder.AddProject("my-service")
.WithDaprSidecar("my-custom-sidecar", sidecar =>
{
sidecar.WithOptions(new() { AppId = "my-service"; SidecarName = "my-custom-sidecar", });
});
```

### Breaking change?

Yes

### Alternatives

There is currently no clean workaround. The only option is to access the sidecar resource after creation and manipulate it, but the resource name is set at construction time in `AddResource()` and cannot be changed afterward.

### Additional context

_No response_

### Help us help you

Yes, I'd like to be assigned to work on this item

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.