SlideShare a Scribd company logo
1 of 47
DevOps Pro Europe, Vilnius
March 2019
Terraform for Serverless.
Best Practices. Lessons Learned.
DevOps Pro Europe, Vilnius
March 2019
DevOps Landscape. Daily Challenges.
DevOps Pro Europe, Vilnius
March 2019
If That Was Not Enough…
Introducing Serverless Landscape
DevOps Pro Europe, Vilnius
March 2019
Serverless Landscape. Daily Challenges.
DevOps Pro Europe, Vilnius
March 2019
Please excuse my honesty, but...
this feels like
TOO MUCH
to keep up with
DevOps Pro Europe, Vilnius
March 2019
Eugene
ISTRATI
@eistrati
About Presenter
• CTO, Tech Partner @ Mitoc Group
• Ex-AWS, ex-Hearst, ex-GrubHub
• Certified AWS Solutions Architect
• 20 Years in IT; 10 Years in Cloud
Computing; 5 Years in Enterprise IT
• Focusing on: Automation, DevOps,
Serverless
DevOps Pro Europe, Vilnius
March 2019
Agenda
Exponential increase
in services and tools
for cloud & serverless
Solution: we are striving
to make IT simpler,
reusable & cloud native
The Devil is in details
DevOps Pro Europe, Vilnius
March 2019
We Are Striving To…
Make IT Simpler
DevOps Pro Europe, Vilnius
March 2019
We Are Striving To…
Make IT Simpler
Yeah, Good Luck With That! 
DevOps Pro Europe, Vilnius
March 2019
DevOps Pro Europe, Vilnius
March 2019
Prerequisites: Terraform For Serverless
1. Understand IT-as-a-Service Spectrum
1. Understand DevOps Spectrum
2. Understand Scope & Boundaries
DevOps Pro Europe, Vilnius
March 2019
1. Understand IT-as-a-Service Spectrum
On-Prem
Data
Application
Databases
Operation System
Virtualization
Physical Servers
Network & Storage
Data Center
Colocation
Data
Application
Databases
Operation System
Virtualization
Physical Servers
Network & Storage
Data Center
Hosting
Data
Application
Databases
Operation System
Virtualization
Physical Servers
Network & Storage
Data Center
IaaS
Data
Application
Databases
Operation System
Virtualization
Physical Servers
Network & Storage
Data Center
PaaS
Data
Application
Databases
Operation System
Virtualization
Physical Servers
Network & Storage
Data Center
SaaS
Data
Application
Databases
Operation System
Virtualization
Physical Servers
Network & Storage
Data Center
Managed by Customer Managed by Provider
DevOps Pro Europe, Vilnius
March 2019
What Is Serverless?
DevOps Pro Europe, Vilnius
March 2019
Serverless in IT-as-a-Service Spectrum
On-Prem
Data
Application
Databases
Operation System
Virtualization
Physical Servers
Network & Storage
Data Center
Colocation
Data
Application
Databases
Operation System
Virtualization
Physical Servers
Network & Storage
Data Center
Hosting
Data
Application
Databases
Operation System
Virtualization
Physical Servers
Network & Storage
Data Center
IaaS
Data
Application
Databases
Operation System
Virtualization
Physical Servers
Network & Storage
Data Center
PaaS
Data
Application
Databases
Operation System
Virtualization
Physical Servers
Network & Storage
Data Center
SaaS
Data
Application
Databases
Operation System
Virtualization
Physical Servers
Network & Storage
Data Center
Managed by Customer Managed by Provider
Serverless Architecture
not in scope
DevOps Pro Europe, Vilnius
March 2019
2. Understand DevOps Spectrum
DevOps Pro Europe, Vilnius
March 2019
3. Understand Scope & Boundaries
A
B C
DevOps Pro Europe, Vilnius
March 2019
Terraform For Serverless
A
B C
B == Terraform
A + B + C == Terraform
For Serverless
DevOps Pro Europe, Vilnius
March 2019
Terraform For Serverless
Best Practices.
Lessons Learned.
DevOps Pro Europe, Vilnius
March 2019
Best Practice #1 (of 8)
Adopt microservices architecture; aim for 1-to-1 relationship
between serverless resources and terraform configurations
DevOps Pro Europe, Vilnius
March 2019
Best Practice #1 (of 8)
Adopt microservices architecture; aim for 1-to-1 relationship
between serverless resources and terraform configurations
DevOps Pro Europe, Vilnius
March 2019
Best Practice #1 (of 8)
Adopt microservices architecture; aim for 1-to-1 relationship
between serverless resources and terraform configurations
DevOps Pro Europe, Vilnius
March 2019
Best Practice #2 (of 8)
Pass variables between resources using terraform remote state
DevOps Pro Europe, Vilnius
March 2019
Best Practice #2 (of 8)
Pass variables between resources using terraform remote state
DevOps Pro Europe, Vilnius
March 2019
Best Practice #2 (of 8)
Pass variables between resources using terraform remote state
DevOps Pro Europe, Vilnius
March 2019
Best Practice #3 (of 8)
Avoid code build using local provisioner or external data; instead
use hooks provided by terraform orchestration tools
DevOps Pro Europe, Vilnius
March 2019
Best Practice #3 (of 8)
Avoid code build using local provisioner or external data; instead
use hooks provided by terraform orchestration tools
DevOps Pro Europe, Vilnius
March 2019
Best Practice #3 (of 8)
Avoid code build using local provisioner or external data; instead
use hooks provided by terraform orchestration tools
DevOps Pro Europe, Vilnius
March 2019
Best Practice #4 (of 8)
Execute in parallel your automated terraform workflows; don’t
ignore terraform configurations dependencies
DevOps Pro Europe, Vilnius
March 2019
Best Practice #4 (of 8)
Execute in parallel your automated terraform workflows; don’t
ignore terraform configurations dependencies
DevOps Pro Europe, Vilnius
March 2019
Best Practice #4 (of 8)
Execute in parallel your automated terraform workflows; don’t
ignore terraform configurations dependencies
DevOps Pro Europe, Vilnius
March 2019
Best Practice #5 (of 8)
Optimize automated terraform workflows with git diff
DevOps Pro Europe, Vilnius
March 2019
Best Practice #5 (of 8)
Optimize automated terraform workflows with git diff
DevOps Pro Europe, Vilnius
March 2019
Best Practice #5 (of 8)
Optimize automated terraform workflows with git diff
DevOps Pro Europe, Vilnius
March 2019
Best Practice #6 (of 8)
Logically separate environments using terraform workspace
DevOps Pro Europe, Vilnius
March 2019
Best Practice #6 (of 8)
Logically separate environments using terraform workspace
dev == default
DevOps Pro Europe, Vilnius
March 2019
Best Practice #6 (of 8)
Logically separate environments using terraform workspace
dev == default
DevOps Pro Europe, Vilnius
March 2019
Best Practice #7 (of 8)
Overwrite environment specific values using variables precedence
DevOps Pro Europe, Vilnius
March 2019
Best Practice #7 (of 8)
Overwrite environment specific values using variables precedence
https://www.terraform.io/docs/configuration/variabl
es.html#variable-precedence
DevOps Pro Europe, Vilnius
March 2019
Best Practice #7 (of 8)
Overwrite environment specific values using variables precedence
https://www.terraform.io/docs/configuration/variabl
es.html#variable-precedence
DevOps Pro Europe, Vilnius
March 2019
Best Practice #8 (of 8)
Get comfortable with lots of terraform code; or use terrahub cli
DevOps Pro Europe, Vilnius
March 2019
Best Practice #8 (of 8)
Get comfortable with lots of terraform code; or use terrahub cli
$ find . -name ‘*.tf*’ | xargs wc -l | grep total
33998 total
$ find . -name ‘.terrahub*.yml’ | xargs wc -l | grep total
22118 total
DevOps Pro Europe, Vilnius
March 2019
Best Practice #8 (of 8)
Get comfortable with lots of terraform code; or use terrahub cli
$ find . -name ‘*.tf*’ | xargs wc -l | grep total
33998 total
$ find . -name ‘.terrahub*.yml’ | xargs wc -l | grep total
22118 total
DevOps Pro Europe, Vilnius
March 2019
Best Practices Summary
1. Adopt microservices architecture; aim for 1-to-1 relationship
1. Pass variables between resources using terraform remote state
1. Avoid code build using local provisioner or external data
1. Execute in parallel your automated terraform workflows; don’t ignore
terraform configurations dependencies
1. Optimize automated terraform workflows with git diff
1. Logically separate environments using terraform workspace
1. Overwrite environment specific values using variables precedence
1. Get comfortable with lots of terraform code; or use terrahub cli
DevOps Pro Europe, Vilnius
March 2019
Lessons Learned Summary
1. Adopt microservices architecture; aim for 1-to-1 relationship
1. Pass variables between resources using terraform remote state
1. Avoid code build using local provisioner or external data
1. Execute in parallel your automated terraform workflows; don’t ignore
terraform configurations dependencies
1. Optimize automated terraform workflows with git diff
1. Logically separate environments using terraform workspace
1. Overwrite environment specific values using variables precedence
1. Get comfortable with lots of terraform code; or use terrahub cli
https://github.com/TerraHubCorp
/terrahub
DevOps Pro Europe, Vilnius
March 2019
Terraform For Serverless
DEMO
https://github.com/TerraHubCorp/demo-
terraform-automation-aws
DevOps Pro Europe, Vilnius
March 2019
DevOps Pro Europe, Vilnius
March 2019
Terraform for Serverless.
Best Practices. Lessons Learned.
Eugene Istrati @eistrati
eugene@mitocgroup.com
Thank You!

