An introduction to terraform
-
Upload
julien-pivotto -
Category
Technology
-
view
326 -
download
0
Transcript of An introduction to terraform
![Page 1: An introduction to terraform](https://reader034.fdocuments.in/reader034/viewer/2022051503/5a6d40b97f8b9ac2418b59b3/html5/thumbnails/1.jpg)
An introduction to Terraform
Julien Pivotto (@roidelapluie)
RMLL, Saint-Étienne
July 4th, 2017
![Page 2: An introduction to terraform](https://reader034.fdocuments.in/reader034/viewer/2022051503/5a6d40b97f8b9ac2418b59b3/html5/thumbnails/2.jpg)
whoamiJulien Pivotto
@roidelapluie
Sysadmin at inuits
Automation, monitoring, HA
RMLL 2013 org team
![Page 3: An introduction to terraform](https://reader034.fdocuments.in/reader034/viewer/2022051503/5a6d40b97f8b9ac2418b59b3/html5/thumbnails/3.jpg)
inuits
![Page 4: An introduction to terraform](https://reader034.fdocuments.in/reader034/viewer/2022051503/5a6d40b97f8b9ac2418b59b3/html5/thumbnails/4.jpg)
Building infrastructure
Cloud age
Baremtal: talking to your automation tool(cobbler, foreman)
PaaS: Talking to your infrastructure provider
Cloud: Talking to your cloud provider
Talk = Use the WebUI / API
![Page 5: An introduction to terraform](https://reader034.fdocuments.in/reader034/viewer/2022051503/5a6d40b97f8b9ac2418b59b3/html5/thumbnails/5.jpg)
Challenges of current infraPlanning changes
Executing changes
Working together
Keeping up to date (usable) inventories
![Page 6: An introduction to terraform](https://reader034.fdocuments.in/reader034/viewer/2022051503/5a6d40b97f8b9ac2418b59b3/html5/thumbnails/6.jpg)
DevOps
![Page 7: An introduction to terraform](https://reader034.fdocuments.in/reader034/viewer/2022051503/5a6d40b97f8b9ac2418b59b3/html5/thumbnails/7.jpg)
The DevOps principles: CAMS
(a definition of DevOps)
Culture
Automation
Measurement
Sharing
(Damon Edwards and John Willis, 2010 http://devopsdictionary.com/wiki/CAMS)
![Page 8: An introduction to terraform](https://reader034.fdocuments.in/reader034/viewer/2022051503/5a6d40b97f8b9ac2418b59b3/html5/thumbnails/8.jpg)
AutomationAutomate all the things
Version Control
Continuous Integration and Deployment
Infrastructure as Code
![Page 9: An introduction to terraform](https://reader034.fdocuments.in/reader034/viewer/2022051503/5a6d40b97f8b9ac2418b59b3/html5/thumbnails/9.jpg)
Terraform
![Page 10: An introduction to terraform](https://reader034.fdocuments.in/reader034/viewer/2022051503/5a6d40b97f8b9ac2418b59b3/html5/thumbnails/10.jpg)
TerraformOpen Source
Mozilla Public License 2.0
Created by Hashicorp (vagrant, consul, packer,vault)
Started in 2014
Written in Go
Pluggable
![Page 11: An introduction to terraform](https://reader034.fdocuments.in/reader034/viewer/2022051503/5a6d40b97f8b9ac2418b59b3/html5/thumbnails/11.jpg)
What is terraform?
![Page 12: An introduction to terraform](https://reader034.fdocuments.in/reader034/viewer/2022051503/5a6d40b97f8b9ac2418b59b3/html5/thumbnails/12.jpg)
Terraform original goalTerraform is a tool to Build, Change, and VersionControl your infrastructure.
![Page 13: An introduction to terraform](https://reader034.fdocuments.in/reader034/viewer/2022051503/5a6d40b97f8b9ac2418b59b3/html5/thumbnails/13.jpg)
Building infrastructureTalk to multiple cloud/infrasctucture providers
Ensure creation and consistency
Express in an API-Agnostic DSL
![Page 14: An introduction to terraform](https://reader034.fdocuments.in/reader034/viewer/2022051503/5a6d40b97f8b9ac2418b59b3/html5/thumbnails/14.jpg)
Change infrastructureApply incremental changes
Destroy when needed
Preview changes
Scale easily
![Page 15: An introduction to terraform](https://reader034.fdocuments.in/reader034/viewer/2022051503/5a6d40b97f8b9ac2418b59b3/html5/thumbnails/15.jpg)
Version controlHCL language
State file (don't store it in your git repo)
![Page 16: An introduction to terraform](https://reader034.fdocuments.in/reader034/viewer/2022051503/5a6d40b97f8b9ac2418b59b3/html5/thumbnails/16.jpg)
Terraform concepts
![Page 17: An introduction to terraform](https://reader034.fdocuments.in/reader034/viewer/2022051503/5a6d40b97f8b9ac2418b59b3/html5/thumbnails/17.jpg)
Variables
Terraform takes variables as input
Typed variables
JSON, HCL or CLI
![Page 18: An introduction to terraform](https://reader034.fdocuments.in/reader034/viewer/2022051503/5a6d40b97f8b9ac2418b59b3/html5/thumbnails/18.jpg)
OutputOutput specific text, ip addresses, ...
Console or JSON
![Page 19: An introduction to terraform](https://reader034.fdocuments.in/reader034/viewer/2022051503/5a6d40b97f8b9ac2418b59b3/html5/thumbnails/19.jpg)
Providers
Configuration of a resource provider
e.g.: cloud, dns provider, ...
Often require URL, API Key, ...
![Page 20: An introduction to terraform](https://reader034.fdocuments.in/reader034/viewer/2022051503/5a6d40b97f8b9ac2418b59b3/html5/thumbnails/20.jpg)
Modules
Group of resources
Takes parameters
Returns output
![Page 21: An introduction to terraform](https://reader034.fdocuments.in/reader034/viewer/2022051503/5a6d40b97f8b9ac2418b59b3/html5/thumbnails/21.jpg)
Plan
terraform plan
Creates a plan of changes required
Does nothing to the infra
![Page 22: An introduction to terraform](https://reader034.fdocuments.in/reader034/viewer/2022051503/5a6d40b97f8b9ac2418b59b3/html5/thumbnails/22.jpg)
Apply
terraform apply
Applies a plan, make all the changes
Can make the plan before if needed
![Page 23: An introduction to terraform](https://reader034.fdocuments.in/reader034/viewer/2022051503/5a6d40b97f8b9ac2418b59b3/html5/thumbnails/23.jpg)
Statefile
Current know state of the infra
Stored in file or externally
Locking
![Page 24: An introduction to terraform](https://reader034.fdocuments.in/reader034/viewer/2022051503/5a6d40b97f8b9ac2418b59b3/html5/thumbnails/24.jpg)
Destroy
terraform destroy
Delete all the resources
resources can be "protected" in config
![Page 25: An introduction to terraform](https://reader034.fdocuments.in/reader034/viewer/2022051503/5a6d40b97f8b9ac2418b59b3/html5/thumbnails/25.jpg)
Enough talking!
Demo!
![Page 26: An introduction to terraform](https://reader034.fdocuments.in/reader034/viewer/2022051503/5a6d40b97f8b9ac2418b59b3/html5/thumbnails/26.jpg)
More!https://terraform.io
terraform's cousins: packer, consul, vagrant,vault, ...