SlideShare a Scribd company logo
Infrastructure as Code for Azure:
ARM or Terraform?
• What is “Infrastructure as Code”
• Resource group patterns
• ARM template structure
• Demo: Deploying Infrastructure using ARM + PowerShell
• What is terraform
• Terraform code lifecycle
• Demo: Plan and apply terraform configuration
• Q+A
Agenda
Infrastructure as Code evolved to solve the problem of environment
drift in the release pipeline. Without IaC, teams must maintain the settings
of individual deployment environments. Over time, each environment
becomes a snowflake, that is, a unique configuration that cannot be
reproduced automatically. Inconsistency among environments leads to
issues during deployments. With snowflakes, administration and
maintenance of infrastructure involves manual processes which were hard
to track and contributed to errors.
Infrastructure as Code
Infrastructure as Code for Azure: ARM or Terraform?
• Azure Portal
• ARM Templates + Powershell/Azure CLI
• Custom usage of REST API (use any type of sdk)
• Terraform
Deploying Infrastructure to Azure
• Resource Group – logically grouped collection of entities that usually share a common lifecycle
• Resource Manager Template - declarative JSON file that defines the goal state of a deployment
• Deployment - operation which tracks execution of a Resource Manager template
• Parameters - values provided by the user executing the deployment to customize deployed resources
• Parameter file - JSON file that stores parameter names and values
• API Version – used for versioning and backward compatibility
CONCEPTS
AZURE RESOURCE MANAGEMENT (ARM)
• Resources can be organized in a Resource Group, a logical container.
• Resource can belong to only one Resource Group. Nested resource groups are not supported.
• All Azure Services belongs to certain Resource Type.
• Resource has common fields and provider specific properties.
• Work with Azure Services as with REST Web Services Resources (CRUD).
• You can clarify billing for your organization by viewing the rolled-up costs for the entire group.
CLOUD SERVICES AS REST RESOURCE
AZURE RESOURCE MANAGEMENT (ARM) API
RESOURCE GROUP PATTERNS - APPLICATION
Resource Group
as
Container for
Application Resources
Backend Server 01 Backend Server 02
VHD
VHD
Backend Subnet
Backend Resource Group Frontend Resource Group
Frontend Server 01 Frontend Server 02
VHD
VHD
Frontend Subnet
RESOURCE GROUP PATTERNS - ENVIRONMENT
Resource Group
as
Container for
System Environment
Backend Servers
VHD VHD
Virtual Network
Development Environment
Virtual Network
Frontend Servers Backend Servers
VHD VHD
QA Environment
Frontend Servers
Element Required Description
$schema Yes Location of the JSON schema file.
contentVersion Yes Version of the template.
parameters No Values provided during deployment execution.
variables No Internal variables
resources Yes Azure services deployed or updated in a resource group
outputs No Values that are returned after deployment
EASY PROVISIONING - RESOURCE TEMPLATE
Function Syntax
concat concat (arg1, arg2, arg3, ...)
replace replace(originalString, oldCharacter, newCharacter)
base64 base64 (inputString)
padLeft padLeft(stringToPad, totalLength, paddingCharacter)
toLower toLower(stringToChange)
toUpper toUpper(stringToChange)
TEMPLATE EXPRESSION AND FUNCTIONS - STRINGS
Function Description Syntax
listKeys Returns the keys of a
storage account.
listKeys (resourceName or
resourceIdentifier, [apiVersion])
reference Used in depends on
section of resource
reference (resourceName or
resourceIdentifier, [apiVersion])
resourceGroup Returns current resource
group
resourceGroup()
resourceId Returns the unique
identifier of a resource
resourceId ([resourceGroupName],
resourceType, resourceName1,
[resourceName2]...)
subscription Returns subscription
details
subscription()
TEMPLATE EXPRESSION AND FUNCTIONS - OTHER
Deploying Infrastructure using ARM
Demo
https://bit.ly/2EZch0b
https://github.com/serhiiabanichev/GAB2018
Git URL
What is terraform
Terraform is a tool for building, changing, and versioning
infrastructure safely and efficiently. Terraform can manage existing and
popular service providers as well as custom in-house solutions.
Configuration files describe to Terraform the components needed to
run a single application or your entire datacenter. Terraform generates an
execution plan describing what it will do to reach the desired state, and
then executes it to build the described infrastructure. As the configuration
changes, Terraform is able to determine what changed and create
incremental execution plans which can be applied.
Terraform lifecycle
Azure Azure
Configuration
HCL (HashiCorp Configuration Language) is a configuration language built by
HashiCorp. The goal of HCL is to build a structured configuration language that is both human
and machine friendly for use with command-line tools, but specifically targeted towards
DevOps tools, servers, etc.
The set of files used to describe infrastructure in Terraform is simply known as a
Terraform configuration.
provider "azurerm" {
subscription_id = "f7424aaf-****-****-****-*********"
client_id = "c404e1a2-****-****-****-*********"
client_secret = "************"
tenant_id = "b41b72d-****-****-****-*********"
}
# Create a Resource Group
resource "azurerm_resource_group" "main" {
name = "${var.resource_group}"
location = "${var.location}"
}
Initialization
The first command to run for a new configuration - or after checking out an existing
configuration from version control - is terraform init, which initializes various local
settings and data that will be used by subsequent commands.
Terraform uses a plugin based architecture to support the numerous infrastructure and
service providers available. As of Terraform version 0.10.0, each "Provider" is its own
encapsulated binary distributed separately from Terraform itself. The terraform
init command will automatically download and install any Provider binary for the providers
in use within the configuration, which in this case is just the azurerm provider:
c:GAB2018TF> terraform init
Initializing provider plugins...
- Checking for available provider plugins on https://releases.hashicorp.com...
- Downloading plugin for provider "azurerm" (1.3.3)...
The following providers do not have any version constraints in configuration,
so the latest version was installed.
* provider.azurerm: version = "~> 1.3"
Terraform has been successfully initialized!
Plan changes
c:GAB2018TF> terraform plan -out=GAB
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.
------------------------------------------------------------------------
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
+ create
<= read (data resources)
Terraform will perform the following actions:…….
The terraform plan command is used to create an execution plan. Terraform
performs a refresh, unless explicitly disabled, and then determines what actions are necessary to
achieve the desired state specified in the configuration files.
This command is a convenient way to check whether the execution plan for a set of
changes matches your expectations without making any changes to real resources or to the
state. For example, terraform plan might be run before committing a change to version control,
to create confidence that it will behave as expected.
Apply configuration
c:GAB2018TF>terraform apply "GAB„
azurerm_resource_group.main: Creating...
location: "" => "eastus"
name: "" => "GAB-TF"
tags.%: "" => "<computed>"
azurerm_resource_group.main: Creation complete after 2s (ID: /subscriptions/f7424*********)
azurerm_virtual_network.main: Creating...
address_space.#: "" => "1"
address_space.0: "" => "12.0.0.0/24"
location: "" => "eastus"
name: "" => "GAB-TF-vnet"
resource_group_name: "" => "GAB-TF"
subnet.#: "" => "<computed>"
tags.%: "" => "<computed>"
azurerm_public_ip.main: Creating...
The terraform apply command is used to apply the changes required to reach the
desired state of the configuration, or the pre-determined set of actions generated by
a terraform plan execution plan.
Apply configuration
c:GAB2018TF>terraform apply "GAB„
azurerm_resource_group.main: Creating...
location: "" => "eastus"
name: "" => "GAB-TF"
tags.%: "" => "<computed>"
azurerm_resource_group.main: Creation complete after 2s (ID: /subscriptions/f7424*********)
azurerm_virtual_network.main: Creating...
address_space.#: "" => "1"
address_space.0: "" => "12.0.0.0/24"
location: "" => "eastus"
name: "" => "GAB-TF-vnet"
resource_group_name: "" => "GAB-TF"
subnet.#: "" => "<computed>"
tags.%: "" => "<computed>"
azurerm_public_ip.main: Creating...
The terraform apply command is used to apply the changes required to reach the
desired state of the configuration, or the pre-determined set of actions generated by
a terraform plan execution plan.
Plan and apply terraform configuration
Demo
Pros and Cons
Great implementation of Infrastructure
as Code concept.
Declarative syntax
Ability to "plan" and "apply" configs.
Apply actually executes the changes.
Supports various cloud providers
Uses it's own DSL called the Hashicorp
Configuration Language
State files store secrets in plain text which is a
bad idea when you push it to version-control.
Product is still maturing and there are some
design limitation
Infrastructure as Code for Azure: ARM or Terraform?
CONTACT ME
serhii_abanichev@epam.com
serhii_abanichev
serhii_abanichev
sergej.abanichev