More Related Content

Similar to Terraform for Serverless - Best Practices

Smau Milano 2016 - Michele Finelli
Smau Milano 2016 - Michele FinelliSmau Milano 2016 - Michele Finelli
Smau Milano 2016 - Michele FinelliSMAU
 
How open source is driving DevOps innovation: CloudOpen NA 2015
How open source is driving DevOps innovation: CloudOpen NA 2015How open source is driving DevOps innovation: CloudOpen NA 2015
How open source is driving DevOps innovation: CloudOpen NA 2015Gordon Haff
 
Gerrit Analytics applied to Android source code
Gerrit Analytics applied to Android source codeGerrit Analytics applied to Android source code
Gerrit Analytics applied to Android source codeLuca Milanesio
 
DevOps: buzzword o potenzialità?
DevOps: buzzword o potenzialità?DevOps: buzzword o potenzialità?
DevOps: buzzword o potenzialità?festival ICT 2016
 
Dipping Your Toes Into Cloud Native Application Development
Dipping Your Toes Into Cloud Native Application DevelopmentDipping Your Toes Into Cloud Native Application Development
Dipping Your Toes Into Cloud Native Application DevelopmentMatthew Farina
 
Going Cloud Native with Cloud Foundry
Going Cloud Native with Cloud FoundryGoing Cloud Native with Cloud Foundry
Going Cloud Native with Cloud FoundryChip Childers
 
Next Level DevOps Implementation with GitOps
Next Level DevOps Implementation with GitOpsNext Level DevOps Implementation with GitOps
Next Level DevOps Implementation with GitOpsRamadoni Ashudi
 
