Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ public static IResourceBuilder<AzureContainerAppEnvironmentResource> AddAzureCon
_ => throw new NotSupportedException()
};

// Remove '.' and '-' characters from volumeName
volumeName = volumeName.Replace(".", "").Replace("-", "");

share.Name = BicepFunction.Take(
BicepFunction.Interpolate(
$"{BicepFunction.ToLower(output.resource.Name)}-{BicepFunction.ToLower(volumeName)}"),
Expand Down Expand Up @@ -253,11 +256,10 @@ public static IResourceBuilder<AzureContainerAppEnvironmentResource> AddAzureCon
identity.Name = BicepFunction.Interpolate($"mi-{resourceToken}");
containerRegistry.Name = new FunctionCallExpression(
new IdentifierExpression("replace"),
new InterpolatedStringExpression(
[
new StringLiteralExpression("acr-"),
new InterpolatedStringExpression([
new StringLiteralExpression("acr-"),
new IdentifierExpression(resourceToken.BicepIdentifier)
]),
]),
new StringLiteralExpression("-"),
new StringLiteralExpression(""));
laWorkspace.Name = BicepFunction.Interpolate($"law-{resourceToken}");
Expand Down
6 changes: 3 additions & 3 deletions tests/Aspire.Hosting.Azure.Tests/AzureContainerAppsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3231,7 +3231,7 @@ public async Task AddContainerAppEnvironmentAddsEnvironmentResource(bool useAzdN
.AddDatabase("db");

builder.AddContainer("cache", "redis")
.WithVolume("data", "/data")
.WithVolume("App.da-ta", "/data")
.WithReference(pg);

using var app = builder.Build();
Expand Down Expand Up @@ -3366,7 +3366,7 @@ param userPrincipalId string
}

resource shares_volumes_cache_0 'Microsoft.Storage/storageAccounts/fileServices/shares@2024-01-01' = {
name: take('${toLower('cache')}-${toLower('data')}', 60)
name: take('${toLower('cache')}-${toLower('Appdata')}', 60)
properties: {
enabledProtocols: 'SMB'
shareQuota: 1024
Expand All @@ -3375,7 +3375,7 @@ param userPrincipalId string
}

resource managedStorage_volumes_cache_0 'Microsoft.App/managedEnvironments/storages@2024-03-01' = {
name: take('${toLower('cache')}-${toLower('data')}', 32)
name: take('${toLower('cache')}-${toLower('Appdata')}', 32)
properties: {
azureFile: {
accountName: env_storageVolume.name
Expand Down
Loading