More Related Content

What's hot (20)

PPTX
Azure Container Apps
Ken Sykora
 
PDF
Best Practices of Infrastructure as Code with Terraform
DevOps.com
 
PPTX
Comprehensive Terraform Training
Yevgeniy Brikman
 
PPTX
Using Azure DevOps to continuously build, test, and deploy containerized appl...
Adrian Todorov
 
PPTX
Microsoft DevOps Solution - DevOps
Chetan Gordhan
 
PPTX
Getting started with containers on Azure
Microsoft Tech Community
 
PPTX
DevOps Engineer [Arabic]
ahmadezzeir
 
PPTX
Tour of Azure DevOps
Callon Campbell
 
PPTX
Terraform
Phil Wilkins
 
PDF
Terraform
Marcelo Serpa
 
PPTX
Getting Started with Azure Artifacts
Callon Campbell
 
PDF
Getting Started with Infrastructure as Code
WinWire Technologies Inc
 
PPTX
Continues Integration and Continuous Delivery with Azure DevOps - Deploy Anyt...
Janusz Nowak
 
PDF
Introduction to Nexus Repository Manager.pdf
Knoldus Inc.
 
PPTX
Docker Tutorial For Beginners | What Is Docker And How It Works? | Docker Tut...
Simplilearn
 
