SlideShare a Scribd company logo
1 of 52
TERRAFORM: TAMING THE
MACHINES WITH
CONTINUOUS
INTEGRATION Justin Rice
Source Code: jsrice7391/tf-talk
Medium: Jsrice7391
Twitter: jsrice617
GitHub: Jsrice7391
JUSTIN RICE
• DevOps Engineer @
Indigo Ag
• Full-Stack Web
Development Teacher
@ 2U
• New England Native
• Four years in IT
• Broadcast before IT
• Sports, Cyber Sec,
Dogs, Education and
Snow enthusiast
INDIGO
• Indigo works to improve
grower profitability,
environmental sustainability, and
consumer health through the use
of natural microbiology and
digital technologies
• Working with digital
technologies in the many
different sectors of the
agricultural distribution pipeline
to bring farmers and consumers
closer to one another and make
a more natural and modern
approach from seed to shelf
INDIGO +
TERRAFOR
M
In early 2019, Indigo purchased a company called Tellus
labs, a company that specialized in geospatial mapping
and engineering.
With Tellus being acquired, and a growing software
company that released its first public facing app in July
2018, our DevOps team saw a need for control, but for a
modern age of continuous integration.
This is what we learned, and we’re happy to share it with
you.
PROLOGUE
THE CLASSIC SCENARIO
• Architecture of applications is fixed
and is rarely iterated on
• Big Releases for the sake of
compliance or feature releases.
• Big and scary
NOW…
Quick Iterations
Continuous Integration
Accessible Version control systems
Hybrid Cloud with multi different services
changing as fast as the customers need
PROBLEMS
Lots of tools to choose
from
Infrastructure over time
needs documentation.
If you want something
scalable, it has to be
repeatable
Not everyone knows
which shiny button to
click.
ALONG COMES
TERRAFORM…
WHY IT’S AWESOME
• Terraform is a platform that uses
Infrastructure as code (IaC) to allow its
users to manage cloud and local
architecture
• The community version is open sourced
with an available enterprise version
through HashiCorp.
• Reproducible environments
• Idempotence and convergence through
state
• Easing collaboration
• No need for the learning curve that
comes with different services and their
APIs
WHAT ITS NOT
• Cloud Formation – modularization and can handle writing true logic.
• Vagrant - Terraform can help create Vagrant resources.
• Puppet, Chef, Ansible – not cloud native
WHAT WE
WILL
COVER…
Deeper into Terraforms true power.
Key Concepts
Provider Examples
AWS Deep Dive
Advanced Concepts
Take a Tiny Step Back…
“No need for the learning
curve that comes with
different services and their
APIs”
- Justin Rice
(About a minute Ago)
NUTS AND
BOLTS…IN THE
CLOUD
RESOURCES
• The main reason we use terraform.
• All other tooling within Terraform is
built around the ability to manage
these resources.
PROVIDERS
• Responsible for writing
and understanding the
API interactions.
• Commonly written in GO
• Could be compared to as
a wrapper.
• AWS provider attempts to
be an exhaustive wrapper
around the API.
Modules
• Reusable configurations that can be
used throughout terraform.
• A module can consist of multiple,
related resources.
Variables
• Inputs given to a module to be able
to make the resource parameters
more dynamic
• Declared in HCL specific way
• Strongly typed
QUICK QUIZ
You want to start experimenting with terraform, but with something smaller and
with less expensive resources. You go and look for one of Terraforms many:
A. Providers
B. Resources
C. Services
D. Employees
Providers
Terraform has a large amount of
providers that can be used to
manage resources.
You pitch this new idea to your boss of using Terraform. She asks you to
name two of the major benefits of using Terraform. Which of the following are
two benefits of Terraform?
A. Configurations are written in YAML/YML and everyone loves yml.
B. It allows versioning of resources through the use of state.
C. It provides documentation for all services and their APIs
D. One singular language can be used to configure resources from multiple
different providers
B AND D
TERRAFORM USES A STRONGLY TYPED LANGUAGE PAIRED
WITH A CATALOG OF DIFFERENT PROVIDERS TO HANDLE
THEIR CONFIGURATION AND VERSIONS THEIR STATE
OVER TIME THROUGH STATE.
She then replies, “That sounds great, but how much does it cost.” What is your
best answer to this question?
A. “Terraform community version is well-supported, documented and free. You
only pay for the underlying resources you create with it.”
B. “It’s the holiday season, is cost really a concern?”
C. “Wicked expensive”
A
TERRAFORMS COMMUNITY VERSION IS FREE, IS WELL
DOCUMENTED AND CARRIES NO COST. YOU ONLY
PAY FOR THE RESOURCES YOU CREATE AS YOU USE
IT.
LET’S
BUILD
1. Code A VPC
2. Make that VPC
3. Make the subnets within that VPC.
4. Talk about state and then making it remote.
5. Hashi Corp Language.
6. More TF Concepts
7. Using loops for maximum Power
8. Using Terraform in Continuous Integration
9. The Beyond
STARTERS
• Every Terraform project
should begin with a
provider.
• Each provider has its own
set of resources that it is
capable of creating and
managing.
TERRAFORM INIT
WILL PULL DOWN THE PROVIDERS CONFIGURATION
SO WE CAN USE IT TO CREATE THE RESOURCES.
TERRAFORM PLAN
WILL SHOW THE USER WHAT TERRAFORM PLANS TO DO WITH
THE NEW CONFIGURATIONS COMPARED TO WHAT IT ALREADY
KNOWS.
TERRAFORM APPLY
WILL TAKE THE CURRENT RESOURCES FROM
TERRAFORM PLAN AND APPLY THEM.
NOW FOR A DEMO…
STATE
VERSION CONTROLLING INFRASTRUCTURE.
STATE
• State is where terraform really shines.
• It can be viewed in the new terraform.tfstate file that was just created.
• As you continue to add more resources and modify resources, Terraform will create new
versions of the state file and modify the objects
“EASING
COLLABORATION”
JUSTIN RICE
A NUMBER OF SLIDES AGO
TERRAFORM
BACKENDS
• Allows Terraform to send
the state file to another
location such that other
developers (or a CI
pipeline) can iterate on it.
• Hashi Corp provides a
service called Consul, but
also supports s3 for a
backend service.
LET’S CODE…
MOVING STATE FILE TO THE CLOUD AND BUILDING COOL
THINGS.
BEYOND THE
BASICS
WHERE PROVIDERS MEET PROGRAMMING
Data
• As seen in other languages, but
defined in a slightly unique manner.
• Can be used to create dynamic
values throughout.
Locals
• Creates a reference block for resources
to be able to access.
• A resource not quite in terraform or in
another location? Create a data block
to be able to access those needed
values.
• Common for providers to create
provider specific references to this.
OUTPUT• Allows for users to find values from
within the command line without
needing to access the state file
• Outputs should be used on variables
you might want to access after the
apply and be used
TERRAFORM
FUNCTIONS
• Terraform comes with a multitude
of different kinds of functions to
modify the data that we use to
create resources.
• These can also be used to create
”loops” without having to write as
much code.
FUNCTIONS AND
MODULES
UNLOCKING THE POWER OF HCL
CONTINUOUS
INTEGRATION
USING TERRAFORM TO CREATE ITS OWN CI PIPELINE.
CREATE THE CI
PIPELINE…
A SLIDE TO REMIND ME TO STOP AND MAKE A PIPELINE
THAT’S COOL AND ALL,
BUT…
THE INEVITABLE QUESTION THAT COMES WHEN WE MAKE
BIG DECISIONS IN ARCHITECTURE HAVE NOT CHANGED.
TERRAFOR
M IMPORT
Currently a feature that TF allows
that still requires a bit more
overhead, but works like a charm.
Import allows each provider to be
able to import a resource to state
file.
As of this writing, Terraform does
not automatically write a tf file, it
does however update the state.
DO IT…
TOPICS FOR
CONVERSATIO
N
Implement Terraform within multiple accounts, created from
Terraform. Block master branch to this repo. All Pull requests
generate a TFPlan file. Upon PR approval, merge to master and
make the changes.
Developers need exact stacks, add an object to the collection, TF
apply. Done.
Pushback from the organization to make sure all resources are
tagged, a certain ami, different version over multiple VMS in
multiple accounts. Change it in terraform.
QUESTION
S?

