6 Simplifying ARM templates using the Bicep DSL

 

This chapter covers

  • Bicep, a simpler DSL for writing ARM templates
  • Transpiling Bicep files into ARM templates
  • Bicep notation for resources, parameters, variables, and outputs
  • Modules, an easy way to split larger templates into readable pieces

By now you are familiar with ARM templates and the process of writing and deploying them. And hopefully you are impressed with the opportunities that IaC and ARM templates, in particular, give you.

Still, you may have noticed that describing more extensive infrastructure this way is not perfect. It is generally accepted that ARM templates have several drawbacks, mainly because they are written in JSON. These are some examples:

  • The JSON notation forces you to group all parameters, variables, and resources into three sections, while it might make much more sense to mix them up and order them not by type but in a way that makes sense for the human reader of the template.
  • ARM templates require you to enter expression syntax ([...]) for invoking functions, which is a nuisance and makes templates harder to read.
  • Having to conform to the JSON specification makes it impossible to introduce more powerful syntax for string interpolation and the usage of parameters and variables without using the parameters(...) and variables(...) functions.

6.1 Bicep: A transpiler

6.1.1 Deploying

6.1.2 Transpiling

6.1.3 Decompiling

6.2 Bicep syntax differences

6.2.1 Parameters

6.2.2 Variables

6.2.3 Outputs

6.2.4 Conditions

6.2.5 Loops

6.2.6 Targeting different scopes

6.2.7 Known limitations