ARM, Bicep, knees and toes! Infrastructure as code for beginners.

A presentation at User group presentation in April 2023 in by Sam Gomez

Slide 1

Slide 1

ARM, Bicep, knees and toes! Infrastructure as code for beginners.

Slide 2

Slide 2

Originally from Mexico. Tech Lead at Geneca. Spend time with family, movies, videogames, soccer. @thesoccerdev drkclw samueljgomez

Slide 3

Slide 3

Agenda • Who is this talk for? • Infrastructure as Code • Azure Resource Manager • Tool overview • ARM templates • Bicep • Terraform

Slide 4

Slide 4

Who is this talk for? • People completely new to IaC. • Little experience with ARM templates. • New to Bicep. • New to Terraform.

Slide 5

Slide 5

Infrastructure as Code • Deploy infrastructure in an automated, consistent and repeatable manner.

Slide 6

Slide 6

Azure Resource Manager • API provisioning engine built into Azure.

Slide 7

Slide 7

Azure Resource Manager benefits • Manage infrastructure through templates. • Deploy resources in a consistent state. • Define dependencies between resources. • Apply tags to resources to organize them. • Apply access control.

Slide 8

Slide 8

ARM templates

Slide 9

Slide 9

ARM templates • JSON format with declarative syntax. • Defines infrastructure and configuration.

Slide 10

Slide 10

ARM Template format

Slide 11

Slide 11

Slide 12

Slide 12

ARM DEMO

Slide 13

Slide 13

https://www.rambli.com/2016/06/the-prayer-of-the-demo-gods/

Slide 14

Slide 14

Bicep

Slide 15

Slide 15

Bicep • Domain specific language that aims to drastically simplify authoring experience. • Transparent abstraction over ARM templates.

Slide 16

Slide 16

Bicep format

Slide 17

Slide 17

Bicep example

Slide 18

Slide 18

Modules • Allow you to use reference other bicep AND ARM template files. • Import modules from private or public registries.

Slide 19

Slide 19

Conditional (if) • Allow you to deploy resources only when condition is met.

Slide 20

Slide 20

Loops • Define multiple copies of: • • • • • Resources Modules Variables Properties Outputs

Slide 21

Slide 21

Loop over index

Slide 22

Slide 22

Loop over items

Slide 23

Slide 23

Loop over dictionary items

Slide 24

Slide 24

Loop over integer index and items

Slide 25

Slide 25

Loop over items with conditional

Slide 26

Slide 26

BICEP DEMO

Slide 27

Slide 27

Terraform

Slide 28

Slide 28

Terraform. • Open source IaC tool for provisioning and managing infrastructure. • HCL syntax. • Can provision resources to multiple cloud providers.

Slide 29

Slide 29

Terraform providers. • Plugins used to interact with cloud providers, SaaS providers and other APIs. • Azure • AWS • Google Cloud

Slide 30

Slide 30

Terraform syntax. • Arguments. • Blocks.

Slide 31

Slide 31

Terraform state. • Terraform stores infrastructure state in a separate file.

Slide 32

Slide 32

TERRAFORM DEMO

Slide 33

Slide 33

Which one should I use?

Slide 34

Slide 34

Terraform. • Resources not in Azure (including onprem). • Mix of cloud providers. • More accessible for developers.

Slide 35

Slide 35

Bicep. • Resources in Azure only. • Share templates via registries. • More accessible to developers.

Slide 36

Slide 36

ARM. • Resources in Azure only. • Do not want to learn new language. • Team has experience with ARM templates.

Slide 37

Slide 37

Questions?

Slide 38

Slide 38

Useful links. • https://learn.microsoft.com/enus/azure/templates/. • https://github.com/Azure/azure-quickstarttemplates • https://github.com/Azure/bicep. • https://github.com/hashicorp/terraformprovider-azurerm/tree/main/examples.

Slide 39

Slide 39

@thesoccerdev drkclw samueljgomez