PPTX
Kubernetes Introduction
Eric Gustafson
 
PPTX
The Power of Azure DevOps
Jeff Bramwell
 
PDF
Azure Pipeline Tutorial | Azure DevOps Tutorial | Edureka
Edureka!
 
PPTX
Azure DevOps
Juan Fabian
 
PDF
CI CD Pipeline Using Jenkins | Continuous Integration and Deployment | DevOps...
Edureka!
 
Azure Container Apps
Ken Sykora
 
Best Practices of Infrastructure as Code with Terraform
DevOps.com
 
Comprehensive Terraform Training
Yevgeniy Brikman
 
Using Azure DevOps to continuously build, test, and deploy containerized appl...
Adrian Todorov
 
Microsoft DevOps Solution - DevOps
Chetan Gordhan
 
Getting started with containers on Azure
Microsoft Tech Community
 
DevOps Engineer [Arabic]
ahmadezzeir
 
Tour of Azure DevOps
Callon Campbell
 
Terraform
Phil Wilkins
 
Terraform
Marcelo Serpa
 
Getting Started with Azure Artifacts
Callon Campbell
 
Getting Started with Infrastructure as Code
WinWire Technologies Inc
 
Continues Integration and Continuous Delivery with Azure DevOps - Deploy Anyt...
Janusz Nowak
 
Introduction to Nexus Repository Manager.pdf
Knoldus Inc.
 
Docker Tutorial For Beginners | What Is Docker And How It Works? | Docker Tut...
Simplilearn
 
Kubernetes Introduction
Eric Gustafson
 
The Power of Azure DevOps
Jeff Bramwell
 
Azure Pipeline Tutorial | Azure DevOps Tutorial | Edureka
Edureka!
 
Azure DevOps
Juan Fabian
 
CI CD Pipeline Using Jenkins | Continuous Integration and Deployment | DevOps...
Edureka!
 

Similar to Infrastructure as Code for Azure: ARM or Terraform? (20)

PPTX
Infrastructure-as-Code (IaC) using Terraform
Adin Ermie
 
PDF
Deploy resources on Azure using IaC (Azure Terraform)
George Grammatikos
 
PPTX
RIMA-Infrastructure as a code with Terraform.pptx
MrJustbis
 
PDF
Infrastructure as Code
Albert Suwandhi
 
PDF
NET Aspire - NET Conf IL 2024 - Tamir Dresher.pdf
Tamir Dresher
 
PDF
Introduction to IAC and Terraform
Venkat NaveenKashyap Devulapally
 
PPTX
Effective terraform
Calvin French-Owen
 
PDF
DevOps Enabling Your Team
GR8Conf
 
PPTX
Terraform for azure: the good, the bad and the ugly -
Giulio Vian
 
PPTX
Practical advice on deployment and management of enterprise workloads
Jarek Miszczyk
 
PDF
Terraform vs Pulumi
HoaiNam307
 
PDF
Build cloud native solution using open source
Nitesh Jadhav
 
