Azure / Azure/bicep-types-az

Error while deploying Azure Container App with bicep: ContainerAppInvalidResourceTotal

Open
#2,232 1 comment 0 reactions 0 assignees View on GitHub
Needs: Triage :mag:
Dominant language
TypeScript
Stars
108
Forks
44
Avg merge
18h 53m
Merged PRs (30d)
29

Description

az bicep version
Bicep CLI version 0.28.1 (ba1e9f8c1e)

**Describe the bug**
Getting an error while trying to deploy an Azure Container App to a Container App Environment with "Consumption" workload profile: `ContainerAppInvalidResourceTotal`.

In my bicep file a have the following:
```bicep
resource containerApp 'Microsoft.App/containerApps@2024-03-01' = {
(...)
properties:{
(...)
template: {
(...)
containers: [
{
(...)
resources: {
cpu: json('4')
memory: '8Gi'
}
}
]
}
}
}
```

But I'll get this error:

```
{"code": "InvalidTemplateDeployment", "message": "The template deployment 'main' is not valid according to the validation procedure. The tracking id is 'f185185a-69fe-45cb-900e-3705995934fe'. See inner errors for details."}

Inner Errors:
{"code": "ValidationForResourceFailed", "message": "Validation failed for a resource. Check 'Error.Details[0]' for more information."}

Inner Errors:
{"code": "ContainerAppInvalidResourceTotal", "message": "The total requested CPU and memory resources for this application (CPU: 4, memory: 8) is invalid. Total CPU and memory for all containers defined in a Container App must add up to one of the following CPU - Memory combinations: [cpu: 0.25, memory: 0.5Gi]; [cpu: 0.5, memory: 1.0Gi]; [cpu: 0.75, memory: 1.5Gi]; [cpu: 1.0, memory: 2.0Gi]; [cpu: 1.25, memory: 2.5Gi]; [cpu: 1.5, memory: 3.0Gi]; [cpu: 1.75, memory: 3.5Gi]; [cpu: 2.0, memory: 4.0Gi]"}
```

If I change to 2 vCpu and 4Gi memory it work as expected:

```
resources: {
cpu: json('2')
memory: '4Gi'
}
```

If I use the portal manually and create a new "revision" of the Azure Container App I can set the resources to 4 vCpu and 8Gi memory. As expected according to the documentation: https://learn.microsoft.com/en-us/azure/container-apps/workload-profiles-overview#profile-types.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the Microsoft.App/containerApps@2024-03-01 resource declaration and reproduce the deployment using the shown Bicep resource values. Compare the accepted CPU and memory combinations with the linked Azure workload profiles documentation and the definitions in this repository. Done means the discrepancy is resolved for 4 vCPU and 8Gi, or the issue clearly identifies whether the problem is in the type definitions or Azure validation.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.