More Related Content

Similar to Terraform: Taming the Machines Through Continuous Integration

Going Cloud Native with Cloud Foundry
Going Cloud Native with Cloud FoundryGoing Cloud Native with Cloud Foundry
Going Cloud Native with Cloud FoundryChip Childers
 
A case study why Zoominfo uses Terraform Cloud in high-scale environment.
A case study why Zoominfo uses Terraform Cloud in high-scale environment. A case study why Zoominfo uses Terraform Cloud in high-scale environment.
A case study why Zoominfo uses Terraform Cloud in high-scale environment. Tal Hibner
 
Terraform vs Pulumi
Terraform vs PulumiTerraform vs Pulumi
Terraform vs PulumiHoaiNam307
 
Linode_eBook_Declarative_Cloud_Infrastructure_Management_with_Terraform.pptx
Linode_eBook_Declarative_Cloud_Infrastructure_Management_with_Terraform.pptxLinode_eBook_Declarative_Cloud_Infrastructure_Management_with_Terraform.pptx
Linode_eBook_Declarative_Cloud_Infrastructure_Management_with_Terraform.pptxAkwasiBoateng6
 
What are the Benefits of Using Terraform?
What are the Benefits of Using Terraform?What are the Benefits of Using Terraform?
What are the Benefits of Using Terraform?Ravendra Singh
 