PDF
Infrastructure as Code with Terraform
Pedro J. Molina
 
PDF
TechnicalTerraformLandingZones121120229238.pdf
MIlton788007
 
PDF
Infrastructure as Code with Terraform
Tim Berry
 
PDF
Surat MuleSoft Meetup#2 - Anypoint Runtime Fabric
Jitendra Bafna
 
PDF
OroCRM Partner Technical Training: September 2015
Oro Inc.
 
PPTX
Dockerization of Azure Platform
nirajrules
 
PPTX
Debasihish da final.ppt
Kalkey
 
PPTX
Terraform for azure: the good, the bad and the ugly -
Giulio Vian
 
Infrastructure-as-Code (IaC) using Terraform
Adin Ermie
 
Deploy resources on Azure using IaC (Azure Terraform)
George Grammatikos
 
RIMA-Infrastructure as a code with Terraform.pptx
MrJustbis
 
Infrastructure as Code
Albert Suwandhi
 
NET Aspire - NET Conf IL 2024 - Tamir Dresher.pdf
Tamir Dresher
 
Introduction to IAC and Terraform
Venkat NaveenKashyap Devulapally
 
Effective terraform
Calvin French-Owen
 
DevOps Enabling Your Team
GR8Conf
 
Terraform for azure: the good, the bad and the ugly -
Giulio Vian
 
Practical advice on deployment and management of enterprise workloads
Jarek Miszczyk
 
Terraform vs Pulumi
HoaiNam307
 
Build cloud native solution using open source
Nitesh Jadhav
 
Infrastructure as Code with Terraform
Pedro J. Molina
 
TechnicalTerraformLandingZones121120229238.pdf
MIlton788007
 
Infrastructure as Code with Terraform
Tim Berry
 
Surat MuleSoft Meetup#2 - Anypoint Runtime Fabric
Jitendra Bafna
 
OroCRM Partner Technical Training: September 2015
Oro Inc.
 
Dockerization of Azure Platform
nirajrules
 
Debasihish da final.ppt
Kalkey
 
Terraform for azure: the good, the bad and the ugly -
Giulio Vian
 
Ad

More from Katherine Golovinova (20)

PDF
Contract-based Testing Approach as a Tool for Shift Lef
Katherine Golovinova
 
PDF
Speed up application testing with azure container instances
Katherine Golovinova
 
PDF
Analyzing application activities with KSQL and Elasticsearch
Katherine Golovinova
 
PPTX
Testing Big Data solutions fast and furiously
Katherine Golovinova
 
PDF
"Fast & Fail in real life of DevTestSecOps"
Katherine Golovinova
 
PPTX
Geodistributed databases - what, how, and why?
Katherine Golovinova
 
PPTX
COSMOS DB - geodistributed database for anyone
Katherine Golovinova
 
PDF
Migrating from a monolith to microservices – is it worth it?
Katherine Golovinova
 
PDF
Azure Functions - the evolution of microservices platform or marketing gibber...
Katherine Golovinova
 
PPTX
Gatling and Page Object: a way to performance testing
Katherine Golovinova
 
PDF
Automation of Security scanning easy or cheese
Katherine Golovinova
 
PPTX
Gradle plugins for Test Automation
Katherine Golovinova
 
PPTX
Automation world under the DevTestSecOps umbrella
Katherine Golovinova
 
PPTX
"Disaster Recovery in Azure" by Viktor Kocherha
Katherine Golovinova
 
PPTX
"Certified Kubernetes Administrator Exam – how it was" by Andrii Fedenishin
Katherine Golovinova
 
PPTX
"Modern CI/CD" by Dmytro Batiievskyi
Katherine Golovinova
 
PPTX
EPAM DevOps community meetup: Building CI/CD for microservice architecture
Katherine Golovinova
 
PPTX
EPAM DevOps community meetup: Designing bare metal Kubernetes clusters
Katherine Golovinova
 
PDF
Hosting Microservices in Microsoft Azure
Katherine Golovinova
 
