SlideShare une entreprise Scribd logo
How to write
cloud-agnostic
Terraform code
Giulio Vian
21/22 October 2020
Why this session?
Image by Sammy Williams
Assumption #1:
You know Terraform
Assumption #2:
Terraform ≥0.13
Code is provider specific: AWS
Code is provider specific: Azure
Abstraction
Cross-cutting services
Region
Cross-cutting services
Global
Networking
services
Networking
Networking
Computing &
Data
Blocks
Computing &
Data
Blocks
Abstract the architecture
Cross-cutting services
Region
Networking
Networking
Computing &
Data
Blocks
Computing &
Data
Blocks
Region
Computing Block Function as a
Service
Container as a
Service
Platform as a
Service
Inside a Component
Virtual
Machine
Instance
Stateless Firewall (IP/Port restriction)
Load Balancer
Subnet(s)
Enough slides
Enough slides
Goodies #1
count
module azure {
source = "../vm"
count = var.platform == "vm"
? 1 : 0
}
Goodies #2
variable location {
type = object({
cloud = string,
geography = string,
section = string
})
}
Goodies #4
variable platform {
type = string
validation {
condition = can(contains([
"vm", "k8s"], var.platform))
error_message = "Only "vm
" and "k8s" are supported."
}}
Goodies #3
region
provider "aws" {
region = local.primary
}
Goodies #5
data aws_subnet app_subnet {
filter {
name = "tag:Name"
values = [var.subnet_name]
}
}
Links
https://www.terraform.io/
Y.Brikman, Terraform - Up and Running, O′Reilly
(2019, 2nd ed.) https://www.amazon.co.uk/dp/1492046906
https://docs.microsoft.com/en-us/azure/architecture/aws-
professional/services
https://docs.microsoft.com/en-us/azure/architecture/gcp-
professional/services
https://github.com/giuliov/terraform-fun
https://www.slideshare.net/giuliov
Hardware spec:
1 KB RAM
(16KB after upgrade)
4 KB ROM
(8KB after upgrade)
First computer Past Companies Communities
Giulio Vian Senior DevOps Engineer
Address
giulio.dev@casavian.eu
@giulio_vian
https://www.slideshare.net/giuliov
http://blog.casavian.eu
https://medium.com/@giuliovdev
https://github.com/giuliov
End of trasmissions
21

Contenu connexe

Similaire à How to write cloud-agnostic Terraform code - Incontro DevOps Italia 2020

(BAC404) Deploying High Availability and Disaster Recovery Architectures with...
(BAC404) Deploying High Availability and Disaster Recovery Architectures with...(BAC404) Deploying High Availability and Disaster Recovery Architectures with...
(BAC404) Deploying High Availability and Disaster Recovery Architectures with...
Amazon Web Services
 
AWS re:Invent 2016: NEW LAUNCH! Introducing AWS Greengrass (IOT201)
AWS re:Invent 2016: NEW LAUNCH! Introducing AWS Greengrass (IOT201)AWS re:Invent 2016: NEW LAUNCH! Introducing AWS Greengrass (IOT201)
AWS re:Invent 2016: NEW LAUNCH! Introducing AWS Greengrass (IOT201)
Amazon Web Services
 
Deploying Cloud Native Red Team Infrastructure with Kubernetes, Istio and Envoy
Deploying Cloud Native Red Team Infrastructure with Kubernetes, Istio and Envoy Deploying Cloud Native Red Team Infrastructure with Kubernetes, Istio and Envoy
Deploying Cloud Native Red Team Infrastructure with Kubernetes, Istio and Envoy
Jeffrey Holden
 
Azure IoT & ML Recap - 20180503
Azure IoT & ML Recap - 20180503Azure IoT & ML Recap - 20180503
Azure IoT & ML Recap - 20180503
Jamie (Taka) Wang
 
Architectural solutions for the cloud
Architectural solutions for the cloudArchitectural solutions for the cloud
Architectural solutions for the cloud
threesixty
 