Kubernetes vs Terraform 111023.pdf
Kubernetes vs Terraform 111023.pdfKubernetes vs Terraform 111023.pdf
Kubernetes vs Terraform 111023.pdfJacksonLane4
 
Devops Columbia October 2020 - Gabriel Alix: A Discussion on Terraform
Devops Columbia October 2020 - Gabriel Alix: A Discussion on TerraformDevops Columbia October 2020 - Gabriel Alix: A Discussion on Terraform
Devops Columbia October 2020 - Gabriel Alix: A Discussion on TerraformDrew Malone
 
Devops Columbia October 2020 - Gabriel Alix: A Discussion on Terraform
Devops Columbia October 2020 - Gabriel Alix: A Discussion on Terraform Devops Columbia October 2020 - Gabriel Alix: A Discussion on Terraform
Devops Columbia October 2020 - Gabriel Alix: A Discussion on Terraform DevOpsColumbia
 
Terraform day 1
Terraform day 1Terraform day 1
Terraform day 1Kalkey
 
Infrastructure as Code with Terraform
Infrastructure as Code with TerraformInfrastructure as Code with Terraform
Infrastructure as Code with TerraformTim Berry
 
Collaborative Terraform with Atlantis
Collaborative Terraform with AtlantisCollaborative Terraform with Atlantis
Collaborative Terraform with AtlantisFerenc Kovács
 
Zero-to-Hero: Running Postgres in Kubernetes
Zero-to-Hero: Running Postgres in KubernetesZero-to-Hero: Running Postgres in Kubernetes
Zero-to-Hero: Running Postgres in KubernetesEDB
 
Room 2 - 3 - Nguyễn Hoài Nam & Nguyễn Việt Hùng - Terraform & Pulumi Comparin...
Room 2 - 3 - Nguyễn Hoài Nam & Nguyễn Việt Hùng - Terraform & Pulumi Comparin...Room 2 - 3 - Nguyễn Hoài Nam & Nguyễn Việt Hùng - Terraform & Pulumi Comparin...
Room 2 - 3 - Nguyễn Hoài Nam & Nguyễn Việt Hùng - Terraform & Pulumi Comparin...Vietnam Open Infrastructure User Group
 
Getting Started with Cloud Foundry on Bluemix
Getting Started with Cloud Foundry on BluemixGetting Started with Cloud Foundry on Bluemix
Getting Started with Cloud Foundry on BluemixJake Peyser
 
Getting Started with Cloud Foundry on Bluemix
Getting Started with Cloud Foundry on BluemixGetting Started with Cloud Foundry on Bluemix
Getting Started with Cloud Foundry on BluemixDev_Events
 
