SlideShare a Scribd company logo
https://bit.ly/2Cs2ql4
Meetup - DevOps Braga
28th
March 2019
on
2
Agenda
●
About me
●
Intro Terraform
●
Core Concepts
●
Modules / Registry
●
Comparison with other tools
●
Demo
●
TFE
3
About me
Bruno Costa
●
Background of SysAdmin on Linux, VMware,
SAN, …
●
Team Leader of DevOps Team @Eurotux
●
More than 2 years using AWS, managing a dozen
of AWS Accounts
●
Using Terraform for a year on Production
Environments
4
Reach me on Slack
Intro Terraform
Terraform - It is a tool to automate your infrastructure:
1) Write a configuration file (.tf file)
2) Terraform will make sure it will reach your desired state
3) Later on, make some changes to your configuration
4) Terraform will evaluate what has changed and it will apply
accordingly
5
Features:
●
Written in Go
●
Open Source
●
From Hashicorp - other tools like Vagrant / Packer / Vault / Consul
●
98 official providers (AWS, GCP, Azure, Cloudflare, Gitlab,
PostgreSQL,...)
●
102 community providers (oVirt, AWX, Kafka,…)
●
Bring IaC to a new level
Intro Terraform – Phase 0
6
●
Write your config (HCL or JSON)
●
Sample with AWS Route 53
●
Objective: create an DNS zone and A record pointing
“blc.mydomain.org” => “10.10.10.21”
●
Provider (1) ●
Resources (2) ●
Variables (2)
Interpolation
Intro Terraform – Phase 1
7
●
Use the terraform CLI command
●
Phase 1 – terraform init
Provider
Backend
Intro Terraform – Phase 2
8
●
Use the terraform CLI command
●
Phase 2 – terraform plan
Nothing has changed yet!
Dependency
Intro Terraform – Phase 3
9
●
Use the terraform CLI command
●
Phase 3 – terraform apply
Intro Terraform
10
What happened?
●
Planning – described the action that should be taken to get to the desired state
●
Approval – the user reviewed and approved the changes that need to be done
●
Execution – using AWS API, Terraform applied the desired changed
●
Update State – Terraform wrote data into the state (state file or backend) to keep track of
the resources it manages
Core Concepts
11
Resources:
●
Key element on HCL – it defines an object that
Terraform manages
●
Some of them, can be imported into state
●
AWS has over 500 different resource types (eg:
aws_security_group, aws_instance, aws_iam_role)
●
Some resources can be imported into state and be
managed by Terraform: terraform import
Core Concepts
12
Providers:
●
You need to provide the credentials to connect to
provider (user/passwd, token, ...)
●
All the resources are tied to a provider, but you
may interleave resources from different provider.
Eg.: After adding an EC2 instance, you may add a
Cloudflare A record
●
You may build your own providers
●
You need to define alternate providers to talk with
different AWS Regions
Core Concepts
13
Data Sources:
●
Instead of declaring a resource, you
may use computed variables from
other sources
●
Eg: get AMI id, get list of AZs
Outputs:
●
You may need to output Terraform
result, to feed into other scripts
●
Output can be used on Modules
Inputs:
●
Can be used as vars. Eg:
var.aws_provider
Core Concepts
14
Interpolation Syntax:
●
Adds expressiveness into a declarative
language
●
Have conditionals and “pseudo-for” loops
●
Built-in functions to manipulate strings,
maps and lists
●
Terraform 0.12 will bring many changes
on interpolation syntax
Core Concepts
15
Backends:
●
The backend store the state of Terraform.
●
By default, it is a terraform.tfstate file
●
Remote State: Keep the state shared and keep locking mechanisms between team
members
●
AWS: Typical setup Bootstrap – chicken/egg problem
●
Have a local file backend to bootstrap
DynamoDB and S3
Modules / Registry
16
Modules
●
You may multiples related resources
to create a module
●
Improve code reuse between projects
●
Can be called many times, but you
cannot transparently use count
●
Eg: Create a module to add an ACM
certificate and the corresponding
validation DNS records on Cloudflare
Registry
●
https://registry.terraform.io/
●
Share verified modules and
community modules
●
Eg: terraform-aws-modules/vpc/aws can
create a VPC with corresponding
subnets, IGW, , Routing Tables
●
Cloud Posse has some nice modules,
despite being community-based
modules
Comparison with Other Tools
17
●
Configuration Tools – Chef, Puppet, ...
– Terraform focus on resource creation, rather than configure a server that already exist
●
Infra Tools – CloudFormation
– Similar to Terraform, but Terraform can mix resource from different Cloud providers
●
API – Boto3, SDK
– Too much low-level. Need to manually manage resource dependency, lifecycle and implement
logic to interact with different providers
●
But...
– You may combine Terraform with native provisioners (chef, salt) or local-exec
provisioner (Ansible)
Demo
18
Network
●
Create a VPC on us-east-1
●
The VPC should have 2 AZs, each one
with a /24 subnet
●
VPC CIDR should be 10.230.0.0/22
●
Only one NAT instance for both Private
Subnets
Demo
19
Sample App PHP+MySQL
●
Add a MySQL/MariaDB on
Private Subnet
●
Add an Apache HTTP with
PHP to Public Subnet
●
Grab the output from
Terraform, test the website
TFE
20
Advantages:
●
Private Module Registry
●
Web interface (but console
output)
●
Customer Support
●
Trial:
http://app.terraform.io/account
/new
Questions?