AWS IoT & ML Recap - 20180423
AWS IoT & ML Recap - 20180423AWS IoT & ML Recap - 20180423
AWS IoT & ML Recap - 20180423
Jamie (Taka) Wang
 
Introduction To Cloud Computing
Introduction To Cloud ComputingIntroduction To Cloud Computing
Introduction To Cloud Computing
Rinat Shagisultanov
 
New Design Patterns in Microservice Solutions
New Design Patterns in Microservice SolutionsNew Design Patterns in Microservice Solutions
New Design Patterns in Microservice Solutions
Michel Burger
 
Deploying AWS IoT-managed devices in an industrial setting - SVC302 - Atlanta...
Deploying AWS IoT-managed devices in an industrial setting - SVC302 - Atlanta...Deploying AWS IoT-managed devices in an industrial setting - SVC302 - Atlanta...
Deploying AWS IoT-managed devices in an industrial setting - SVC302 - Atlanta...
Amazon Web Services
 
Iot Conference Berlin M2M,IoT, device management: one protocol to rule them all?
Iot Conference Berlin M2M,IoT, device management: one protocol to rule them all?Iot Conference Berlin M2M,IoT, device management: one protocol to rule them all?
Iot Conference Berlin M2M,IoT, device management: one protocol to rule them all?
Julien Vermillard
 
Azure webinar kolkata
Azure webinar kolkata Azure webinar kolkata
Azure webinar kolkata
Sumantro Mukherjee
 
Teridion Overview
Teridion OverviewTeridion Overview
Teridion Overview
Bill Zajac
 
게임을 위한 Cloud Native on AWS (김일호 솔루션즈 아키텍트, AWS) :: Gaming on AWS 2018
게임을 위한 Cloud Native on AWS (김일호 솔루션즈 아키텍트, AWS) :: Gaming on AWS 2018게임을 위한 Cloud Native on AWS (김일호 솔루션즈 아키텍트, AWS) :: Gaming on AWS 2018
게임을 위한 Cloud Native on AWS (김일호 솔루션즈 아키텍트, AWS) :: Gaming on AWS 2018
Amazon Web Services Korea
 
Cld006 azure v_net___express_route_最新情報
Cld006 azure v_net___express_route_最新情報Cld006 azure v_net___express_route_最新情報
Cld006 azure v_net___express_route_最新情報
Tech Summit 2016
 
Apollo Cloud Edge Solution - 20180518
Apollo Cloud Edge Solution - 20180518Apollo Cloud Edge Solution - 20180518
Apollo Cloud Edge Solution - 20180518
Jamie (Taka) Wang
 
What Is Happening At The Edge
What Is Happening At The EdgeWhat Is Happening At The Edge
What Is Happening At The Edge
Amazon Web Services
 
AWS BaseCamp: AWS Architecture Fundamentals
AWS BaseCamp: AWS  Architecture FundamentalsAWS BaseCamp: AWS  Architecture Fundamentals
AWS BaseCamp: AWS Architecture Fundamentals
Nicole Maus
 
AWS SSA Webinar 7 - Getting Started on AWS
AWS SSA Webinar 7 - Getting Started on AWSAWS SSA Webinar 7 - Getting Started on AWS
AWS SSA Webinar 7 - Getting Started on AWS
Cobus Bernard
 
Cld006 azure v_net___express_route_最新情報
Cld006 azure v_net___express_route_最新情報Cld006 azure v_net___express_route_最新情報
Cld006 azure v_net___express_route_最新情報
Tech Summit 2016
 
Data Capture in IBM WebSphere Premises Server - Aldo Eisma, IBM
Data Capture in IBM WebSphere Premises Server - Aldo Eisma, IBMData Capture in IBM WebSphere Premises Server - Aldo Eisma, IBM
Data Capture in IBM WebSphere Premises Server - Aldo Eisma, IBM
mfrancis
 

Similaire à How to write cloud-agnostic Terraform code - Incontro DevOps Italia 2020 (20)

(BAC404) Deploying High Availability and Disaster Recovery Architectures with...
(BAC404) Deploying High Availability and Disaster Recovery Architectures with...(BAC404) Deploying High Availability and Disaster Recovery Architectures with...
(BAC404) Deploying High Availability and Disaster Recovery Architectures with...
 