StackEngine Problem Space Demo
StackEngine Problem Space DemoStackEngine Problem Space Demo
StackEngine Problem Space DemoBoyd Hemphill
 
Kubecon SIG Apps December 2017 Update
Kubecon SIG Apps December 2017 UpdateKubecon SIG Apps December 2017 Update
Kubecon SIG Apps December 2017 UpdateMatthew Farina
 
Introduction to Devops (Melbourne University)
Introduction to Devops (Melbourne University)Introduction to Devops (Melbourne University)
Introduction to Devops (Melbourne University)Javier Turégano Molina
 
Cloud native past, present and future
Cloud native past, present and futureCloud native past, present and future
Cloud native past, present and futureCheryl Hung
 
DevOps Transformation in Microsoft – Case Study by Ognjen Bajic and Ana Roje ...
DevOps Transformation in Microsoft – Case Study by Ognjen Bajic and Ana Roje ...DevOps Transformation in Microsoft – Case Study by Ognjen Bajic and Ana Roje ...
DevOps Transformation in Microsoft – Case Study by Ognjen Bajic and Ana Roje ...Bosnia Agile
 
Lessons learned from 3 years inside cncf - WTF is Cloud Native, 4 September 2021
Lessons learned from 3 years inside cncf - WTF is Cloud Native, 4 September 2021Lessons learned from 3 years inside cncf - WTF is Cloud Native, 4 September 2021
Lessons learned from 3 years inside cncf - WTF is Cloud Native, 4 September 2021Cheryl Hung
 
Facilitez votre transition DevOps grâce à l'automatisation de votre infras...
 Facilitez votre transition DevOps grâce à l'automatisation de votre infras... Facilitez votre transition DevOps grâce à l'automatisation de votre infras...
Facilitez votre transition DevOps grâce à l'automatisation de votre infras...VMware Tanzu
 
Terraform: Taming the Machines Through Continuous Integration
Terraform: Taming the Machines Through Continuous IntegrationTerraform: Taming the Machines Through Continuous Integration
Terraform: Taming the Machines Through Continuous IntegrationJustin Rice
 
Deep Learning State of the Art (2019) - MIT by Lex Fridman
Deep Learning State of the Art (2019) - MIT by Lex FridmanDeep Learning State of the Art (2019) - MIT by Lex Fridman
Deep Learning State of the Art (2019) - MIT by Lex FridmanPeerasak C.
 
Deep learning state_of_the_art- Autonomous Driving
Deep learning state_of_the_art- Autonomous DrivingDeep learning state_of_the_art- Autonomous Driving
Deep learning state_of_the_art- Autonomous DrivingAlok Jain
 
Containers, Serverless, Polyglot Development World, And Others…10 trends resh...
Containers, Serverless, Polyglot Development World, And Others…10 trends resh...Containers, Serverless, Polyglot Development World, And Others…10 trends resh...
Containers, Serverless, Polyglot Development World, And Others…10 trends resh...PROIDEA
 

Similar to Terraform for Serverless - Best Practices (20)

Smau Milano 2016 - Michele Finelli
Smau Milano 2016 - Michele FinelliSmau Milano 2016 - Michele Finelli
Smau Milano 2016 - Michele Finelli
 
How open source is driving DevOps innovation: CloudOpen NA 2015
How open source is driving DevOps innovation: CloudOpen NA 2015How open source is driving DevOps innovation: CloudOpen NA 2015
How open source is driving DevOps innovation: CloudOpen NA 2015
 
Gerrit Analytics applied to Android source code
Gerrit Analytics applied to Android source codeGerrit Analytics applied to Android source code
Gerrit Analytics applied to Android source code
 
DevOps: buzzword o potenzialità?
DevOps: buzzword o potenzialità?DevOps: buzzword o potenzialità?
DevOps: buzzword o potenzialità?
 
Dipping Your Toes Into Cloud Native Application Development
Dipping Your Toes Into Cloud Native Application DevelopmentDipping Your Toes Into Cloud Native Application Development
Dipping Your Toes Into Cloud Native Application Development
 
Going Cloud Native with Cloud Foundry
Going Cloud Native with Cloud FoundryGoing Cloud Native with Cloud Foundry
Going Cloud Native with Cloud Foundry
 
Next Level DevOps Implementation with GitOps
Next Level DevOps Implementation with GitOpsNext Level DevOps Implementation with GitOps
Next Level DevOps Implementation with GitOps
 
StackEngine Problem Space Demo
StackEngine Problem Space DemoStackEngine Problem Space Demo
StackEngine Problem Space Demo
 
Kubecon SIG Apps December 2017 Update
Kubecon SIG Apps December 2017 UpdateKubecon SIG Apps December 2017 Update
Kubecon SIG Apps December 2017 Update
 
Introduction to Devops (Melbourne University)
Introduction to Devops (Melbourne University)Introduction to Devops (Melbourne University)
Introduction to Devops (Melbourne University)
 
Cloud native past, present and future
Cloud native past, present and futureCloud native past, present and future
Cloud native past, present and future
 
DevOps Transformation in Microsoft – Case Study by Ognjen Bajic and Ana Roje ...
DevOps Transformation in Microsoft – Case Study by Ognjen Bajic and Ana Roje ...DevOps Transformation in Microsoft – Case Study by Ognjen Bajic and Ana Roje ...
DevOps Transformation in Microsoft – Case Study by Ognjen Bajic and Ana Roje ...
 
Lessons learned from 3 years inside cncf - WTF is Cloud Native, 4 September 2021
Lessons learned from 3 years inside cncf - WTF is Cloud Native, 4 September 2021Lessons learned from 3 years inside cncf - WTF is Cloud Native, 4 September 2021
Lessons learned from 3 years inside cncf - WTF is Cloud Native, 4 September 2021
 
