SlideShare una empresa de Scribd logo
1 de 20
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

Más contenido relacionado

Similar a 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 - 20180503Jamie (Taka) Wang
 
Architectural solutions for the cloud
Architectural solutions for the cloudArchitectural solutions for the cloud
Architectural solutions for the cloudthreesixty
 
AWS IoT & ML Recap - 20180423
AWS IoT & ML Recap - 20180423AWS IoT & ML Recap - 20180423
AWS IoT & ML Recap - 20180423Jamie (Taka) Wang
 
New Design Patterns in Microservice Solutions
New Design Patterns in Microservice SolutionsNew Design Patterns in Microservice Solutions
New Design Patterns in Microservice SolutionsMichel 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
 
Teridion Overview
Teridion OverviewTeridion Overview
Teridion OverviewBill 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 2018Amazon 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 - 20180518Jamie (Taka) Wang
 
AWS BaseCamp: AWS Architecture Fundamentals
AWS BaseCamp: AWS  Architecture FundamentalsAWS BaseCamp: AWS  Architecture Fundamentals
AWS BaseCamp: AWS Architecture FundamentalsNicole 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 AWSCobus 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, IBMmfrancis
 

Similar a 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
 

Más de 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 2022Giulio Vian
 
Software rotting - DevOpsCon Berlin
Software rotting - DevOpsCon BerlinSoftware rotting - DevOpsCon Berlin
Software rotting - DevOpsCon BerlinGiulio Vian
 
Software rotting
Software rottingSoftware rotting
Software rottingGiulio 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 2022Giulio Vian
 
L'impatto della sicurezza su DevOps
L'impatto della sicurezza su DevOpsL'impatto della sicurezza su DevOps
L'impatto della sicurezza su DevOpsGiulio Vian
 
L'impatto della sicurezza su DevOps
L'impatto della sicurezza su DevOpsL'impatto della sicurezza su DevOps
L'impatto della sicurezza su DevOpsGiulio 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 DevSummitGiulio 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 SerieGiulio Vian
 
Database deployments - dotnetsheff
Database deployments - dotnetsheffDatabase deployments - dotnetsheff
Database deployments - dotnetsheffGiulio 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 #1Giulio 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 DevOpsGiulio Vian
 
Top 10 pipeline mistakes - dotnetsheff
Top 10 pipeline mistakes - dotnetsheffTop 10 pipeline mistakes - dotnetsheff
Top 10 pipeline mistakes - dotnetsheffGiulio Vian
 
Introduction to Terraform with Azure flavor
Introduction to Terraform with Azure flavorIntroduction to Terraform with Azure flavor
Introduction to Terraform with Azure flavorGiulio 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 businessGiulio Vian
 
Introduzione a GitHub Actions (beta)
Introduzione a GitHub Actions (beta)Introduzione a GitHub Actions (beta)
Introduzione a GitHub Actions (beta)Giulio Vian
 
Terraform for Azure Quickstart
Terraform for Azure QuickstartTerraform for Azure Quickstart
Terraform for Azure QuickstartGiulio Vian
 

Más de Giulio Vian (20)

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)
 
Terraform for Azure Quickstart
Terraform for Azure QuickstartTerraform for Azure Quickstart
Terraform for Azure Quickstart
 

Último

DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Intelisync
 

Último (20)

DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)
 

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

Notas del editor

  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.