More Related Content

What's hot

Shark - Lab Assignment
Shark - Lab AssignmentShark - Lab Assignment
Shark - Lab Assignment
Farzad Nozarian
 
Design and architecture of Jackrabbit
Design and architecture of JackrabbitDesign and architecture of Jackrabbit
Design and architecture of Jackrabbit
Jukka Zitting
 
{code} and Containers - Open Source Infrastructure within Dell Technologies
{code} and Containers - Open Source Infrastructure within Dell Technologies{code} and Containers - Open Source Infrastructure within Dell Technologies
{code} and Containers - Open Source Infrastructure within Dell Technologies
The {code} Team
 
Inside Flume
Inside FlumeInside Flume
Inside Flume
Cloudera, Inc.
 
Windows azure table storage – deep dive
Windows azure table storage – deep diveWindows azure table storage – deep dive
Windows azure table storage – deep dive
Sundararajan Subramanian
 
DNS in the Cloud
DNS in the CloudDNS in the Cloud
DNS in the Cloud
Habeeb Rahman
 
A Travel Through Mesos
A Travel Through MesosA Travel Through Mesos
A Travel Through Mesos
Datio Big Data
 
OSGifying the repository
OSGifying the repositoryOSGifying the repository
OSGifying the repository
Jukka Zitting
 
File uploads to s3
File uploads to s3File uploads to s3
File uploads to s3
varunlalan
 
Azure storage
Azure storageAzure storage
Azure storage
Raju Kumar
 
Web Performance & Scalability Tools
Web Performance & Scalability ToolsWeb Performance & Scalability Tools
Web Performance & Scalability Tools
Folio3 Software
 
Making Apache Kafka Elastic with Apache Mesos
Making Apache Kafka Elastic with Apache MesosMaking Apache Kafka Elastic with Apache Mesos
Making Apache Kafka Elastic with Apache Mesos
Joe Stein
 
/path/to/content - the Apache Jackrabbit content repository
/path/to/content - the Apache Jackrabbit content repository/path/to/content - the Apache Jackrabbit content repository
/path/to/content - the Apache Jackrabbit content repository
Jukka Zitting
 
Apache flume - Twitter Streaming
Apache flume - Twitter Streaming Apache flume - Twitter Streaming
Apache flume - Twitter Streaming
Kowndinya Mannepalli
 
Infrastructure as code with terraform and packer
Infrastructure as code with terraform and packerInfrastructure as code with terraform and packer
Infrastructure as code with terraform and packer
Alex Landa
 