Facilitez votre transition DevOps grâce à l'automatisation de votre infras...
 Facilitez votre transition DevOps grâce à l'automatisation de votre infras... Facilitez votre transition DevOps grâce à l'automatisation de votre infras...
Facilitez votre transition DevOps grâce à l'automatisation de votre infras...
 
What makes python 3.11 special
What makes python 3.11 special What makes python 3.11 special
What makes python 3.11 special
 
Terraform: Taming the Machines Through Continuous Integration
Terraform: Taming the Machines Through Continuous IntegrationTerraform: Taming the Machines Through Continuous Integration
Terraform: Taming the Machines Through Continuous Integration
 
Deep Learning State of the Art (2019) - MIT by Lex Fridman
Deep Learning State of the Art (2019) - MIT by Lex FridmanDeep Learning State of the Art (2019) - MIT by Lex Fridman
Deep Learning State of the Art (2019) - MIT by Lex Fridman
 
Deep learning state_of_the_art- Autonomous Driving
Deep learning state_of_the_art- Autonomous DrivingDeep learning state_of_the_art- Autonomous Driving
Deep learning state_of_the_art- Autonomous Driving
 
Oracle Analytics.pptx
Oracle Analytics.pptxOracle Analytics.pptx
Oracle Analytics.pptx
 
Containers, Serverless, Polyglot Development World, And Others…10 trends resh...
Containers, Serverless, Polyglot Development World, And Others…10 trends resh...Containers, Serverless, Polyglot Development World, And Others…10 trends resh...
Containers, Serverless, Polyglot Development World, And Others…10 trends resh...
 

More from Mitoc Group

Hands-on with the Terraform Module for AWS Landing Zone Indy Cloud Conf 2020
Hands-on with the Terraform Module for AWS Landing Zone Indy Cloud Conf 2020Hands-on with the Terraform Module for AWS Landing Zone Indy Cloud Conf 2020
Hands-on with the Terraform Module for AWS Landing Zone Indy Cloud Conf 2020Mitoc Group
 
Hands-On Terraform Module for AWS Landing Zone at HashiTalks2020
Hands-On Terraform Module for AWS Landing Zone at HashiTalks2020Hands-On Terraform Module for AWS Landing Zone at HashiTalks2020
Hands-On Terraform Module for AWS Landing Zone at HashiTalks2020Mitoc Group
 
The Ultimate Publisher's Need-to-Know Guide to Ad Blockers
The Ultimate Publisher's Need-to-Know Guide to Ad BlockersThe Ultimate Publisher's Need-to-Know Guide to Ad Blockers
The Ultimate Publisher's Need-to-Know Guide to Ad BlockersMitoc Group
 
How Serverless Computing Enables Microservices and Micropayment
How Serverless Computing Enables Microservices and Micropayment  How Serverless Computing Enables Microservices and Micropayment
How Serverless Computing Enables Microservices and Micropayment Mitoc Group
 
How Serverless Computing Enables Microservices and Micropayment
How Serverless Computing Enables Microservices and Micropayment  How Serverless Computing Enables Microservices and Micropayment
How Serverless Computing Enables Microservices and Micropayment Mitoc Group
 
Serverless Microservices - Real life story of a Web App that uses AngularJS, ...
Serverless Microservices - Real life story of a Web App that uses AngularJS, ...Serverless Microservices - Real life story of a Web App that uses AngularJS, ...
Serverless Microservices - Real life story of a Web App that uses AngularJS, ...Mitoc Group
 
Building Scalable Web Applications using Microservices Architecture and Serve...
Building Scalable Web Applications using Microservices Architecture and Serve...Building Scalable Web Applications using Microservices Architecture and Serve...
Building Scalable Web Applications using Microservices Architecture and Serve...Mitoc Group
 
Building Scalable Web Applications using Microservices Architecture and NodeJ...
Building Scalable Web Applications using Microservices Architecture and NodeJ...Building Scalable Web Applications using Microservices Architecture and NodeJ...
Building Scalable Web Applications using Microservices Architecture and NodeJ...Mitoc Group
 
Serverless Microservices - Real life story of a Web App that uses AWS Lambda
Serverless Microservices - Real life story of a Web App that uses AWS LambdaServerless Microservices - Real life story of a Web App that uses AWS Lambda
Serverless Microservices - Real life story of a Web App that uses AWS LambdaMitoc Group
 
Microservices Architecture for Content Management Systems using AWS Lambda an...
Microservices Architecture for Content Management Systems using AWS Lambda an...Microservices Architecture for Content Management Systems using AWS Lambda an...
Microservices Architecture for Content Management Systems using AWS Lambda an...Mitoc Group
 
Microservices Architecture for Web Applications using Serverless Computing wi...
Microservices Architecture for Web Applications using Serverless Computing wi...Microservices Architecture for Web Applications using Serverless Computing wi...
Microservices Architecture for Web Applications using Serverless Computing wi...Mitoc Group
 
Microservices Architecture for Web Applications using AWS Lambda and more
Microservices Architecture for Web Applications using AWS Lambda and moreMicroservices Architecture for Web Applications using AWS Lambda and more
Microservices Architecture for Web Applications using AWS Lambda and moreMitoc Group
 
Microservices Architecture for Web Applications using Amazon AWS Cloud
Microservices Architecture for Web Applications using Amazon AWS CloudMicroservices Architecture for Web Applications using Amazon AWS Cloud
Microservices Architecture for Web Applications using Amazon AWS CloudMitoc Group
 
