SlideShare a Scribd company logo
Terraform for Azure:
the good, the bad and the ugly
Giulio Vian – DevOps Lead – Glass, Lewis & Co.
Agenda
Slides on SlideShare
What is Terraform?
Provisioning
•Terraform
•Azure ARM
Template
•Azure CLI
•Azure
Powershell
Configuration
•Powershell
DSC
•Chef
•Ansible
•Packer
Deployment
•Azure DevOps
•Octopus
Deploy
What is Terraform?
Provisioning
•Terraform
•Azure ARM
Template
•Azure CLI
•Azure
Powershell
Configuration
•Powershell
DSC
•Chef
•Ansible
•Packer
Deployment
•Azure DevOps
•Octopus
Deploy
No, what is Terraform?
Single executable (kinda)
https://www.terraform.io/
The Good,
Terraform DSL
resource "azurerm_virtual_machine" "vm_demo" {
name = "demovm"
location = “northeurope"
resource_group_name = "tf-demo"
network_interface_ids =
["${azurerm_network_interface.vm_demo.id}"]
vm_size = "Standard_B2s"
storage_image_reference {
publisher = "MicrosoftWindowsServer"
offer = "WindowsServerSemiAnnual"
sku = "Datacenter-Core-1803-smalldisk"
version = "latest"
}
storage_os_disk {
name = "demovm-osdisk"
caching = "ReadWrite"
create_option = "FromImage"
}
storage_data_disk {
name = "demovm-datadisk"
create_option = "Empty"
lun = 0
disk_size_gb = "10"
}
os_profile {
computer_name = "DEMOVM"
admin_username = "${var.vm_admin_username}"
admin_password = "${var.vm_admin_password}"
}
os_profile_windows_config {
provision_vm_agent = true
enable_automatic_upgrades = false
}
}
Why Terraform?
ARM Template
Why Terraform?
Powershell
How it works
Command line tool
terraform init
terraform plan -out temp.dat
terraform apply temp.dat
Providers
Executables
azurerm, azuread, azurestack
State (metadata)
Terraform basics
Terraform 0.12
Great promises
in a not-so-near future
Tip: Passing credentials
resource "azurerm_virtual_machine_extension" "my_vm_dscext"
{
#...
protected_settings = <<PROTECTED_SETTINGS
{
"configurationArguments": {
"someCredential": {
"userName": "theUser",
"password": "${var.the_user_pass}"
}
}
}
PROTECTED_SETTINGS
}
Tip: assigning IPs
Static addresses
cidrsubnet
cidrhost
Tip: pulling KeyVault
Pre-load KeyVault with secrets
data "azurerm_key_vault_secret" "test" {
name = "mypassword"
vault_uri = "https://yourvault.vault.azure.net/"
}
Integration
azurerm_virtual_machine_extension
Powershell DSC
Custom script → bash / Ansible
Providers
Chef, Docker, Kubernetes
Provisioners
ssh / WinRM
Automate
Permit HTTPS to Internet*
Credential (e.g. Service Principal)
Get executable on the agent*
Run apply
There are ready-to use tasks
*optional
Scale
We have 6 environments with 150+ resources
each
Goodies Summary
Simple
Modular
Integrates well with Azure
Easy to automate
the Bad,
Language Limits (HCL <0.12)
Loops are hard
Nested loop almost impossible
Ifs are hard or impossible
Catching up
Application Gateway
story
Simple errors
Error: Error applying plan:
azurerm_lb_probe.lb_probe_http: Error
Creating/Updating LoadBalancer
network.LoadBalancersClient#CreateOrUpdate
: Failure sending request: StatusCode=0 --
Original Error: Put
https://management.azure.com/subscriptions
/12345678-9abc-def0-1234-
56789abcdef0/resourceGroups/qa/providers/M
icrosoft.Network/loadBalancers/qa-
loadbalancer?api-version=2017-09-01: http:
ContentLength=1655 with Body length 0
Downside Summary
Limited expressive power
(<0.12)
Debugging can be difficult
and the Ugly
State management
Myth: State is map of reality
Setup in shared, locked place
Azure Storage or AWS S3
Some changes not sensed
Learn to use
terraform state
Stay organized
/ repo root
modules terraform modules
utility general purpose
shared common to multiple applications or environments
application_name internal or public application
non-production can be rebuilt any moment
shared common to multiple environments
e.g. deploy agents, jumpbox
qa Integration test
uat User acceptance test
perf Load testing
production everything here is critical
... details on next slide
Stay organized (cont’d)
/ repo root
production everything here is critical
legacy hand made infrastructure e.g. TFS
shared common to main and DR
e.g. networking
live PRODUCTION ENVIRONMENTS
network “everlasting” resources
data-tier long-lived resources
app-tier short-lived resources
app_name resources for an app
dr Disaster recovery site
... As above
Folders and state
Each leaf has a state file
Source can refer to existing state files
production
shared production/shared/terraform.tfstate
live
network production/live/network/terraform.tfstate
app-tier production/live/app-tier/terraform.tfstate
Three steps to import
Define as regular resources
Add safety clause
lifecycle {
prevent_destroy = true
}
Include in state
terraform import
Tip: Terraform tips
HCL parser idiosyncrasies
Regex might be troublesome
 is not unusual