AWS re:Invent 2016: NEW LAUNCH! Introducing AWS Greengrass (IOT201)
AWS re:Invent 2016: NEW LAUNCH! Introducing AWS Greengrass (IOT201)AWS re:Invent 2016: NEW LAUNCH! Introducing AWS Greengrass (IOT201)
AWS re:Invent 2016: NEW LAUNCH! Introducing AWS Greengrass (IOT201)
 
Deploying Cloud Native Red Team Infrastructure with Kubernetes, Istio and Envoy
Deploying Cloud Native Red Team Infrastructure with Kubernetes, Istio and Envoy Deploying Cloud Native Red Team Infrastructure with Kubernetes, Istio and Envoy
Deploying Cloud Native Red Team Infrastructure with Kubernetes, Istio and Envoy
 
Azure IoT & ML Recap - 20180503
Azure IoT & ML Recap - 20180503Azure IoT & ML Recap - 20180503
Azure IoT & ML Recap - 20180503
 
Architectural solutions for the cloud
Architectural solutions for the cloudArchitectural solutions for the cloud
Architectural solutions for the cloud
 
AWS IoT & ML Recap - 20180423
AWS IoT & ML Recap - 20180423AWS IoT & ML Recap - 20180423
AWS IoT & ML Recap - 20180423
 
Introduction To Cloud Computing
Introduction To Cloud ComputingIntroduction To Cloud Computing
Introduction To Cloud Computing
 
New Design Patterns in Microservice Solutions
New Design Patterns in Microservice SolutionsNew Design Patterns in Microservice Solutions
New Design Patterns in Microservice Solutions
 
Deploying AWS IoT-managed devices in an industrial setting - SVC302 - Atlanta...
Deploying AWS IoT-managed devices in an industrial setting - SVC302 - Atlanta...Deploying AWS IoT-managed devices in an industrial setting - SVC302 - Atlanta...
Deploying AWS IoT-managed devices in an industrial setting - SVC302 - Atlanta...
 
Iot Conference Berlin M2M,IoT, device management: one protocol to rule them all?
Iot Conference Berlin M2M,IoT, device management: one protocol to rule them all?Iot Conference Berlin M2M,IoT, device management: one protocol to rule them all?
Iot Conference Berlin M2M,IoT, device management: one protocol to rule them all?
 
Azure webinar kolkata
Azure webinar kolkata Azure webinar kolkata
Azure webinar kolkata
 
Teridion Overview
Teridion OverviewTeridion Overview
Teridion Overview
 
게임을 위한 Cloud Native on AWS (김일호 솔루션즈 아키텍트, AWS) :: Gaming on AWS 2018
게임을 위한 Cloud Native on AWS (김일호 솔루션즈 아키텍트, AWS) :: Gaming on AWS 2018게임을 위한 Cloud Native on AWS (김일호 솔루션즈 아키텍트, AWS) :: Gaming on AWS 2018
게임을 위한 Cloud Native on AWS (김일호 솔루션즈 아키텍트, AWS) :: Gaming on AWS 2018
 
Cld006 azure v_net___express_route_最新情報
Cld006 azure v_net___express_route_最新情報Cld006 azure v_net___express_route_最新情報
Cld006 azure v_net___express_route_最新情報
 
Apollo Cloud Edge Solution - 20180518
Apollo Cloud Edge Solution - 20180518Apollo Cloud Edge Solution - 20180518
Apollo Cloud Edge Solution - 20180518
 
What Is Happening At The Edge
What Is Happening At The EdgeWhat Is Happening At The Edge
What Is Happening At The Edge
 
AWS BaseCamp: AWS Architecture Fundamentals
AWS BaseCamp: AWS  Architecture FundamentalsAWS BaseCamp: AWS  Architecture Fundamentals
AWS BaseCamp: AWS Architecture Fundamentals
 
