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

A presentation at Indy.Code() in August 2023 in Indianapolis, IN, USA 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

Slide 4

Slide 4

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

Slide 5

Slide 5

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

Slide 6

Slide 6

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

Slide 7

Slide 7

Azure Resource Manager • API provisioning engine built into Azure.

Slide 8

Slide 8

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 9

Slide 9

ARM templates

Slide 10

Slide 10

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

Slide 11

Slide 11

ARM Template format

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

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

Slide 18

Slide 18

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

Slide 19

Slide 19

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

Slide 20

Slide 20

Loop over index

Slide 21

Slide 21

Loop over items

Slide 22

Slide 22

Loop over dictionary items

Slide 23

Slide 23

Loop over integer index and items

Slide 24

Slide 24

Loop over items with conditional

Slide 25

Slide 25

BICEP DEMO

Slide 26

Slide 26

Terraform

Slide 27

Slide 27

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

Slide 28

Slide 28

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

Slide 29

Slide 29

Terraform syntax. • Arguments. • Blocks.

Slide 30

Slide 30

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

Slide 31

Slide 31

TERRAFORM DEMO

Slide 32

Slide 32

Which one should I use?

Slide 33

Slide 33

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

Slide 34

Slide 34

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

Slide 35

Slide 35

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

Slide 36

Slide 36

Questions?

Slide 37

Slide 37

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 38

Slide 38

Useful links. • https://github.com/Azure/bicep-registrymodules/tree/main/modules

Slide 39

Slide 39

@thesoccerdev drkclw samueljgomez