an introduction to terraform
TRANSCRIPT
An introduction to Terraform
Julien Pivotto (@roidelapluie)
RMLL, Saint-Étienne
July 4th, 2017
whoamiJulien Pivotto
@roidelapluie
Sysadmin at inuits
Automation, monitoring, HA
RMLL 2013 org team
inuits
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
Challenges of current infraPlanning changes
Executing changes
Working together
Keeping up to date (usable) inventories
DevOps
The DevOps principles: CAMS
(a definition of DevOps)
Culture
Automation
Measurement
Sharing
(Damon Edwards and John Willis, 2010 http://devopsdictionary.com/wiki/CAMS)
AutomationAutomate all the things
Version Control
Continuous Integration and Deployment
Infrastructure as Code
Terraform
TerraformOpen Source
Mozilla Public License 2.0
Created by Hashicorp (vagrant, consul, packer,vault)
Started in 2014
Written in Go
Pluggable
What is terraform?
Terraform original goalTerraform is a tool to Build, Change, and VersionControl your infrastructure.
Building infrastructureTalk to multiple cloud/infrasctucture providers
Ensure creation and consistency
Express in an API-Agnostic DSL
Change infrastructureApply incremental changes
Destroy when needed
Preview changes
Scale easily
Version controlHCL language
State file (don't store it in your git repo)
Terraform concepts
Variables
Terraform takes variables as input
Typed variables
JSON, HCL or CLI
OutputOutput specific text, ip addresses, ...
Console or JSON
Providers
Configuration of a resource provider
e.g.: cloud, dns provider, ...
Often require URL, API Key, ...
Modules
Group of resources
Takes parameters
Returns output
Plan
terraform plan
Creates a plan of changes required
Does nothing to the infra
Apply
terraform apply
Applies a plan, make all the changes
Can make the plan before if needed
Statefile
Current know state of the infra
Stored in file or externally
Locking
Destroy
terraform destroy
Delete all the resources
resources can be "protected" in config
Enough talking!
Demo!
More!https://terraform.io
terraform's cousins: packer, consul, vagrant,vault, ...