Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

TERRAFORM IN AZURE CIPRIAN-STEFAN GRIGORE

Slide 3

Slide 3 text

INTRO ABOUT THE SPEAKER ▸ Ciprian has been in the IT fi eld for quite some time and got accustomed to various web technologies. ▸ Currently he mainly develops .net web apps for the Azure cloud. ▸ He is into devops culture.

Slide 4

Slide 4 text

INTRO KEYWORDS ▸ Devops ▸ Provisioning ▸ Infrastructure as Code - IaC ▸ Terraform ▸ Terraform in Azure ▸ Prizes

Slide 5

Slide 5 text

INTRO IAC - DEFINITION ▸ “Infrastructure as Code (IaC) is the management of infrastructure (networks, virtual machines, load balancers, and connection topology) in a descriptive model, using the same versioning as DevOps team uses for source code. Like the principle that the same source code generates the same binary, an IaC model generates the same environment every time it is applied. IaC is a key DevOps practice and is used in conjunction with continuous delivery.” (Microsoft)

Slide 6

Slide 6 text

INTRO SOLUTIONS ▸ Ansible ▸ Puppet ▸ Chef ▸ Terraform ▸ ARM Templates (Azure) ▸ CloudFormation (AWS)

Slide 7

Slide 7 text

INTRO

Slide 8

Slide 8 text

TERRAFORM BIG PICTURE ▸ Con fi guration fi les for modelling infrastructure - declarative and not procedural ▸ CLI ▸ Generic usage - language/tool is cloud agnostic ▸ Providers - AWS, Azure, GCP, etc

Slide 9

Slide 9 text

TERRAFORM CONFIGURATION FILES ▸ Resources ▸ Variables/Out ▸ Data (or references) ▸ Modules ▸ .tf fi les ▸ Multiple fi les ▸ HCL syntax (also json) ▸ “depends on”

Slide 10

Slide 10 text

TERRAFORM CONFIGURATION FILES - SYNTAX

Slide 11

Slide 11 text

TERRAFORM RESOURCES REFERENCE

Slide 12

Slide 12 text

TERRAFORM RESOURCES REFERENCE

Slide 13

Slide 13 text

TERRAFORM COMMANDS ▸ Init ▸ Plan ▸ Apply ▸ Destroy ▸ Import

Slide 14

Slide 14 text

TERRAFORM STATE ▸ Local disk, by default ▸ Remote (“Backend”) ▸ May contains credentials, so pay attention ▸ When “apply” fails somewhere in the middle, the successful changes are stored into the state

Slide 15

Slide 15 text

TERRAFORM SCENARIO 1 - NEW ENVIRONMENT ▸ Write con fi gurations ▸ Use init/plan/apply

Slide 16

Slide 16 text

TERRAFORM SCENARIO 2 - IMPORT EXISTING ENVIRONMENT ▸ Write con fi gurations ▸ Import command ▸ Import is made for each resource ▸ Apply will create new env

Slide 17

Slide 17 text

TERRAFORM SCENARIO 3 - USE EXISTING RESOURCES AS REFERENCE ONLY ▸ Write con fi gurations ▸ Use “data” instead of “resource” ▸ e.g. we may need reference to an existing Service Bus ▸ The “Service Bus” maybe be part of other IaC..

Slide 18

Slide 18 text

TERRAFORM SCENARIO 4 - REUSE CONFIGURATIONS ▸ Write modules - e.g. called “backend”, “frontend” ▸ Write con fi gurations and reuse modules ▸ Maybe have 3 con fi gurations - qa/acp/prod

Slide 19

Slide 19 text

TERRAFORM DEMOS ▸ Scenario 1 - create a new infra setup; adjust details ▸ Scenario 2 - import existing infra ▸ Scenario 3 - adjust infra setup - use external resources

Slide 20

Slide 20 text

TERRAFORM IN AZURE ▸ For IaaS (VMs/VNets/LBs), Paas (Azure functions, App Services), AKS (Azure Kubernetes Service) ▸ Alternative to ARM templates ▸ Available in CloudShell ▸ Documentation available on MS docs

Slide 21

Slide 21 text

TERRAFORM IN AZURE - ALTERNATIVE TO ARM TEMPLATE

Slide 22

Slide 22 text

TERRAFORM IN AZURE - IN CLOUD SHELL

Slide 23

Slide 23 text

TERRAFORM IN AZURE - IN CLOUD SHELL

Slide 24

Slide 24 text

TERRAFORM AZURE DEVOPS - PART OF A CI/CD PIPELINE https://www.azuredevopslabs.com/labs/vstsextend/terraform/

Slide 25

Slide 25 text

TERRAFORM AZURE DEVOPS - PART OF A CI/CD PIPELINE ▸ Build tasks available in MarketPlace

Slide 26

Slide 26 text

TERRAFORM DEMO - SHOW A CI/CD PIPELINE ▸ Purpose - show how terraform tasks can be used in “Azure Devops” pipelines

Slide 27

Slide 27 text

END RESOURCES

Slide 28

Slide 28 text

END TAKEAWAYS ▸ IaC - helps you manage large infrastructure easily; already mainstream concept ▸ Terraform - a sample of what we expect from IaC (code/test/deploy infrastructure) ▸ Microsoft world - we can use non-Microsoft tools for a better job

Slide 29

Slide 29 text

Q&A

Slide 30

Slide 30 text

THANK YOU