Unpleasant Summary
Low level commands
& attributes for state
Refactoring impacts state
Wrap-up
33
Succeeded?
Study the book
Terraform - Up and Running: Writing Infrastructure as Code — Y.Brikman (O′Reilly)
Bio in pictures
36
giulio.dev@casavian.eu
@giulio_vian
https://www.slideshare.net/giuliov
https://tfsaggregator.github.io
http://blog.casavian.eu/
Hardware spec:
1KB RAM (upg. 16KB)
4KB ROM
First computer Companies Communities
End of trasmissions
37

More Related Content

PDF
OpenStack at NTT Resonant: Lessons Learned in Web Infrastructure
PPTX
My Experiences as a Beginner of OpenJDK Contributor (jLove Conference)
PPTX
NTTドコモ様 導入事例 OpenStack Summit 2015 Tokyo 講演「After One year of OpenStack Cloud...
PPTX
OpenStackを利用したEnterprise Cloudを支える技術 - OpenStack最新情報セミナー 2016年5月
PDF
OpenStack Summit Tokyo - Know-how of Challlenging Deploy/Operation NTT DOCOMO...
PDF
OpenStack: Inside Out
PPTX
NTTドコモ様 導入事例 OpenStack Summit 2016 Barcelona 講演「Expanding and Deepening NTT D...
PPTX
PostgreSQL-as-a-Service with Crunchy PostgreSQL for PKS
OpenStack at NTT Resonant: Lessons Learned in Web Infrastructure
My Experiences as a Beginner of OpenJDK Contributor (jLove Conference)
NTTドコモ様 導入事例 OpenStack Summit 2015 Tokyo 講演「After One year of OpenStack Cloud...
OpenStackを利用したEnterprise Cloudを支える技術 - OpenStack最新情報セミナー 2016年5月
OpenStack Summit Tokyo - Know-how of Challlenging Deploy/Operation NTT DOCOMO...
OpenStack: Inside Out
NTTドコモ様 導入事例 OpenStack Summit 2016 Barcelona 講演「Expanding and Deepening NTT D...
PostgreSQL-as-a-Service with Crunchy PostgreSQL for PKS

What's hot (20)