RIMA-Infrastructure as a code with Terraform.pptx
RIMA-Infrastructure as a code with Terraform.pptxRIMA-Infrastructure as a code with Terraform.pptx
RIMA-Infrastructure as a code with Terraform.pptxMrJustbis
 

Similar to Terraform: Taming the Machines Through Continuous Integration (20)

Going Cloud Native with Cloud Foundry
Going Cloud Native with Cloud FoundryGoing Cloud Native with Cloud Foundry
Going Cloud Native with Cloud Foundry
 
A case study why Zoominfo uses Terraform Cloud in high-scale environment.
A case study why Zoominfo uses Terraform Cloud in high-scale environment. A case study why Zoominfo uses Terraform Cloud in high-scale environment.
A case study why Zoominfo uses Terraform Cloud in high-scale environment.
 
Terraform vs Pulumi
Terraform vs PulumiTerraform vs Pulumi
Terraform vs Pulumi
 
Linode_eBook_Declarative_Cloud_Infrastructure_Management_with_Terraform.pptx
Linode_eBook_Declarative_Cloud_Infrastructure_Management_with_Terraform.pptxLinode_eBook_Declarative_Cloud_Infrastructure_Management_with_Terraform.pptx
Linode_eBook_Declarative_Cloud_Infrastructure_Management_with_Terraform.pptx
 
What are the Benefits of Using Terraform?
What are the Benefits of Using Terraform?What are the Benefits of Using Terraform?
What are the Benefits of Using Terraform?
 
Terraform
TerraformTerraform
Terraform
 
Why Learn Terraform?
Why Learn Terraform?Why Learn Terraform?
Why Learn Terraform?
 
Introduction to IAC and Terraform
Introduction to IAC and Terraform Introduction to IAC and Terraform
Introduction to IAC and Terraform
 
Kubernetes vs Terraform 111023.pdf
Kubernetes vs Terraform 111023.pdfKubernetes vs Terraform 111023.pdf
Kubernetes vs Terraform 111023.pdf
 
Devops Columbia October 2020 - Gabriel Alix: A Discussion on Terraform
Devops Columbia October 2020 - Gabriel Alix: A Discussion on TerraformDevops Columbia October 2020 - Gabriel Alix: A Discussion on Terraform
Devops Columbia October 2020 - Gabriel Alix: A Discussion on Terraform
 
Devops Columbia October 2020 - Gabriel Alix: A Discussion on Terraform
Devops Columbia October 2020 - Gabriel Alix: A Discussion on Terraform Devops Columbia October 2020 - Gabriel Alix: A Discussion on Terraform
Devops Columbia October 2020 - Gabriel Alix: A Discussion on Terraform
 
Terraform day 1
Terraform day 1Terraform day 1
Terraform day 1
 
Infrastructure as Code with Terraform
Infrastructure as Code with TerraformInfrastructure as Code with Terraform
Infrastructure as Code with Terraform
 
Collaborative Terraform with Atlantis
Collaborative Terraform with AtlantisCollaborative Terraform with Atlantis
Collaborative Terraform with Atlantis
 
Zero-to-Hero: Running Postgres in Kubernetes
Zero-to-Hero: Running Postgres in KubernetesZero-to-Hero: Running Postgres in Kubernetes
Zero-to-Hero: Running Postgres in Kubernetes
 
Room 2 - 3 - Nguyễn Hoài Nam & Nguyễn Việt Hùng - Terraform & Pulumi Comparin...
Room 2 - 3 - Nguyễn Hoài Nam & Nguyễn Việt Hùng - Terraform & Pulumi Comparin...Room 2 - 3 - Nguyễn Hoài Nam & Nguyễn Việt Hùng - Terraform & Pulumi Comparin...
Room 2 - 3 - Nguyễn Hoài Nam & Nguyễn Việt Hùng - Terraform & Pulumi Comparin...
 
Getting Started with Cloud Foundry on Bluemix
Getting Started with Cloud Foundry on BluemixGetting Started with Cloud Foundry on Bluemix
Getting Started with Cloud Foundry on Bluemix
 
Getting Started with Cloud Foundry on Bluemix
Getting Started with Cloud Foundry on BluemixGetting Started with Cloud Foundry on Bluemix
Getting Started with Cloud Foundry on Bluemix
 