Microservices Architecture for Content Management Systems using AWS Lambda an...
Microservices Architecture for Content Management Systems using AWS Lambda an...Microservices Architecture for Content Management Systems using AWS Lambda an...
Microservices Architecture for Content Management Systems using AWS Lambda an...Mitoc Group
 
Microservices Architecture for Digital Platforms using Serverless AWS
Microservices Architecture for Digital Platforms using Serverless AWSMicroservices Architecture for Digital Platforms using Serverless AWS
Microservices Architecture for Digital Platforms using Serverless AWSMitoc Group
 
Microservices Architecture for MEAN Applications using Serverless AWS
Microservices Architecture for MEAN Applications using Serverless AWSMicroservices Architecture for MEAN Applications using Serverless AWS
Microservices Architecture for MEAN Applications using Serverless AWSMitoc Group
 
Build Web Applications using Microservices on Node.js and Serverless AWS
Build Web Applications using Microservices on Node.js and Serverless AWSBuild Web Applications using Microservices on Node.js and Serverless AWS
Build Web Applications using Microservices on Node.js and Serverless AWSMitoc Group
 
ARC201 Microservices Architecture @ AWS re:Invent 2015
ARC201 Microservices Architecture @ AWS re:Invent 2015ARC201 Microservices Architecture @ AWS re:Invent 2015
ARC201 Microservices Architecture @ AWS re:Invent 2015Mitoc Group
 

More from Mitoc Group (18)

Hands-on with the Terraform Module for AWS Landing Zone Indy Cloud Conf 2020
Hands-on with the Terraform Module for AWS Landing Zone Indy Cloud Conf 2020Hands-on with the Terraform Module for AWS Landing Zone Indy Cloud Conf 2020
Hands-on with the Terraform Module for AWS Landing Zone Indy Cloud Conf 2020
 
Hands-On Terraform Module for AWS Landing Zone at HashiTalks2020
Hands-On Terraform Module for AWS Landing Zone at HashiTalks2020Hands-On Terraform Module for AWS Landing Zone at HashiTalks2020
Hands-On Terraform Module for AWS Landing Zone at HashiTalks2020
 
The Ultimate Publisher's Need-to-Know Guide to Ad Blockers
The Ultimate Publisher's Need-to-Know Guide to Ad BlockersThe Ultimate Publisher's Need-to-Know Guide to Ad Blockers
The Ultimate Publisher's Need-to-Know Guide to Ad Blockers
 
How Serverless Computing Enables Microservices and Micropayment
How Serverless Computing Enables Microservices and Micropayment  How Serverless Computing Enables Microservices and Micropayment
How Serverless Computing Enables Microservices and Micropayment
 
How Serverless Computing Enables Microservices and Micropayment
How Serverless Computing Enables Microservices and Micropayment  How Serverless Computing Enables Microservices and Micropayment
How Serverless Computing Enables Microservices and Micropayment
 
Serverless Microservices - Real life story of a Web App that uses AngularJS, ...
Serverless Microservices - Real life story of a Web App that uses AngularJS, ...Serverless Microservices - Real life story of a Web App that uses AngularJS, ...
Serverless Microservices - Real life story of a Web App that uses AngularJS, ...
 
Building Scalable Web Applications using Microservices Architecture and Serve...
Building Scalable Web Applications using Microservices Architecture and Serve...Building Scalable Web Applications using Microservices Architecture and Serve...
Building Scalable Web Applications using Microservices Architecture and Serve...
 
Building Scalable Web Applications using Microservices Architecture and NodeJ...
Building Scalable Web Applications using Microservices Architecture and NodeJ...Building Scalable Web Applications using Microservices Architecture and NodeJ...
Building Scalable Web Applications using Microservices Architecture and NodeJ...
 
Serverless Microservices - Real life story of a Web App that uses AWS Lambda
Serverless Microservices - Real life story of a Web App that uses AWS LambdaServerless Microservices - Real life story of a Web App that uses AWS Lambda
Serverless Microservices - Real life story of a Web App that uses AWS Lambda
 
Microservices Architecture for Content Management Systems using AWS Lambda an...
Microservices Architecture for Content Management Systems using AWS Lambda an...Microservices Architecture for Content Management Systems using AWS Lambda an...
Microservices Architecture for Content Management Systems using AWS Lambda an...
 
Microservices Architecture for Web Applications using Serverless Computing wi...
Microservices Architecture for Web Applications using Serverless Computing wi...Microservices Architecture for Web Applications using Serverless Computing wi...
Microservices Architecture for Web Applications using Serverless Computing wi...
 
Microservices Architecture for Web Applications using AWS Lambda and more
Microservices Architecture for Web Applications using AWS Lambda and moreMicroservices Architecture for Web Applications using AWS Lambda and more
Microservices Architecture for Web Applications using AWS Lambda and more
 
Microservices Architecture for Web Applications using Amazon AWS Cloud
Microservices Architecture for Web Applications using Amazon AWS CloudMicroservices Architecture for Web Applications using Amazon AWS Cloud
Microservices Architecture for Web Applications using Amazon AWS Cloud
 
Microservices Architecture for Content Management Systems using AWS Lambda an...
Microservices Architecture for Content Management Systems using AWS Lambda an...Microservices Architecture for Content Management Systems using AWS Lambda an...
Microservices Architecture for Content Management Systems using AWS Lambda an...
 
Microservices Architecture for Digital Platforms using Serverless AWS
Microservices Architecture for Digital Platforms using Serverless AWSMicroservices Architecture for Digital Platforms using Serverless AWS
Microservices Architecture for Digital Platforms using Serverless AWS
 
Microservices Architecture for MEAN Applications using Serverless AWS
Microservices Architecture for MEAN Applications using Serverless AWSMicroservices Architecture for MEAN Applications using Serverless AWS
Microservices Architecture for MEAN Applications using Serverless AWS
 