PDF
[Cloudera World Tokyo 2018] Cloudera on Oracle Cloud Infrastructure
PDF
Best Practices for Using Alluxio with Apache Spark with Gene Pang
PPTX
Bare Metal Provisioning for Big Data - OpenStack最新情報セミナー(2016年12月)
PPTX
My Experiences as a Beginner of OpenJDK Contributor (JCConf Taiwan 2021)
PDF
Scalable TensorFlow Deep Learning as a Service with Docker, OpenPOWER, and GPUs
PDF
[OpenStack Day in Korea 2015] Track 3-1 - OpenStack Storage Infrastructure & ...
PDF
Automating hard things may 2015
ODP
OpenStack DevStack Configuration localrc local.conf Tutorial
PDF
OPNFV Doctor - OpenStack最新情報セミナー 2017年7月
PDF
JavaでCPUを使い倒す! ~Java 9 以降の CPU 最適化を覗いてみる~(NTTデータ テクノロジーカンファレンス 2019 講演資料、2019...
PDF
[OpenStack Day in Korea 2015] Track 1 - Triple O를 이용한 빠르고 쉬운 OpenStack 설치
PDF
Apache Cassandra cluster cloning on Kubernetes
PDF
Enabling Cognitive Workloads on the Cloud: GPUs with Mesos, Docker and Marath...
PDF
Network Setup Guide: Deploying Your Cloudian HyperStore Hybrid Storage Service
PDF
Quick-Start Guide: Deploying Your Cloudian HyperStore Hybrid Storage Service
PDF
2014-4Q-OpenStack-Fall-presentation-public-20150310a
PDF
Sanger OpenStack presentation March 2017
PDF
[OpenStack Day in Korea] Keynote#2 - Bringing OpenStack to the Enterprise Dat...
PPTX
RENCI User Group Meeting 2017 - I Upgraded iRODS and I still have all my hair
PPTX
OpenStack hands-on (All-in-One)
[Cloudera World Tokyo 2018] Cloudera on Oracle Cloud Infrastructure
Best Practices for Using Alluxio with Apache Spark with Gene Pang
Bare Metal Provisioning for Big Data - OpenStack最新情報セミナー(2016年12月)
My Experiences as a Beginner of OpenJDK Contributor (JCConf Taiwan 2021)
Scalable TensorFlow Deep Learning as a Service with Docker, OpenPOWER, and GPUs
[OpenStack Day in Korea 2015] Track 3-1 - OpenStack Storage Infrastructure & ...
Automating hard things may 2015
OpenStack DevStack Configuration localrc local.conf Tutorial
OPNFV Doctor - OpenStack最新情報セミナー 2017年7月
JavaでCPUを使い倒す! ~Java 9 以降の CPU 最適化を覗いてみる~(NTTデータ テクノロジーカンファレンス 2019 講演資料、2019...
[OpenStack Day in Korea 2015] Track 1 - Triple O를 이용한 빠르고 쉬운 OpenStack 설치
Apache Cassandra cluster cloning on Kubernetes
Enabling Cognitive Workloads on the Cloud: GPUs with Mesos, Docker and Marath...
Network Setup Guide: Deploying Your Cloudian HyperStore Hybrid Storage Service
Quick-Start Guide: Deploying Your Cloudian HyperStore Hybrid Storage Service
2014-4Q-OpenStack-Fall-presentation-public-20150310a
Sanger OpenStack presentation March 2017
[OpenStack Day in Korea] Keynote#2 - Bringing OpenStack to the Enterprise Dat...
RENCI User Group Meeting 2017 - I Upgraded iRODS and I still have all my hair
OpenStack hands-on (All-in-One)
Ad

Similar to Terraform for azure: the good, the bad and the ugly - (20)

PPTX
Terraform for azure: the good, the bad and the ugly -
PPTX
Infrastructure-as-Code (IaC) using Terraform
PDF
Infrastructure as Code with Terraform
PPTX
.NET Developer Days - So many Docker platforms, so little time...
PPTX
Debasihish da final.ppt
PDF
Taming the Cloud Database with Apache jclouds, ApacheCon Europe 2014
PPTX
Final terraform
PPTX
Meetup bangalore aug31st2019
PPTX
Reusable, composable, battle-tested Terraform modules
PDF
JavaOne 2014: Taming the Cloud Database with jclouds
PDF
AWS DevOps - Terraform, Docker, HashiCorp Vault
PPTX
ILM - Pipeline in the cloud
PPTX
Deploying Cloud Native Red Team Infrastructure with Kubernetes, Istio and Envoy
PPTX
Moving a Windows environment to the cloud - DevOps Galway Meetup
PDF
Paul Angus (ShapeBlue) - Push infrastructure with Ansible #DOXLON
PDF
Terraform - Taming Modern Clouds
PDF
OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...
PPTX
Aprovisionamiento multi-proveedor con Terraform - Plain Concepts DevOps day
PDF
AWS meets Continuous Delivery
PDF
TIAD : Automating the modern datacenter
Terraform for azure: the good, the bad and the ugly -
Infrastructure-as-Code (IaC) using Terraform
Infrastructure as Code with Terraform
.NET Developer Days - So many Docker platforms, so little time...
Debasihish da final.ppt
Taming the Cloud Database with Apache jclouds, ApacheCon Europe 2014
Final terraform
Meetup bangalore aug31st2019
Reusable, composable, battle-tested Terraform modules
JavaOne 2014: Taming the Cloud Database with jclouds
AWS DevOps - Terraform, Docker, HashiCorp Vault
ILM - Pipeline in the cloud
Deploying Cloud Native Red Team Infrastructure with Kubernetes, Istio and Envoy
Moving a Windows environment to the cloud - DevOps Galway Meetup
Paul Angus (ShapeBlue) - Push infrastructure with Ansible #DOXLON
Terraform - Taming Modern Clouds
OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...
Aprovisionamiento multi-proveedor con Terraform - Plain Concepts DevOps day
AWS meets Continuous Delivery
TIAD : Automating the modern datacenter
Ad

More from Giulio Vian (20)

PPTX
Come implementare la governance nella vostra piattaforma e lavorare felici se...
PDF
Is Technical Debt the right metaphor for Continuous Update?
PPTX
Is Technical Debt the right metaphor for Continuous Update - AllDayDevOps 2022
PPTX
Software rotting - DevOpsCon Berlin
PPTX
Software rotting
PPTX
Software rotting - 28 Apr - DeveloperWeek Europe 2022
PPTX
L'impatto della sicurezza su DevOps
PPTX
L'impatto della sicurezza su DevOps
PPTX
A map for DevOps on Microsoft Stack - MS DevSummit
PPTX
Perché è così difficile il deploy dei database - DevCast DevOps Serie
PPTX
Database deployments - dotnetsheff
PPTX
Database deployment: still hard after all these years - Data Saturday #1
PPTX
Pipeline your Pipelines - 2020 All Day DevOps
PPTX
How to write cloud-agnostic Terraform code - Incontro DevOps Italia 2020
PPTX
Top 10 pipeline mistakes - dotnetsheff
PPTX
Introduction to Terraform with Azure flavor
PPTX
How collaboration works between Dev and Ops - DevOps Agile Testing and Test S...
PPTX
Usare SQL Server for Linux e Docker per semplificare i processi di testing - ...
PPTX
Pipeline your pipelines!
PPTX
Why is DevOps vital for my company’s business
Come implementare la governance nella vostra piattaforma e lavorare felici se...
Is Technical Debt the right metaphor for Continuous Update?
Is Technical Debt the right metaphor for Continuous Update - AllDayDevOps 2022
Software rotting - DevOpsCon Berlin
Software rotting
Software rotting - 28 Apr - DeveloperWeek Europe 2022
L'impatto della sicurezza su DevOps
L'impatto della sicurezza su DevOps
A map for DevOps on Microsoft Stack - MS DevSummit
Perché è così difficile il deploy dei database - DevCast DevOps Serie
Database deployments - dotnetsheff
Database deployment: still hard after all these years - Data Saturday #1
Pipeline your Pipelines - 2020 All Day DevOps
How to write cloud-agnostic Terraform code - Incontro DevOps Italia 2020
Top 10 pipeline mistakes - dotnetsheff
Introduction to Terraform with Azure flavor
How collaboration works between Dev and Ops - DevOps Agile Testing and Test S...
Usare SQL Server for Linux e Docker per semplificare i processi di testing - ...
Pipeline your pipelines!
Why is DevOps vital for my company’s business

Recently uploaded (20)

PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
Introduction to Artificial Intelligence
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
System and Network Administraation Chapter 3
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
Transform Your Business with a Software ERP System
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
medical staffing services at VALiNTRY
PPTX
ai tools demonstartion for schools and inter college
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
Upgrade and Innovation Strategies for SAP ERP Customers
Introduction to Artificial Intelligence
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
System and Network Administraation Chapter 3
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Transform Your Business with a Software ERP System
ManageIQ - Sprint 268 Review - Slide Deck
How to Migrate SBCGlobal Email to Yahoo Easily
How to Choose the Right IT Partner for Your Business in Malaysia
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Design an Analysis of Algorithms II-SECS-1021-03
medical staffing services at VALiNTRY
ai tools demonstartion for schools and inter college
Design an Analysis of Algorithms I-SECS-1021-03
Understanding Forklifts - TECH EHS Solution
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Odoo POS Development Services by CandidRoot Solutions
How Creative Agencies Leverage Project Management Software.pdf
Wondershare Filmora 15 Crack With Activation Key [2025

Terraform for azure: the good, the bad and the ugly -

Editor's Notes

  • #27: No, state is metadata e.g. Terraform dependencies Read the book Similar “aha” moment with Ansible
  • #41: Read the book Similar “aha” moment with Ansible
  • #44: No, state is metadata e.g. Terraform dependencies Read the book Similar “aha” moment with Ansible