AWS SSA Webinar 7 - Getting Started on AWS
AWS SSA Webinar 7 - Getting Started on AWSAWS SSA Webinar 7 - Getting Started on AWS
AWS SSA Webinar 7 - Getting Started on AWS
 
Cld006 azure v_net___express_route_最新情報
Cld006 azure v_net___express_route_最新情報Cld006 azure v_net___express_route_最新情報
Cld006 azure v_net___express_route_最新情報
 
Data Capture in IBM WebSphere Premises Server - Aldo Eisma, IBM
Data Capture in IBM WebSphere Premises Server - Aldo Eisma, IBMData Capture in IBM WebSphere Premises Server - Aldo Eisma, IBM
Data Capture in IBM WebSphere Premises Server - Aldo Eisma, IBM
 

Plus de Giulio Vian

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

Plus de Giulio Vian (20)

Come implementare la governance nella vostra piattaforma e lavorare felici se...
Come implementare la governance nella vostra piattaforma e lavorare felici se...Come implementare la governance nella vostra piattaforma e lavorare felici se...
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?Is Technical Debt the right metaphor for Continuous Update?
Is Technical Debt the right metaphor for Continuous Update?
 
Is Technical Debt the right metaphor for Continuous Update - AllDayDevOps 2022
Is Technical Debt the right metaphor for Continuous Update - AllDayDevOps 2022Is Technical Debt the right metaphor for Continuous Update - AllDayDevOps 2022
Is Technical Debt the right metaphor for Continuous Update - AllDayDevOps 2022
 
Software rotting - DevOpsCon Berlin
Software rotting - DevOpsCon BerlinSoftware rotting - DevOpsCon Berlin
Software rotting - DevOpsCon Berlin
 
Software rotting
Software rottingSoftware rotting
Software rotting
 
Software rotting - 28 Apr - DeveloperWeek Europe 2022
Software rotting - 28 Apr - DeveloperWeek Europe 2022Software rotting - 28 Apr - DeveloperWeek Europe 2022
Software rotting - 28 Apr - DeveloperWeek Europe 2022
 
L'impatto della sicurezza su DevOps
L'impatto della sicurezza su DevOpsL'impatto della sicurezza su DevOps
L'impatto della sicurezza su DevOps
 
L'impatto della sicurezza su DevOps
L'impatto della sicurezza su DevOpsL'impatto della sicurezza su DevOps
L'impatto della sicurezza su DevOps
 
A map for DevOps on Microsoft Stack - MS DevSummit
A map for DevOps on Microsoft Stack - MS DevSummitA map for DevOps on Microsoft Stack - MS DevSummit
A map for DevOps on Microsoft Stack - MS DevSummit
 
Perché è così difficile il deploy dei database - DevCast DevOps Serie
Perché è così difficile il deploy dei database  - DevCast DevOps SeriePerché è così difficile il deploy dei database  - DevCast DevOps Serie
Perché è così difficile il deploy dei database - DevCast DevOps Serie
 
Database deployments - dotnetsheff
Database deployments - dotnetsheffDatabase deployments - dotnetsheff
Database deployments - dotnetsheff
 
Database deployment: still hard after all these years - Data Saturday #1
Database deployment: still hard after all these years - Data Saturday #1Database deployment: still hard after all these years - Data Saturday #1
Database deployment: still hard after all these years - Data Saturday #1
 
Pipeline your Pipelines - 2020 All Day DevOps
Pipeline your Pipelines - 2020 All Day DevOpsPipeline your Pipelines - 2020 All Day DevOps
Pipeline your Pipelines - 2020 All Day DevOps
 
Top 10 pipeline mistakes - dotnetsheff
Top 10 pipeline mistakes - dotnetsheffTop 10 pipeline mistakes - dotnetsheff
Top 10 pipeline mistakes - dotnetsheff
 
Introduction to Terraform with Azure flavor
Introduction to Terraform with Azure flavorIntroduction to Terraform with Azure flavor
Introduction to Terraform with Azure flavor
 
