Azure / bicep-types-az

Bicep type definitions for ARM resources
MIT License
83 stars 26 forks source link

Error while deploying Azure Container App with bicep: ContainerAppInvalidResourceTotal #2232

Open havarnov opened 1 month ago

havarnov commented 1 month ago

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:

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.

alex-frankel commented 1 month ago

This looks like an issue specific to the App Resource Provider. Can you open up a support ticket and have it routed to the Container App team?

You may also want to open up this issue in this more specific repo: https://github.com/microsoft/azure-container-apps/issues