PDF
Azure IoT Hub: what is it and why we select other solution (production projec...
Katherine Golovinova
 
Contract-based Testing Approach as a Tool for Shift Lef
Katherine Golovinova
 
Speed up application testing with azure container instances
Katherine Golovinova
 
Analyzing application activities with KSQL and Elasticsearch
Katherine Golovinova
 
Testing Big Data solutions fast and furiously
Katherine Golovinova
 
"Fast & Fail in real life of DevTestSecOps"
Katherine Golovinova
 
Geodistributed databases - what, how, and why?
Katherine Golovinova
 
COSMOS DB - geodistributed database for anyone
Katherine Golovinova
 
Migrating from a monolith to microservices – is it worth it?
Katherine Golovinova
 
Azure Functions - the evolution of microservices platform or marketing gibber...
Katherine Golovinova
 
Gatling and Page Object: a way to performance testing
Katherine Golovinova
 
Automation of Security scanning easy or cheese
Katherine Golovinova
 
Gradle plugins for Test Automation
Katherine Golovinova
 
Automation world under the DevTestSecOps umbrella
Katherine Golovinova
 
"Disaster Recovery in Azure" by Viktor Kocherha
Katherine Golovinova
 
"Certified Kubernetes Administrator Exam – how it was" by Andrii Fedenishin
Katherine Golovinova
 
"Modern CI/CD" by Dmytro Batiievskyi
Katherine Golovinova
 
EPAM DevOps community meetup: Building CI/CD for microservice architecture
Katherine Golovinova
 
EPAM DevOps community meetup: Designing bare metal Kubernetes clusters
Katherine Golovinova
 
Hosting Microservices in Microsoft Azure
Katherine Golovinova
 
Azure IoT Hub: what is it and why we select other solution (production projec...
Katherine Golovinova
 
Ad

Recently uploaded (20)

PPTX
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
PPTX
Shinkawa Proposal to meet Vibration API670.pptx
AchmadBashori2
 
PPTX
Types of Bearing_Specifications_PPT.pptx
PranjulAgrahariAkash
 
PDF
Zilliz Cloud Demo for performance and scale
Zilliz
 
PPTX
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
PPTX
Lecture 1 Shell and Tube Heat exchanger-1.pptx
mailforillegalwork
 
PPTX
GitOps_Without_K8s_Training simple one without k8s
DanialHabibi2
 
PDF
PORTFOLIO Golam Kibria Khan — architect with a passion for thoughtful design...
MasumKhan59
 
PPTX
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
PPTX
Hashing Introduction , hash functions and techniques
sailajam21
 
PPTX
Solar Thermal Energy System Seminar.pptx
Gpc Purapuza
 
PPTX
Day2 B2 Best.pptx
helenjenefa1
 
PPTX
Arduino Based Gas Leakage Detector Project
CircuitDigest
 
PPTX
Introduction to Design of Machine Elements
PradeepKumarS27
 
PPTX
Evaluation and thermal analysis of shell and tube heat exchanger as per requi...
shahveer210504
 
PDF
Ethics and Trustworthy AI in Healthcare – Governing Sensitive Data, Profiling...
AlqualsaDIResearchGr
 
PDF
Introduction to Productivity and Quality
মোঃ ফুরকান উদ্দিন জুয়েল
 
PPTX
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
PPTX
Green Building & Energy Conservation ppt
Sagar Sarangi
 
PPTX
Damage of stability of a ship and how its change .pptx
ehamadulhaque
 
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
Shinkawa Proposal to meet Vibration API670.pptx
AchmadBashori2
 
Types of Bearing_Specifications_PPT.pptx
PranjulAgrahariAkash
 
Zilliz Cloud Demo for performance and scale
Zilliz
 
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
Lecture 1 Shell and Tube Heat exchanger-1.pptx
mailforillegalwork
 
GitOps_Without_K8s_Training simple one without k8s
DanialHabibi2
 
PORTFOLIO Golam Kibria Khan — architect with a passion for thoughtful design...
MasumKhan59
 
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
Hashing Introduction , hash functions and techniques
sailajam21
 
Solar Thermal Energy System Seminar.pptx
Gpc Purapuza
 
Day2 B2 Best.pptx
helenjenefa1
 
Arduino Based Gas Leakage Detector Project
CircuitDigest
 
Introduction to Design of Machine Elements
PradeepKumarS27
 
Evaluation and thermal analysis of shell and tube heat exchanger as per requi...
shahveer210504
 
Ethics and Trustworthy AI in Healthcare – Governing Sensitive Data, Profiling...
AlqualsaDIResearchGr
 
Introduction to Productivity and Quality
মোঃ ফুরকান উদ্দিন জুয়েল
 
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
Green Building & Energy Conservation ppt
Sagar Sarangi
 
Damage of stability of a ship and how its change .pptx
ehamadulhaque
 

Infrastructure as Code for Azure: ARM or Terraform?

  • 1. Infrastructure as Code for Azure: ARM or Terraform?
  • 2. • What is “Infrastructure as Code” • Resource group patterns • ARM template structure • Demo: Deploying Infrastructure using ARM + PowerShell • What is terraform • Terraform code lifecycle • Demo: Plan and apply terraform configuration • Q+A Agenda
  • 3. Infrastructure as Code evolved to solve the problem of environment drift in the release pipeline. Without IaC, teams must maintain the settings of individual deployment environments. Over time, each environment becomes a snowflake, that is, a unique configuration that cannot be reproduced automatically. Inconsistency among environments leads to issues during deployments. With snowflakes, administration and maintenance of infrastructure involves manual processes which were hard to track and contributed to errors. Infrastructure as Code
  • 5. • Azure Portal • ARM Templates + Powershell/Azure CLI • Custom usage of REST API (use any type of sdk) • Terraform Deploying Infrastructure to Azure
  • 6. • Resource Group – logically grouped collection of entities that usually share a common lifecycle • Resource Manager Template - declarative JSON file that defines the goal state of a deployment • Deployment - operation which tracks execution of a Resource Manager template • Parameters - values provided by the user executing the deployment to customize deployed resources • Parameter file - JSON file that stores parameter names and values • API Version – used for versioning and backward compatibility CONCEPTS AZURE RESOURCE MANAGEMENT (ARM)
  • 7. • Resources can be organized in a Resource Group, a logical container. • Resource can belong to only one Resource Group. Nested resource groups are not supported. • All Azure Services belongs to certain Resource Type. • Resource has common fields and provider specific properties. • Work with Azure Services as with REST Web Services Resources (CRUD). • You can clarify billing for your organization by viewing the rolled-up costs for the entire group. CLOUD SERVICES AS REST RESOURCE AZURE RESOURCE MANAGEMENT (ARM) API
  • 8. RESOURCE GROUP PATTERNS - APPLICATION Resource Group as Container for Application Resources Backend Server 01 Backend Server 02 VHD VHD Backend Subnet Backend Resource Group Frontend Resource Group Frontend Server 01 Frontend Server 02 VHD VHD Frontend Subnet
  • 9. RESOURCE GROUP PATTERNS - ENVIRONMENT Resource Group as Container for System Environment Backend Servers VHD VHD Virtual Network Development Environment Virtual Network Frontend Servers Backend Servers VHD VHD QA Environment Frontend Servers
  • 10. Element Required Description $schema Yes Location of the JSON schema file. contentVersion Yes Version of the template. parameters No Values provided during deployment execution. variables No Internal variables resources Yes Azure services deployed or updated in a resource group outputs No Values that are returned after deployment EASY PROVISIONING - RESOURCE TEMPLATE
  • 11. Function Syntax concat concat (arg1, arg2, arg3, ...) replace replace(originalString, oldCharacter, newCharacter) base64 base64 (inputString) padLeft padLeft(stringToPad, totalLength, paddingCharacter) toLower toLower(stringToChange) toUpper toUpper(stringToChange) TEMPLATE EXPRESSION AND FUNCTIONS - STRINGS
  • 12. Function Description Syntax listKeys Returns the keys of a storage account. listKeys (resourceName or resourceIdentifier, [apiVersion]) reference Used in depends on section of resource reference (resourceName or resourceIdentifier, [apiVersion]) resourceGroup Returns current resource group resourceGroup() resourceId Returns the unique identifier of a resource resourceId ([resourceGroupName], resourceType, resourceName1, [resourceName2]...) subscription Returns subscription details subscription() TEMPLATE EXPRESSION AND FUNCTIONS - OTHER
  • 13. Deploying Infrastructure using ARM Demo https://bit.ly/2EZch0b https://github.com/serhiiabanichev/GAB2018 Git URL
  • 14. What is terraform Terraform is a tool for building, changing, and versioning infrastructure safely and efficiently. Terraform can manage existing and popular service providers as well as custom in-house solutions. Configuration files describe to Terraform the components needed to run a single application or your entire datacenter. Terraform generates an execution plan describing what it will do to reach the desired state, and then executes it to build the described infrastructure. As the configuration changes, Terraform is able to determine what changed and create incremental execution plans which can be applied.
  • 16. Configuration HCL (HashiCorp Configuration Language) is a configuration language built by HashiCorp. The goal of HCL is to build a structured configuration language that is both human and machine friendly for use with command-line tools, but specifically targeted towards DevOps tools, servers, etc. The set of files used to describe infrastructure in Terraform is simply known as a Terraform configuration. provider "azurerm" { subscription_id = "f7424aaf-****-****-****-*********" client_id = "c404e1a2-****-****-****-*********" client_secret = "************" tenant_id = "b41b72d-****-****-****-*********" } # Create a Resource Group resource "azurerm_resource_group" "main" { name = "${var.resource_group}" location = "${var.location}" }
  • 17. Initialization The first command to run for a new configuration - or after checking out an existing configuration from version control - is terraform init, which initializes various local settings and data that will be used by subsequent commands. Terraform uses a plugin based architecture to support the numerous infrastructure and service providers available. As of Terraform version 0.10.0, each "Provider" is its own encapsulated binary distributed separately from Terraform itself. The terraform init command will automatically download and install any Provider binary for the providers in use within the configuration, which in this case is just the azurerm provider: c:GAB2018TF> terraform init Initializing provider plugins... - Checking for available provider plugins on https://releases.hashicorp.com... - Downloading plugin for provider "azurerm" (1.3.3)... The following providers do not have any version constraints in configuration, so the latest version was installed. * provider.azurerm: version = "~> 1.3" Terraform has been successfully initialized!
  • 18. Plan changes c:GAB2018TF> terraform plan -out=GAB Refreshing Terraform state in-memory prior to plan... The refreshed state will be used to calculate this plan, but will not be persisted to local or remote state storage. ------------------------------------------------------------------------ An execution plan has been generated and is shown below. Resource actions are indicated with the following symbols: + create <= read (data resources) Terraform will perform the following actions:……. The terraform plan command is used to create an execution plan. Terraform performs a refresh, unless explicitly disabled, and then determines what actions are necessary to achieve the desired state specified in the configuration files. This command is a convenient way to check whether the execution plan for a set of changes matches your expectations without making any changes to real resources or to the state. For example, terraform plan might be run before committing a change to version control, to create confidence that it will behave as expected.
  • 19. Apply configuration c:GAB2018TF>terraform apply "GAB„ azurerm_resource_group.main: Creating... location: "" => "eastus" name: "" => "GAB-TF" tags.%: "" => "<computed>" azurerm_resource_group.main: Creation complete after 2s (ID: /subscriptions/f7424*********) azurerm_virtual_network.main: Creating... address_space.#: "" => "1" address_space.0: "" => "12.0.0.0/24" location: "" => "eastus" name: "" => "GAB-TF-vnet" resource_group_name: "" => "GAB-TF" subnet.#: "" => "<computed>" tags.%: "" => "<computed>" azurerm_public_ip.main: Creating... The terraform apply command is used to apply the changes required to reach the desired state of the configuration, or the pre-determined set of actions generated by a terraform plan execution plan.
  • 20. Apply configuration c:GAB2018TF>terraform apply "GAB„ azurerm_resource_group.main: Creating... location: "" => "eastus" name: "" => "GAB-TF" tags.%: "" => "<computed>" azurerm_resource_group.main: Creation complete after 2s (ID: /subscriptions/f7424*********) azurerm_virtual_network.main: Creating... address_space.#: "" => "1" address_space.0: "" => "12.0.0.0/24" location: "" => "eastus" name: "" => "GAB-TF-vnet" resource_group_name: "" => "GAB-TF" subnet.#: "" => "<computed>" tags.%: "" => "<computed>" azurerm_public_ip.main: Creating... The terraform apply command is used to apply the changes required to reach the desired state of the configuration, or the pre-determined set of actions generated by a terraform plan execution plan.
  • 21. Plan and apply terraform configuration Demo
  • 22. Pros and Cons Great implementation of Infrastructure as Code concept. Declarative syntax Ability to "plan" and "apply" configs. Apply actually executes the changes. Supports various cloud providers Uses it's own DSL called the Hashicorp Configuration Language State files store secrets in plain text which is a bad idea when you push it to version-control. Product is still maturing and there are some design limitation