How collaboration works between Dev and Ops - DevOps Agile Testing and Test S...
How collaboration works between Dev and Ops - DevOps Agile Testing and Test S...How collaboration works between Dev and Ops - DevOps Agile Testing and Test S...
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 - ...
Usare SQL Server for Linux e Docker per semplificare i processi di testing - ...Usare SQL Server for Linux e Docker per semplificare i processi di testing - ...
Usare SQL Server for Linux e Docker per semplificare i processi di testing - ...
 
Pipeline your pipelines!
Pipeline your pipelines!Pipeline your pipelines!
Pipeline your pipelines!
 
Why is DevOps vital for my company’s business
Why is DevOps vital for my company’s businessWhy is DevOps vital for my company’s business
Why is DevOps vital for my company’s business
 
Introduzione a GitHub Actions (beta)
Introduzione a GitHub Actions (beta)Introduzione a GitHub Actions (beta)
Introduzione a GitHub Actions (beta)
 

Dernier

SMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API ServiceSMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API Service
Yara Milbes
 
Mobile app Development Services | Drona Infotech
Mobile app Development Services  | Drona InfotechMobile app Development Services  | Drona Infotech
Mobile app Development Services | Drona Infotech
Drona Infotech
 
Malibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed RoundMalibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed Round
sjcobrien
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
Quickdice ERP
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
rodomar2
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
ToXSL Technologies
 
socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
SOCRadar
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
dakas1
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
Grant Fritchey
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Julian Hyde
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
Sven Peters
 
zOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL DifferenceszOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL Differences
YousufSait3
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
Rakesh Kumar R
 
316895207-SAP-Oil-and-Gas-Downstream-Training.pptx
316895207-SAP-Oil-and-Gas-Downstream-Training.pptx316895207-SAP-Oil-and-Gas-Downstream-Training.pptx
316895207-SAP-Oil-and-Gas-Downstream-Training.pptx
ssuserad3af4
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
Peter Muessig
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
Hornet Dynamics
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 
Lecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptxLecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptx
TaghreedAltamimi
 

Dernier (20)

SMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API ServiceSMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API Service
 
Mobile app Development Services | Drona Infotech
Mobile app Development Services  | Drona InfotechMobile app Development Services  | Drona Infotech
Mobile app Development Services | Drona Infotech
 
Malibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed RoundMalibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed Round
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
 
socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
 
zOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL DifferenceszOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL Differences
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
 
316895207-SAP-Oil-and-Gas-Downstream-Training.pptx
316895207-SAP-Oil-and-Gas-Downstream-Training.pptx316895207-SAP-Oil-and-Gas-Downstream-Training.pptx
316895207-SAP-Oil-and-Gas-Downstream-Training.pptx
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 
Lecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptxLecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptx
 

How to write cloud-agnostic Terraform code - Incontro DevOps Italia 2020