Build Web Applications using Microservices on Node.js and Serverless AWS
Build Web Applications using Microservices on Node.js and Serverless AWSBuild Web Applications using Microservices on Node.js and Serverless AWS
Build Web Applications using Microservices on Node.js and Serverless AWS
 
ARC201 Microservices Architecture @ AWS re:Invent 2015
ARC201 Microservices Architecture @ AWS re:Invent 2015ARC201 Microservices Architecture @ AWS re:Invent 2015
ARC201 Microservices Architecture @ AWS re:Invent 2015
 

Recently uploaded

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
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
 
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
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
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
 
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
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
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
 
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
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
(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
 
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
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 

Recently uploaded (20)

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
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
 
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
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
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...
 
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
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.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
 
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...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
(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...
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
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
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 

Terraform for Serverless - Best Practices

  • 1. DevOps Pro Europe, Vilnius March 2019 Terraform for Serverless. Best Practices. Lessons Learned.
  • 2. DevOps Pro Europe, Vilnius March 2019 DevOps Landscape. Daily Challenges.
  • 3. DevOps Pro Europe, Vilnius March 2019 If That Was Not Enough… Introducing Serverless Landscape
  • 4. DevOps Pro Europe, Vilnius March 2019 Serverless Landscape. Daily Challenges.
  • 5. DevOps Pro Europe, Vilnius March 2019 Please excuse my honesty, but... this feels like TOO MUCH to keep up with
  • 6. DevOps Pro Europe, Vilnius March 2019 Eugene ISTRATI @eistrati About Presenter • CTO, Tech Partner @ Mitoc Group • Ex-AWS, ex-Hearst, ex-GrubHub • Certified AWS Solutions Architect • 20 Years in IT; 10 Years in Cloud Computing; 5 Years in Enterprise IT • Focusing on: Automation, DevOps, Serverless
  • 7. DevOps Pro Europe, Vilnius March 2019 Agenda Exponential increase in services and tools for cloud & serverless Solution: we are striving to make IT simpler, reusable & cloud native The Devil is in details
  • 8. DevOps Pro Europe, Vilnius March 2019 We Are Striving To… Make IT Simpler
  • 9. DevOps Pro Europe, Vilnius March 2019 We Are Striving To… Make IT Simpler Yeah, Good Luck With That! 
  • 10. DevOps Pro Europe, Vilnius March 2019
  • 11. DevOps Pro Europe, Vilnius March 2019 Prerequisites: Terraform For Serverless 1. Understand IT-as-a-Service Spectrum 1. Understand DevOps Spectrum 2. Understand Scope & Boundaries
  • 12. DevOps Pro Europe, Vilnius March 2019 1. Understand IT-as-a-Service Spectrum On-Prem Data Application Databases Operation System Virtualization Physical Servers Network & Storage Data Center Colocation Data Application Databases Operation System Virtualization Physical Servers Network & Storage Data Center Hosting Data Application Databases Operation System Virtualization Physical Servers Network & Storage Data Center IaaS Data Application Databases Operation System Virtualization Physical Servers Network & Storage Data Center PaaS Data Application Databases Operation System Virtualization Physical Servers Network & Storage Data Center SaaS Data Application Databases Operation System Virtualization Physical Servers Network & Storage Data Center Managed by Customer Managed by Provider
  • 13. DevOps Pro Europe, Vilnius March 2019 What Is Serverless?
  • 14. DevOps Pro Europe, Vilnius March 2019 Serverless in IT-as-a-Service Spectrum On-Prem Data Application Databases Operation System Virtualization Physical Servers Network & Storage Data Center Colocation Data Application Databases Operation System Virtualization Physical Servers Network & Storage Data Center Hosting Data Application Databases Operation System Virtualization Physical Servers Network & Storage Data Center IaaS Data Application Databases Operation System Virtualization Physical Servers Network & Storage Data Center PaaS Data Application Databases Operation System Virtualization Physical Servers Network & Storage Data Center SaaS Data Application Databases Operation System Virtualization Physical Servers Network & Storage Data Center Managed by Customer Managed by Provider Serverless Architecture not in scope
  • 15. DevOps Pro Europe, Vilnius March 2019 2. Understand DevOps Spectrum
  • 16. DevOps Pro Europe, Vilnius March 2019 3. Understand Scope & Boundaries A B C
  • 17. DevOps Pro Europe, Vilnius March 2019 Terraform For Serverless A B C B == Terraform A + B + C == Terraform For Serverless
  • 18. DevOps Pro Europe, Vilnius March 2019 Terraform For Serverless Best Practices. Lessons Learned.
  • 19. DevOps Pro Europe, Vilnius March 2019 Best Practice #1 (of 8) Adopt microservices architecture; aim for 1-to-1 relationship between serverless resources and terraform configurations
  • 20. DevOps Pro Europe, Vilnius March 2019 Best Practice #1 (of 8) Adopt microservices architecture; aim for 1-to-1 relationship between serverless resources and terraform configurations
  • 21. DevOps Pro Europe, Vilnius March 2019 Best Practice #1 (of 8) Adopt microservices architecture; aim for 1-to-1 relationship between serverless resources and terraform configurations
  • 22. DevOps Pro Europe, Vilnius March 2019 Best Practice #2 (of 8) Pass variables between resources using terraform remote state
  • 23. DevOps Pro Europe, Vilnius March 2019 Best Practice #2 (of 8) Pass variables between resources using terraform remote state
  • 24. DevOps Pro Europe, Vilnius March 2019 Best Practice #2 (of 8) Pass variables between resources using terraform remote state
  • 25. DevOps Pro Europe, Vilnius March 2019 Best Practice #3 (of 8) Avoid code build using local provisioner or external data; instead use hooks provided by terraform orchestration tools
  • 26. DevOps Pro Europe, Vilnius March 2019 Best Practice #3 (of 8) Avoid code build using local provisioner or external data; instead use hooks provided by terraform orchestration tools
  • 27. DevOps Pro Europe, Vilnius March 2019 Best Practice #3 (of 8) Avoid code build using local provisioner or external data; instead use hooks provided by terraform orchestration tools
  • 28. DevOps Pro Europe, Vilnius March 2019 Best Practice #4 (of 8) Execute in parallel your automated terraform workflows; don’t ignore terraform configurations dependencies
  • 29. DevOps Pro Europe, Vilnius March 2019 Best Practice #4 (of 8) Execute in parallel your automated terraform workflows; don’t ignore terraform configurations dependencies
  • 30. DevOps Pro Europe, Vilnius March 2019 Best Practice #4 (of 8) Execute in parallel your automated terraform workflows; don’t ignore terraform configurations dependencies
  • 31. DevOps Pro Europe, Vilnius March 2019 Best Practice #5 (of 8) Optimize automated terraform workflows with git diff
  • 32. DevOps Pro Europe, Vilnius March 2019 Best Practice #5 (of 8) Optimize automated terraform workflows with git diff
  • 33. DevOps Pro Europe, Vilnius March 2019 Best Practice #5 (of 8) Optimize automated terraform workflows with git diff
  • 34. DevOps Pro Europe, Vilnius March 2019 Best Practice #6 (of 8) Logically separate environments using terraform workspace
  • 35. DevOps Pro Europe, Vilnius March 2019 Best Practice #6 (of 8) Logically separate environments using terraform workspace dev == default
  • 36. DevOps Pro Europe, Vilnius March 2019 Best Practice #6 (of 8) Logically separate environments using terraform workspace dev == default
  • 37. DevOps Pro Europe, Vilnius March 2019 Best Practice #7 (of 8) Overwrite environment specific values using variables precedence
  • 38. DevOps Pro Europe, Vilnius March 2019 Best Practice #7 (of 8) Overwrite environment specific values using variables precedence https://www.terraform.io/docs/configuration/variabl es.html#variable-precedence
  • 39. DevOps Pro Europe, Vilnius March 2019 Best Practice #7 (of 8) Overwrite environment specific values using variables precedence https://www.terraform.io/docs/configuration/variabl es.html#variable-precedence
  • 40. DevOps Pro Europe, Vilnius March 2019 Best Practice #8 (of 8) Get comfortable with lots of terraform code; or use terrahub cli
  • 41. DevOps Pro Europe, Vilnius March 2019 Best Practice #8 (of 8) Get comfortable with lots of terraform code; or use terrahub cli $ find . -name ‘*.tf*’ | xargs wc -l | grep total 33998 total $ find . -name ‘.terrahub*.yml’ | xargs wc -l | grep total 22118 total
  • 42. DevOps Pro Europe, Vilnius March 2019 Best Practice #8 (of 8) Get comfortable with lots of terraform code; or use terrahub cli $ find . -name ‘*.tf*’ | xargs wc -l | grep total 33998 total $ find . -name ‘.terrahub*.yml’ | xargs wc -l | grep total 22118 total
  • 43. DevOps Pro Europe, Vilnius March 2019 Best Practices Summary 1. Adopt microservices architecture; aim for 1-to-1 relationship 1. Pass variables between resources using terraform remote state 1. Avoid code build using local provisioner or external data 1. Execute in parallel your automated terraform workflows; don’t ignore terraform configurations dependencies 1. Optimize automated terraform workflows with git diff 1. Logically separate environments using terraform workspace 1. Overwrite environment specific values using variables precedence 1. Get comfortable with lots of terraform code; or use terrahub cli
  • 44. DevOps Pro Europe, Vilnius March 2019 Lessons Learned Summary 1. Adopt microservices architecture; aim for 1-to-1 relationship 1. Pass variables between resources using terraform remote state 1. Avoid code build using local provisioner or external data 1. Execute in parallel your automated terraform workflows; don’t ignore terraform configurations dependencies 1. Optimize automated terraform workflows with git diff 1. Logically separate environments using terraform workspace 1. Overwrite environment specific values using variables precedence 1. Get comfortable with lots of terraform code; or use terrahub cli https://github.com/TerraHubCorp /terrahub
  • 45. DevOps Pro Europe, Vilnius March 2019 Terraform For Serverless DEMO https://github.com/TerraHubCorp/demo- terraform-automation-aws
  • 46. DevOps Pro Europe, Vilnius March 2019
  • 47. DevOps Pro Europe, Vilnius March 2019 Terraform for Serverless. Best Practices. Lessons Learned. Eugene Istrati @eistrati eugene@mitocgroup.com Thank You!

Editor's Notes

  1. Good afternoon!
  2. This picture describes best what kind of challenges I’m dealing with on a daily basis. And I believe I’m not the only one. But, if you are lucky enough to use only 1 tool or service from each square, please reach out to me at the end, I’ll buy you a drink.
  3. Like that was not enough, welcome to the landscape of serverless.
  4. Invented by AWS, and joined by all other major providers like Microsoft Azure and Google Cloud, serverless is quickly becoming a parallel universe.
  5. Please excuse my honesty but this feels like too much to keep up with, right?
  6. My name is Eugene. I’m the chief technology officer of Mitoc Group. We are cloud native automation company, born in the cloud about the same time when AWS Lambda was launched in preview. These are my credentials.
  7. And today I would like to discuss about how we felt overwhelmed by these constantly evolving services and tools, and what we did in order to keep up with latest emerging solutions that are compatible with legacy, as well as cutting edge technologies. The Devil is in details.
  8. We strive to make IT simpler.
  9. Yeah, right. I hope you’re smiling, otherwise my humor is outdated and I would be in a really awkward situation.
  10. Nevertheless, a smart guy once said: When something is important enough, you do it even if the odds are not in your favor. History shows that he was right.
  11. So, after a short description of the problem and a small explanation into the way we think about this problem, I’ll dive into Terraform for Serverless. Next, let’s make sure that we have the same understanding on the following 3 concepts: IT as a service, DevOps, and overall scope and boundaries.
  12. First, IT as a service spectrum spreads across on-premises, collocation, hosting, infrastructure as a service, platform as a service and software as a service. As you can see, services are more or less the same in every category, but the difference is whether the customer is managing these services or not.
  13. Now, speaking of serverless, I have seen several definitions out there, but my favorite one is this tweet by Netflix former chief architect, nowadays vice president at AWS, Adrian Cockroft. If your platform as a service can efficiently start instances in 20 milliseconds that run for half a second, then call it serverless.
  14. Therefore, in serverless universe, we generally assume and agree among us that PaaS or SaaS are in scope, everything else is out of scope.
  15. Second, DevOps spectrum includes all development operations that we as engineers must go through in order to manage our IT needs end to end. Therefore agile development, CI and CD are part of DevOps, and definitely not optional or out of scope.
  16. And third, if we go back to devops landscape, mark deployment services as A, configuration management and provisioning as B, orchestration and scheduling as C.
  17. Terraform is B, but Terraform for Serverless is a combination of A + B + C.
  18. And there we go. This is the core of our presentation. So thank you for your patience so far. Now we are ready to talk about best practices and lessons learned from using Terraform for Serverless.
  19. Best practice number 1 is to adopt microservices architecture. This might sound trivial to many of you, but I still come across engineers who don’t apply this in practice.
  20. Heads up disclosure: I will provide examples for each best practice. To be clear, these examples are not wrong, but rather an indication that something can be done better. So, in this case of microservices architecture, instead of putting all your resources for a service in 1 terraform configuration file.
  21. Break it down into smaller pieces or components, aim for 1-to-1 relationship between serverless resources and terraform configuration files.
  22. After you break down into microservices, use terraform built in functionality to pass variables between resources. This built in feature is called terraform remote state.
  23. So, if you have 2 services that need to reference to the same variable, instead of hardcoding it in 2 different configuration files...
  24. Define it in service1, enable terraform backend like we do it in this example via S3, expose it in output and reference it in service2 using data terraform remote state.
  25. Third best practice – avoid using local provisioner or external data to execute external scripts. In our experience, it was extremely difficult to identify issues when something goes wrong.
  26. In this example above, data external will trigger the execution of build.js node script every time lambda function resource is created or updated. Fun fact, our team established as an internal rule to avoid this kind of functionality.
  27. Instead, we use terraform orchestration tools like terragrunt, or atlantis, or terrahub – our own home grown orchestration and automation tool.
  28. When we developed serverless applications, we ended up with a lot of terraform components. Unfortunately, automated terraform workflows are not built into this open source tool. Either you do it yourself, use one of previously mentioned orchestration tools or switch to using terraform enterprise.
  29. To be factually correct, I must mention that terraform has a built in option called parallelism, but it does not work across different terraform components.
  30. We ended up adding this feature into terrahub cli. This is one of the most used commands in this tool.
  31. Very often, we don’t need to run automated terraform workflows for all terraform components. So instead of specifying a static list of components, we use git diff to dynamically see what changed between commits or in a specific pull request, and execute automated workflow on the map of components that changed.
  32. Like in the example above. Instead of running automation for all 9 components in my repository...
  33. We used git diff and reduced the list of components down to 2. If you ask me, this is a very nice optimization of almost 80%
  34. One way to separate environments is to have separate code base for each environment. We don’t do that. Instead, we use terraform workspace to logically separate environments.
  35. Like in the example above, instead of keeping 4 different versions of pretty much the same configs for our dev environment, and test, and stage and prod...
  36. We use default terraform workspace as our de facto dev environment and values or variables that change for specific environment, we store them in workspace folder. When using terraform orchestration tools like terrahub cli, switching between environments is as easy as adding --env option in command line.
  37. Another best practice is built around terraform variables precedence.
  38. For example, if you have same variables used across different terraform workspaces, instead of storing the same values across different tfvar files...
  39. We store everything in default tfvar file corresponding to default terraform workspace, and only environment specific values that are different from default terraform workspace, we add them into separate tfvar files. When running terraform commands like plan or apply, default tfvar file comes first and specific tfvar file comes second. Please follow this link to learn more about variable precedence.
  40. And, finally, get used to a lot of terraform. Or don’t.
  41. As you can see in the example above, we have almost 34 thousand lines of code for around 100 terraform components.
  42. But when we switched to YAML based version using terrahub cli, we ended up with a little bit over 22 thousand lines of code. That’s over 30% reduction of the original terraform codebase. Another benefit of using terrahub cli is that we are seamlessly transforming YAML to HCL and the other way around.
  43. To summarize, today we have discussed 8 best practices. All lessons that we have learned while working with terraform for serverless...
  44. We have included them into this open source tool for terraform automation and orchestration called terrahub cli. If you like this project, please show some support and leave us a star on GitHub.
  45. Now, if we have some time left, let’s try to do a demo.
  46. At the end, I’d like to leave you with this quote from Andy Jassy, CEO of AWS. There is no compression algorithm for experience.
  47. Thank You!