Getting Started with Cloud Foundry on Bluemix
Getting Started with Cloud Foundry on BluemixGetting Started with Cloud Foundry on Bluemix
Getting Started with Cloud Foundry on Bluemix
 
RIMA-Infrastructure as a code with Terraform.pptx
RIMA-Infrastructure as a code with Terraform.pptxRIMA-Infrastructure as a code with Terraform.pptx
RIMA-Infrastructure as a code with Terraform.pptx
 

Recently uploaded

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 

Recently uploaded (20)

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 

Terraform: Taming the Machines Through Continuous Integration

  • 1. TERRAFORM: TAMING THE MACHINES WITH CONTINUOUS INTEGRATION Justin Rice Source Code: jsrice7391/tf-talk Medium: Jsrice7391 Twitter: jsrice617 GitHub: Jsrice7391
  • 2. JUSTIN RICE • DevOps Engineer @ Indigo Ag • Full-Stack Web Development Teacher @ 2U • New England Native • Four years in IT • Broadcast before IT • Sports, Cyber Sec, Dogs, Education and Snow enthusiast
  • 3. INDIGO • Indigo works to improve grower profitability, environmental sustainability, and consumer health through the use of natural microbiology and digital technologies • Working with digital technologies in the many different sectors of the agricultural distribution pipeline to bring farmers and consumers closer to one another and make a more natural and modern approach from seed to shelf
  • 4. INDIGO + TERRAFOR M In early 2019, Indigo purchased a company called Tellus labs, a company that specialized in geospatial mapping and engineering. With Tellus being acquired, and a growing software company that released its first public facing app in July 2018, our DevOps team saw a need for control, but for a modern age of continuous integration. This is what we learned, and we’re happy to share it with you.
  • 6. THE CLASSIC SCENARIO • Architecture of applications is fixed and is rarely iterated on • Big Releases for the sake of compliance or feature releases. • Big and scary
  • 7. NOW… Quick Iterations Continuous Integration Accessible Version control systems Hybrid Cloud with multi different services changing as fast as the customers need
  • 8. PROBLEMS Lots of tools to choose from Infrastructure over time needs documentation. If you want something scalable, it has to be repeatable Not everyone knows which shiny button to click.
  • 9.
  • 11. WHY IT’S AWESOME • Terraform is a platform that uses Infrastructure as code (IaC) to allow its users to manage cloud and local architecture • The community version is open sourced with an available enterprise version through HashiCorp. • Reproducible environments • Idempotence and convergence through state • Easing collaboration • No need for the learning curve that comes with different services and their APIs
  • 12. WHAT ITS NOT • Cloud Formation – modularization and can handle writing true logic. • Vagrant - Terraform can help create Vagrant resources. • Puppet, Chef, Ansible – not cloud native
  • 13. WHAT WE WILL COVER… Deeper into Terraforms true power. Key Concepts Provider Examples AWS Deep Dive Advanced Concepts
  • 14. Take a Tiny Step Back…
  • 15. “No need for the learning curve that comes with different services and their APIs” - Justin Rice (About a minute Ago)
  • 17. RESOURCES • The main reason we use terraform. • All other tooling within Terraform is built around the ability to manage these resources.
  • 18. PROVIDERS • Responsible for writing and understanding the API interactions. • Commonly written in GO • Could be compared to as a wrapper. • AWS provider attempts to be an exhaustive wrapper around the API.
  • 19. Modules • Reusable configurations that can be used throughout terraform. • A module can consist of multiple, related resources. Variables • Inputs given to a module to be able to make the resource parameters more dynamic • Declared in HCL specific way • Strongly typed
  • 21. You want to start experimenting with terraform, but with something smaller and with less expensive resources. You go and look for one of Terraforms many: A. Providers B. Resources C. Services D. Employees
  • 22. Providers Terraform has a large amount of providers that can be used to manage resources.
  • 23. You pitch this new idea to your boss of using Terraform. She asks you to name two of the major benefits of using Terraform. Which of the following are two benefits of Terraform? A. Configurations are written in YAML/YML and everyone loves yml. B. It allows versioning of resources through the use of state. C. It provides documentation for all services and their APIs D. One singular language can be used to configure resources from multiple different providers
  • 24. B AND D TERRAFORM USES A STRONGLY TYPED LANGUAGE PAIRED WITH A CATALOG OF DIFFERENT PROVIDERS TO HANDLE THEIR CONFIGURATION AND VERSIONS THEIR STATE OVER TIME THROUGH STATE.
  • 25. She then replies, “That sounds great, but how much does it cost.” What is your best answer to this question? A. “Terraform community version is well-supported, documented and free. You only pay for the underlying resources you create with it.” B. “It’s the holiday season, is cost really a concern?” C. “Wicked expensive”
  • 26. A TERRAFORMS COMMUNITY VERSION IS FREE, IS WELL DOCUMENTED AND CARRIES NO COST. YOU ONLY PAY FOR THE RESOURCES YOU CREATE AS YOU USE IT.
  • 28. 1. Code A VPC 2. Make that VPC 3. Make the subnets within that VPC. 4. Talk about state and then making it remote. 5. Hashi Corp Language. 6. More TF Concepts 7. Using loops for maximum Power 8. Using Terraform in Continuous Integration 9. The Beyond
  • 29. STARTERS • Every Terraform project should begin with a provider. • Each provider has its own set of resources that it is capable of creating and managing.
  • 30. TERRAFORM INIT WILL PULL DOWN THE PROVIDERS CONFIGURATION SO WE CAN USE IT TO CREATE THE RESOURCES.
  • 31. TERRAFORM PLAN WILL SHOW THE USER WHAT TERRAFORM PLANS TO DO WITH THE NEW CONFIGURATIONS COMPARED TO WHAT IT ALREADY KNOWS.
  • 32. TERRAFORM APPLY WILL TAKE THE CURRENT RESOURCES FROM TERRAFORM PLAN AND APPLY THEM.
  • 33. NOW FOR A DEMO…
  • 35. STATE • State is where terraform really shines. • It can be viewed in the new terraform.tfstate file that was just created. • As you continue to add more resources and modify resources, Terraform will create new versions of the state file and modify the objects
  • 37. TERRAFORM BACKENDS • Allows Terraform to send the state file to another location such that other developers (or a CI pipeline) can iterate on it. • Hashi Corp provides a service called Consul, but also supports s3 for a backend service.
  • 38. LET’S CODE… MOVING STATE FILE TO THE CLOUD AND BUILDING COOL THINGS.
  • 40. Data • As seen in other languages, but defined in a slightly unique manner. • Can be used to create dynamic values throughout. Locals • Creates a reference block for resources to be able to access. • A resource not quite in terraform or in another location? Create a data block to be able to access those needed values. • Common for providers to create provider specific references to this.
  • 41. OUTPUT• Allows for users to find values from within the command line without needing to access the state file • Outputs should be used on variables you might want to access after the apply and be used
  • 42. TERRAFORM FUNCTIONS • Terraform comes with a multitude of different kinds of functions to modify the data that we use to create resources. • These can also be used to create ”loops” without having to write as much code.
  • 44. CONTINUOUS INTEGRATION USING TERRAFORM TO CREATE ITS OWN CI PIPELINE.
  • 45.
  • 46. CREATE THE CI PIPELINE… A SLIDE TO REMIND ME TO STOP AND MAKE A PIPELINE
  • 47. THAT’S COOL AND ALL, BUT… THE INEVITABLE QUESTION THAT COMES WHEN WE MAKE BIG DECISIONS IN ARCHITECTURE HAVE NOT CHANGED.
  • 48.
  • 49. TERRAFOR M IMPORT Currently a feature that TF allows that still requires a bit more overhead, but works like a charm. Import allows each provider to be able to import a resource to state file. As of this writing, Terraform does not automatically write a tf file, it does however update the state.
  • 51. TOPICS FOR CONVERSATIO N Implement Terraform within multiple accounts, created from Terraform. Block master branch to this repo. All Pull requests generate a TFPlan file. Upon PR approval, merge to master and make the changes. Developers need exact stacks, add an object to the collection, TF apply. Done. Pushback from the organization to make sure all resources are tagged, a certain ami, different version over multiple VMS in multiple accounts. Change it in terraform.