Azure / bicep

Bicep is a declarative language for describing and deploying Azure resources
MIT License
3.21k stars 745 forks source link

DeploymentQuotaExceeded #2529

Open afscrome opened 3 years ago

afscrome commented 3 years ago

Is your feature request related to a problem? Please describe.

In one of our subscriptions, we have started to hit DeploymentQuotaExceeded errors. With ARM templates, we tended to have a smaller number of large templates, however with bicep we're heavily modularising our templates through modules. With each module becoming a separate deployment, one json deployment easily becoming 10+ bicep deployments.

On top of this, we made things worse for ourselves as our pipelines had been giving each deployment attempt it's own name (by including a build id component). That plus bicep's modules led to an explosion in the number of deployments being made, making that 800 limit. We've also been iterating on new templates / infastructure compounding our previous two problems.

Describe the solution you'd like

Not sure there's a single solution. And in many ways this isn't a bicep specific issue, but the ease of breaking into bicep modules makes these limits easier to hit, hence why I'm brining this up here.

  1. Should the default azure quota of 800 deployments be raised?
  2. Whilst there is some auto cleanup at resource group level, this only kicks in at 775/800. With a single bicep template being able to easily consume 10+ deployments, there isn't much buffer here between "start cleaning up" and "out of space". Seems to me there should be a slightly bigger gap here. (This also doesn't help subscription / management group / tenant level deployments)
  3. CLI documentation on deployments include examples on how to include a name component that varies run to run. With deployments being capped by quota, perhaps guidance shouldn't so freely suggest including a varying component in a deployment name. (I haven't check docs for powershell or other routes of creating templates which may need similar updates)
  4. We're currently breaking up bicep into lots of tiny modules - should we instead be breaking down into a smaller number of larger modules? If so, this probably needs some documentation.
alex-frankel commented 3 years ago

Selfishly I love that you are running into this problem :)

Whilst there is some auto cleanup at resource group level, this only kicks in at 775/800. With a single bicep template being able to easily consume 10+ deployments, there isn't much buffer here between "start cleaning up" and "out of space". Seems to me there should be a slightly bigger gap here.

This is the most realistic thing to do IMO - I'd be tempted to raise it to 100-200. Raising the quota is a much bigger lift even though that would be ideal. FWIW, we are going to roll this out for all azure scopes in the next 2-3 months - cc @snarkywolverine as FYI