Making Distributed Data Persistent Services Elastic (Without Losing All Your ...
Making Distributed Data Persistent Services Elastic (Without Losing All Your ...Making Distributed Data Persistent Services Elastic (Without Losing All Your ...
Making Distributed Data Persistent Services Elastic (Without Losing All Your ...
Joe Stein
 
Repository performance tuning
Repository performance tuningRepository performance tuning
Repository performance tuning
Jukka Zitting
 
Azure Storage Performance
Azure Storage PerformanceAzure Storage Performance
Azure Storage Performance
Anton Boyko
 
Hadoop spark online demo
Hadoop spark online demoHadoop spark online demo
Hadoop spark online demo
Tripti Jha
 
Apache flume
Apache flumeApache flume
Apache flume
Ramakrishna kapa
 

What's hot (20)

Shark - Lab Assignment
Shark - Lab AssignmentShark - Lab Assignment
Shark - Lab Assignment
 
Design and architecture of Jackrabbit
Design and architecture of JackrabbitDesign and architecture of Jackrabbit
Design and architecture of Jackrabbit
 
{code} and Containers - Open Source Infrastructure within Dell Technologies
{code} and Containers - Open Source Infrastructure within Dell Technologies{code} and Containers - Open Source Infrastructure within Dell Technologies
{code} and Containers - Open Source Infrastructure within Dell Technologies
 
Inside Flume
Inside FlumeInside Flume
Inside Flume
 
Windows azure table storage – deep dive
Windows azure table storage – deep diveWindows azure table storage – deep dive
Windows azure table storage – deep dive
 
DNS in the Cloud
DNS in the CloudDNS in the Cloud
DNS in the Cloud
 
A Travel Through Mesos
A Travel Through MesosA Travel Through Mesos
A Travel Through Mesos
 
OSGifying the repository
OSGifying the repositoryOSGifying the repository
OSGifying the repository
 
File uploads to s3
File uploads to s3File uploads to s3
File uploads to s3
 
Azure storage
Azure storageAzure storage
Azure storage
 
Web Performance & Scalability Tools
Web Performance & Scalability ToolsWeb Performance & Scalability Tools
Web Performance & Scalability Tools
 
Making Apache Kafka Elastic with Apache Mesos
Making Apache Kafka Elastic with Apache MesosMaking Apache Kafka Elastic with Apache Mesos
Making Apache Kafka Elastic with Apache Mesos
 
/path/to/content - the Apache Jackrabbit content repository
/path/to/content - the Apache Jackrabbit content repository/path/to/content - the Apache Jackrabbit content repository
/path/to/content - the Apache Jackrabbit content repository
 
Apache flume - Twitter Streaming
Apache flume - Twitter Streaming Apache flume - Twitter Streaming
Apache flume - Twitter Streaming
 
Infrastructure as code with terraform and packer
Infrastructure as code with terraform and packerInfrastructure as code with terraform and packer
Infrastructure as code with terraform and packer
 
Making Distributed Data Persistent Services Elastic (Without Losing All Your ...
Making Distributed Data Persistent Services Elastic (Without Losing All Your ...Making Distributed Data Persistent Services Elastic (Without Losing All Your ...
Making Distributed Data Persistent Services Elastic (Without Losing All Your ...
 
Repository performance tuning
Repository performance tuningRepository performance tuning
Repository performance tuning
 
Azure Storage Performance
Azure Storage PerformanceAzure Storage Performance
Azure Storage Performance
 
Hadoop spark online demo
Hadoop spark online demoHadoop spark online demo
Hadoop spark online demo
 
Apache flume
Apache flumeApache flume
Apache flume
 

Similar to DevOps Braga #9: Introdução ao Terraform

Infrastructure as Code with Terraform
Infrastructure as Code with TerraformInfrastructure as Code with Terraform
Infrastructure as Code with Terraform
Pedro J. Molina
 
Terraform vs Pulumi
Terraform vs PulumiTerraform vs Pulumi
Terraform vs Pulumi
HoaiNam307
 
AWS DevOps - Terraform, Docker, HashiCorp Vault
AWS DevOps - Terraform, Docker, HashiCorp VaultAWS DevOps - Terraform, Docker, HashiCorp Vault
AWS DevOps - Terraform, Docker, HashiCorp Vault
Grzegorz Adamowicz
 
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdfHashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
ssuser705051
 
Terraform-2.pdf
Terraform-2.pdfTerraform-2.pdf
Terraform-2.pdf
rutiksankapal21
 
Building infrastructure as code using Terraform - DevOps Krakow
Building infrastructure as code using Terraform - DevOps KrakowBuilding infrastructure as code using Terraform - DevOps Krakow
Building infrastructure as code using Terraform - DevOps Krakow
Anton Babenko
 
Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to Kubernetes
Vishal Biyani
 
Cassandra Lunch #86: DataStax Astra Terraform Provider
Cassandra Lunch #86: DataStax Astra Terraform ProviderCassandra Lunch #86: DataStax Astra Terraform Provider
Cassandra Lunch #86: DataStax Astra Terraform Provider
Anant Corporation
 
Terraforming your Infrastructure on GCP
Terraforming your Infrastructure on GCPTerraforming your Infrastructure on GCP
Terraforming your Infrastructure on GCP
Samuel Chow
 
Terraform modules and some of best-practices - March 2019
Terraform modules and some of best-practices - March 2019Terraform modules and some of best-practices - March 2019
Terraform modules and some of best-practices - March 2019
Anton Babenko
 
Terraform Q&A - HashiCorp User Group Oslo
Terraform Q&A - HashiCorp User Group OsloTerraform Q&A - HashiCorp User Group Oslo
Terraform Q&A - HashiCorp User Group Oslo
Anton Babenko
 
Infrastructure as Code with Terraform.pptx
Infrastructure as Code with Terraform.pptxInfrastructure as Code with Terraform.pptx
Infrastructure as Code with Terraform.pptx
Samuel862293
 
Infrastructure as Code with Terraform
Infrastructure as Code with TerraformInfrastructure as Code with Terraform
Infrastructure as Code with Terraform
Tim Berry
 
Terraform modules and best-practices - September 2018
Terraform modules and best-practices - September 2018Terraform modules and best-practices - September 2018
Terraform modules and best-practices - September 2018
Anton Babenko
 
Cloudify and terraform integration
Cloudify and terraform integrationCloudify and terraform integration
Cloudify and terraform integration
Nati Shalom
 
Terraform + ansible talk
Terraform + ansible talkTerraform + ansible talk
Terraform + ansible talk
James Strong
 
HDFCloud Workshop: HDF5 in the Cloud
HDFCloud Workshop: HDF5 in the CloudHDFCloud Workshop: HDF5 in the Cloud
HDFCloud Workshop: HDF5 in the Cloud
The HDF-EOS Tools and Information Center
 
Flume-based Independent News Aggregator
Flume-based Independent News AggregatorFlume-based Independent News Aggregator
Flume-based Independent News Aggregator
Mário Almeida
 
Reusable, composable, battle-tested Terraform modules
Reusable, composable, battle-tested Terraform modulesReusable, composable, battle-tested Terraform modules
Reusable, composable, battle-tested Terraform modules
Yevgeniy Brikman
 
App Deployment on Cloud
App Deployment on CloudApp Deployment on Cloud
App Deployment on Cloud
Ajey Pratap Singh
 

Similar to DevOps Braga #9: Introdução ao Terraform (20)

Infrastructure as Code with Terraform
Infrastructure as Code with TerraformInfrastructure as Code with Terraform
Infrastructure as Code with Terraform
 
Terraform vs Pulumi
Terraform vs PulumiTerraform vs Pulumi
Terraform vs Pulumi
 
AWS DevOps - Terraform, Docker, HashiCorp Vault
AWS DevOps - Terraform, Docker, HashiCorp VaultAWS DevOps - Terraform, Docker, HashiCorp Vault
AWS DevOps - Terraform, Docker, HashiCorp Vault
 
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdfHashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
 
Terraform-2.pdf
Terraform-2.pdfTerraform-2.pdf
Terraform-2.pdf
 
Building infrastructure as code using Terraform - DevOps Krakow
Building infrastructure as code using Terraform - DevOps KrakowBuilding infrastructure as code using Terraform - DevOps Krakow
Building infrastructure as code using Terraform - DevOps Krakow
 
Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to Kubernetes
 
Cassandra Lunch #86: DataStax Astra Terraform Provider
Cassandra Lunch #86: DataStax Astra Terraform ProviderCassandra Lunch #86: DataStax Astra Terraform Provider
Cassandra Lunch #86: DataStax Astra Terraform Provider
 
Terraforming your Infrastructure on GCP
Terraforming your Infrastructure on GCPTerraforming your Infrastructure on GCP
Terraforming your Infrastructure on GCP
 
Terraform modules and some of best-practices - March 2019
Terraform modules and some of best-practices - March 2019Terraform modules and some of best-practices - March 2019
Terraform modules and some of best-practices - March 2019
 
Terraform Q&A - HashiCorp User Group Oslo
Terraform Q&A - HashiCorp User Group OsloTerraform Q&A - HashiCorp User Group Oslo
Terraform Q&A - HashiCorp User Group Oslo
 
Infrastructure as Code with Terraform.pptx
Infrastructure as Code with Terraform.pptxInfrastructure as Code with Terraform.pptx
Infrastructure as Code with Terraform.pptx
 
Infrastructure as Code with Terraform
Infrastructure as Code with TerraformInfrastructure as Code with Terraform
Infrastructure as Code with Terraform
 
Terraform modules and best-practices - September 2018
Terraform modules and best-practices - September 2018Terraform modules and best-practices - September 2018
Terraform modules and best-practices - September 2018
 
Cloudify and terraform integration
Cloudify and terraform integrationCloudify and terraform integration
Cloudify and terraform integration
 
Terraform + ansible talk
Terraform + ansible talkTerraform + ansible talk
Terraform + ansible talk
 
HDFCloud Workshop: HDF5 in the Cloud
HDFCloud Workshop: HDF5 in the CloudHDFCloud Workshop: HDF5 in the Cloud
HDFCloud Workshop: HDF5 in the Cloud
 
Flume-based Independent News Aggregator
Flume-based Independent News AggregatorFlume-based Independent News Aggregator
Flume-based Independent News Aggregator
 
Reusable, composable, battle-tested Terraform modules
Reusable, composable, battle-tested Terraform modulesReusable, composable, battle-tested Terraform modules
Reusable, composable, battle-tested Terraform modules
 
App Deployment on Cloud
App Deployment on CloudApp Deployment on Cloud
App Deployment on Cloud
 

More from DevOps Braga

DevOps Braga #15: Agentless monitoring with icinga and prometheus
DevOps Braga #15: Agentless monitoring with icinga and prometheusDevOps Braga #15: Agentless monitoring with icinga and prometheus
DevOps Braga #15: Agentless monitoring with icinga and prometheus
DevOps Braga
 
Infrastructural challenges of a fast-pace startup
Infrastructural challenges of a fast-pace startupInfrastructural challenges of a fast-pace startup
Infrastructural challenges of a fast-pace startup
DevOps Braga
 
DevOps Braga #11: Docker Anatomy
DevOps Braga #11: Docker AnatomyDevOps Braga #11: Docker Anatomy
DevOps Braga #11: Docker Anatomy
DevOps Braga
 
DevOps Braga #4: Infrastructure as Code: Impulsionar DevOps
DevOps Braga #4: Infrastructure as Code: Impulsionar DevOpsDevOps Braga #4: Infrastructure as Code: Impulsionar DevOps
DevOps Braga #4: Infrastructure as Code: Impulsionar DevOps
DevOps Braga
 
DevOps Braga #7: Salt: Configuration Management
DevOps Braga #7: Salt: Configuration ManagementDevOps Braga #7: Salt: Configuration Management
DevOps Braga #7: Salt: Configuration Management
DevOps Braga
 
DevOps Braga #3: Admin rights, everyone gets Admin rights!
DevOps Braga #3: Admin rights, everyone gets Admin rights!DevOps Braga #3: Admin rights, everyone gets Admin rights!
DevOps Braga #3: Admin rights, everyone gets Admin rights!
DevOps Braga
 
DevOps Braga #6
DevOps Braga #6DevOps Braga #6
DevOps Braga #6
DevOps Braga
 
DevOps Braga #5
DevOps Braga #5DevOps Braga #5
DevOps Braga #5
DevOps Braga
 

More from DevOps Braga (8)

DevOps Braga #15: Agentless monitoring with icinga and prometheus
DevOps Braga #15: Agentless monitoring with icinga and prometheusDevOps Braga #15: Agentless monitoring with icinga and prometheus
DevOps Braga #15: Agentless monitoring with icinga and prometheus
 
Infrastructural challenges of a fast-pace startup
Infrastructural challenges of a fast-pace startupInfrastructural challenges of a fast-pace startup
Infrastructural challenges of a fast-pace startup
 
DevOps Braga #11: Docker Anatomy
DevOps Braga #11: Docker AnatomyDevOps Braga #11: Docker Anatomy
DevOps Braga #11: Docker Anatomy
 
DevOps Braga #4: Infrastructure as Code: Impulsionar DevOps
DevOps Braga #4: Infrastructure as Code: Impulsionar DevOpsDevOps Braga #4: Infrastructure as Code: Impulsionar DevOps
DevOps Braga #4: Infrastructure as Code: Impulsionar DevOps
 
DevOps Braga #7: Salt: Configuration Management
DevOps Braga #7: Salt: Configuration ManagementDevOps Braga #7: Salt: Configuration Management
DevOps Braga #7: Salt: Configuration Management
 
DevOps Braga #3: Admin rights, everyone gets Admin rights!
DevOps Braga #3: Admin rights, everyone gets Admin rights!DevOps Braga #3: Admin rights, everyone gets Admin rights!
DevOps Braga #3: Admin rights, everyone gets Admin rights!
 
DevOps Braga #6
DevOps Braga #6DevOps Braga #6
DevOps Braga #6
 
DevOps Braga #5
DevOps Braga #5DevOps Braga #5
DevOps Braga #5
 

Recently uploaded

GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 

Recently uploaded (20)

GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 

DevOps Braga #9: Introdução ao Terraform

  • 2. Meetup - DevOps Braga 28th March 2019 on 2
  • 3. Agenda ● About me ● Intro Terraform ● Core Concepts ● Modules / Registry ● Comparison with other tools ● Demo ● TFE 3
  • 4. About me Bruno Costa ● Background of SysAdmin on Linux, VMware, SAN, … ● Team Leader of DevOps Team @Eurotux ● More than 2 years using AWS, managing a dozen of AWS Accounts ● Using Terraform for a year on Production Environments 4 Reach me on Slack
  • 5. Intro Terraform Terraform - It is a tool to automate your infrastructure: 1) Write a configuration file (.tf file) 2) Terraform will make sure it will reach your desired state 3) Later on, make some changes to your configuration 4) Terraform will evaluate what has changed and it will apply accordingly 5 Features: ● Written in Go ● Open Source ● From Hashicorp - other tools like Vagrant / Packer / Vault / Consul ● 98 official providers (AWS, GCP, Azure, Cloudflare, Gitlab, PostgreSQL,...) ● 102 community providers (oVirt, AWX, Kafka,…) ● Bring IaC to a new level
  • 6. Intro Terraform – Phase 0 6 ● Write your config (HCL or JSON) ● Sample with AWS Route 53 ● Objective: create an DNS zone and A record pointing “blc.mydomain.org” => “10.10.10.21” ● Provider (1) ● Resources (2) ● Variables (2) Interpolation
  • 7. Intro Terraform – Phase 1 7 ● Use the terraform CLI command ● Phase 1 – terraform init Provider Backend
  • 8. Intro Terraform – Phase 2 8 ● Use the terraform CLI command ● Phase 2 – terraform plan Nothing has changed yet! Dependency
  • 9. Intro Terraform – Phase 3 9 ● Use the terraform CLI command ● Phase 3 – terraform apply
  • 10. Intro Terraform 10 What happened? ● Planning – described the action that should be taken to get to the desired state ● Approval – the user reviewed and approved the changes that need to be done ● Execution – using AWS API, Terraform applied the desired changed ● Update State – Terraform wrote data into the state (state file or backend) to keep track of the resources it manages
  • 11. Core Concepts 11 Resources: ● Key element on HCL – it defines an object that Terraform manages ● Some of them, can be imported into state ● AWS has over 500 different resource types (eg: aws_security_group, aws_instance, aws_iam_role) ● Some resources can be imported into state and be managed by Terraform: terraform import
  • 12. Core Concepts 12 Providers: ● You need to provide the credentials to connect to provider (user/passwd, token, ...) ● All the resources are tied to a provider, but you may interleave resources from different provider. Eg.: After adding an EC2 instance, you may add a Cloudflare A record ● You may build your own providers ● You need to define alternate providers to talk with different AWS Regions
  • 13. Core Concepts 13 Data Sources: ● Instead of declaring a resource, you may use computed variables from other sources ● Eg: get AMI id, get list of AZs Outputs: ● You may need to output Terraform result, to feed into other scripts ● Output can be used on Modules Inputs: ● Can be used as vars. Eg: var.aws_provider
  • 14. Core Concepts 14 Interpolation Syntax: ● Adds expressiveness into a declarative language ● Have conditionals and “pseudo-for” loops ● Built-in functions to manipulate strings, maps and lists ● Terraform 0.12 will bring many changes on interpolation syntax
  • 15. Core Concepts 15 Backends: ● The backend store the state of Terraform. ● By default, it is a terraform.tfstate file ● Remote State: Keep the state shared and keep locking mechanisms between team members ● AWS: Typical setup Bootstrap – chicken/egg problem ● Have a local file backend to bootstrap DynamoDB and S3
  • 16. Modules / Registry 16 Modules ● You may multiples related resources to create a module ● Improve code reuse between projects ● Can be called many times, but you cannot transparently use count ● Eg: Create a module to add an ACM certificate and the corresponding validation DNS records on Cloudflare Registry ● https://registry.terraform.io/ ● Share verified modules and community modules ● Eg: terraform-aws-modules/vpc/aws can create a VPC with corresponding subnets, IGW, , Routing Tables ● Cloud Posse has some nice modules, despite being community-based modules
  • 17. Comparison with Other Tools 17 ● Configuration Tools – Chef, Puppet, ... – Terraform focus on resource creation, rather than configure a server that already exist ● Infra Tools – CloudFormation – Similar to Terraform, but Terraform can mix resource from different Cloud providers ● API – Boto3, SDK – Too much low-level. Need to manually manage resource dependency, lifecycle and implement logic to interact with different providers ● But... – You may combine Terraform with native provisioners (chef, salt) or local-exec provisioner (Ansible)
  • 18. Demo 18 Network ● Create a VPC on us-east-1 ● The VPC should have 2 AZs, each one with a /24 subnet ● VPC CIDR should be 10.230.0.0/22 ● Only one NAT instance for both Private Subnets
  • 19. Demo 19 Sample App PHP+MySQL ● Add a MySQL/MariaDB on Private Subnet ● Add an Apache HTTP with PHP to Public Subnet ● Grab the output from Terraform, test the website
  • 20. TFE 20 Advantages: ● Private Module Registry ● Web interface (but console output) ● Customer Support ● Trial: http://app.terraform.io/account /new