Notes de l'éditeur

  1. Good afternoon everyone, thanks for your time to attend this session We will explore how to abstract our Terraform code from being provider specific and how to leverage a few cool features of Terraform 0.12 and 0.13. So, even if you are not interested in technological agnosticism, you might enjoy a practical example of latest Terraform abilities. All the code is publicly available in GitHub.
  2. I was involved in a customer project and the customer insisted on using two major cloud vendors. This is a common request from big customers: they do not want to put all their eggs in the same basket. Studying the two vendors documentation and knowing Terraform well, I demonstrated the ability to build the same infrastructure on either platforms. How it worked out in the end? that, like most customers, the management is uncomfortable with the multi-cloud concept and opts for a multi-vendor strategy. Different workloads land on different cloud providers. I think that consulting businesses can and should go multi-cloud. In preparing this session, I choose to focus on the most known and used cloud platforms: Amazon AWS and Microsoft Azure. My customer made a different choice then.
  3. Before we move on, there is an important announce. I will not explain the basics of Terraform, because I assume that you know them, at least enough to understand the samples. I hope you discover with me that cloud are more similar than different. But there is more.
  4. The sample code use Terraform 0.13 and will not work with earlier version.
  5. To allocate a Virtual Machine in AWS through Terraform, you write code that is specific for the AWS Provider. In this basic example you ask Terraform to configure an "aws_instance" resource. The fundamental properties to setup a VM are: - the operating system image, it can be a barebone Linux or a full-fledged Oracle instance or a custom configuration you setup yourself; - the computing resources to use, mainly CPU and RAM, but may include GPUs, special networking, special hardware; - how the VM is connected to the network; - and the machine identifier, which in AWS is a special tag. Now, let’s take a look at the equivalent code for Azure.
  6. This is the code to allocate a Ubuntu virtual machine in Azure. You can notice some important differences that we have to smooth out to make our code agnostic. The Region (location) is an explicit parameter, while for AWS it is tied to the provider configuration. The OS image is identified using four keys instead of a single identifier. The networking is quite different as Azure has a separate resource, while AWS is just a property of the instance. The Azure provider requires to specify some settings which have a default value in AWS. Now, given the similarities how do we generalise the code?
  7. "We can solve any problem by introducing an extra level of indirection." I bet this isn’t a real surprise for you, right? In practice, we must abstract the differences between providers through Terraform modules. The module parameters must be provider-neutral and translated to provider-specific values and formats. It is important to pick the right abstractions so that we end up with a rich model where we can define a great deal of details and can combine simple components in a complex ways. My recommendation is a top-down approach.
  8. A top-down approach starts by looking at the overall architecture of our systems and moves down to finer graded components. The diagram illustrates my personal choice for decomposing a system. The Global block contains cross-cutting services like IAM / AAD, that is, users, groups and permissions and networking that connects resources across regions (mostly for a disaster recovery implementation). Within a region, you have a segment which represents an application, living in a distinct part of the network. A segment may represent availability zones too. A Data block can be an S3 bucket / Azure Storage or an RDS / Azure Database instance. Microsoft even has a couple of pages mapping AWS and GCP services to the Azure equivalent. Note that you do not need to abstract every possible component. For examples, networking infrastructure like Express Route (Az) / Direct Connect (AWS) can be setup once and plugged into the abstract modules. Also Terraform data sources are a great help in decoupling modules and abstracting resources. The goal is to minimise the migration effort. Let’s see a bit more details before delving into code.
  9. This is just a decomposition example. A computing block abstracts network and computing resources with tight bounds. For example, an auto-scaling / VM scales set group needs a load balancer; ports must be open for traffic to flow in and out. This abstract block can be further specified to be a serverless (Function/Lambda) resource, or a container (ACI/ECS/Fargate) or a VM. I think this is enough abstract talk, let’s see some concrete example.
  10. The demo code is not a full-blown decomposition. It demonstrates the allocation of a Virtual Machine in either AWS or Azure. (switch to demo)
  11. And this wraps up the demo.
  12. We learned a few things about Terraform 0.13 The count pseudo-argument can be used with modules and this is the best new feature in my opinion.
  13. You can use objects to simplify and reduce the number of module parameters.
  14. Variables can be checked before use and get a meaningful error message when required.
  15. The region of AWS provider can be an expression, dynamically calculated, and you can pass this provider configuration to submodules.
  16. Terraform Data sources are a great way to simplify your modules, reducing coupling and the number of input / output parameters.
  17. This is a bunch of, hopefully, useful links. Terraform documentation. The best known book to learn Terraform. In case you bought the first edition like me, the second edition is finally out. A couple of Microsoft documentation pages listing side by side the equivalent AWS or GCP service. The link of the GitHub repository with the complete source code and the link to this presentation’s slides.
  18. Some information on yours truly. I started with poor hardware when writing assembly code was not exceptional. I worked for some companies over the years in quite a few different roles, now I work for Unum, a Fortune 500 insurance company. Recognised by Microsoft with the Most Valuable Professional award in the last 5 years, I like to help communities throughout Europe.
  19. Some information on yours truly. I started with poor hardware when writing assembly code was not exceptional. I worked for some companies over the years in quite a few different roles, now I work for Unum, a Fortune 500 insurance company. Recognised by Microsoft with the Most Valuable Professional award in the last 5 years, I like to help communities throughout Europe.
  20. And here are some references if you want to get in touch with me.