SlideShare une entreprise Scribd logo
1  sur  20
Infraestructura como código
Terraform
Victor Adsuar - Arquitecto Cloud
victor@victorasuar.com
https://victoradsuar.com
twitter: @victoradsuar
Me presento
Bienvenidos a la gestión de
infraestructura como código
¿Qué es Terraform?
Producto Open Source de Hashicorp
- Open Source (Mozilla Public License 2.0)
- Sencillo de usar. (HCL)
- Compatible con plataformas de
virtualización y nube
- Planes de ejecución para su versionado
- Gráfico dependencias
Características de Terraform:
- Linux 32 y 64 bits, and ARM.
- Mac Os X, 32 y 64 bits.
- FreeBSD 32 y 64 bits.
- OpenBSD 32 y 64 bits.
- Illumos Distributions 64 bits
- Windows 32 y 64 bits.
¿Dónde podemos instalar Terraform?
- Linux 32 y 64 bits, and ARM.
- Mac Os X, 32 y 64 bits.
- FreeBSD 32 y 64 bits.
- OpenBSD 32 y 64 bits.
- Illumos Distributions 64 bits
- Windows 32 y 64 bits.
¿Dónde podemos instalar Terraform?
Instalación Linux
$ wget https://releases.hashicorp.com/terraform/0.10.0/terraform_0.10.0_linux_amd64.zip
$ unzip https://releases.hashicorp.com/terraform/0.10.0/terraform_0.10.0_linux_amd64.zip
$ sudo mv terraform /usr/local/bin
$ chown -R root:root /usr/local/bin/terraform
Instalación Windows
C:> MKDIR terraform
C:> CD terraform
https://releases.hashicorp.com/terraform/0.10.0/terraform_0.10.0_windows_amd64.zip
Add Path $env:Path += ";C:terraform"
Instalación Mac
$ brew install terraform
Comprobar instalación
$ terraform version
Terraform v0.10.0
$ terraform help
terraform help
Usage: terraform [--version] [--help] <command> [args]
Common commands:
apply Builds or changes infrastructure
console Interactive console for Terraform interpolations
destroy Destroy Terraform-managed infrastructure
env Workspace management
fmt Rewrites config files to canonical format
get Download and install modules for the configuration
graph Create a visual graph of Terraform resources
import Import existing infrastructure into Terraform
init Initialize a Terraform working directory
output Read an output from a state file
plan Generate and show an execution plan
providers Prints a tree of the providers used in the configuration
push Upload this Terraform module to Atlas to run
refresh Update local state file against real resources
show Inspect Terraform state or plan
taint Manually mark a resource for recreation
untaint Manually unmark a resource as tainted
validate Validates the Terraform files
version Prints the Terraform version
workspace Workspace management
All other commands:
debug Debug output management (experimental)
force-unlock Manually unlock the terraform state
state Advanced state management
Variables
Modules
Resources
Output
state
Terraform State
/* This is a multi-line comment. This is a multi-line comment. This is a multi-line comment.
This is a multi-line comment. This is a multi-line comment. This is a multi-line comment. */
provider "aws" {
region = "eu-west-1"
}
# This is a single-line comment.
resource "aws_instance" "base" {
ami = "ami-ebd02392"
instance_type = "t2.micro"
}
Ejemplo de ec2.tf
Los parámetros no especificados
cogerá los que AWS tenga
definidos por defecto.
Crear infraestructura
Iniciar Terraform
$ terraform init
Plan
$ terraform plan
$ terraform plan -out base-`date +'%s'`.plan
Crear
$ terraform apply
$ terraform apply base-1503252130.plan
Comprobar
$ terraform show
$ terraform state list
/* This is a multi-line comment. This is a multi-line comment. This is a multi-line comment.
This is a multi-line comment. This is a multi-line comment. This is a multi-line comment. */
provider "aws" {
region = "eu-west-1"
}
# This is a single-line comment.
resource "aws_instance" "base" {
ami = "ami-ebd02392"
instance_type = "t2.micro"
}
resource "aws_eip" "base" {
instance = "${aws_instance.base.id}"
}
Las variables, funciones y atributos
de recursos se referencian
por $ { }
Modificar y Destruir Infraestructura
Modificación
$terraform apply
+ Recurso será añadido
- Recurso será eliminado
-/+ Recurso será eliminado y creado de nuevo
~ Recurso será modificado
Destrucción
$ terraform destroy
Tipo de variables
Strings
“variable "region" {
description = "The AWS
region."
default = "us-east-1"
}”
Maps
“variable "ami" {
type = "map"
default = {
us-east-1 = "ami-0d729a60"
us-west-1 = "ami-7c4b331c"
}
description = "The AMIs to use."
}”
Lists
“variable "security_group_ids"
{
type = "list"
description = "List of
security group IDs."
default = ["sg-4f713c35",
"sg-4f713c35", "sg-4f713c35"]
}”
Carga de variables
Linea de Comando
“terraform plan -var 'access_key=12345 -var
'secret_key=12345”
Desde un fichero (terraform.tfvars)
“access_key = "xyz245"
secret_key = "xyz245"
ami = {
us-east-1 = "ami-0d729a60"
us-west-1 = "ami-7c4b331c"
}”
Variables de Entorno
“TF_VAR_comodin”
$TF_VAR_aws_code = zxy245
Por defecto
“variable "region" {
description = "The AWS region."
default = "eu-west-1"
}”
Módulos
Llamada módulo fichero
module "vpc" {
source = "./modules"
name = "WTFVPC"
cidr = "10.0.0.0/16"
}
Llamada módulo internet
module "vpc" {
source = "github.com/wtf/wtf_vpc
. . .
}
Definición módulo
resource "aws_vpc" "vpc_wtf" {
cidr_block = "${var.cidr}"
enable_dns_hostnames =
"${var.enable_dns_hostnames}"
enable_dns_support =
"${var.enable_dns_support}"
tags {
Name = "${var.name}"
}
}
Aprovisionamiento de Stack
Infraestructura
Imágen
User-Data
Ansible, Puppet,
Chef, etc...
Vamos a desplegar!
Muchas gracias

Contenu connexe

Tendances

Terraform Introduction
Terraform IntroductionTerraform Introduction
Terraform Introductionsoniasnowfrog
 
Terraform in deployment pipeline
Terraform in deployment pipelineTerraform in deployment pipeline
Terraform in deployment pipelineAnton Babenko
 
Best Practices of Infrastructure as Code with Terraform
Best Practices of Infrastructure as Code with TerraformBest Practices of Infrastructure as Code with Terraform
Best Practices of Infrastructure as Code with TerraformDevOps.com
 
Using HashiCorp’s Terraform to build your infrastructure on AWS - Pop-up Loft...
Using HashiCorp’s Terraform to build your infrastructure on AWS - Pop-up Loft...Using HashiCorp’s Terraform to build your infrastructure on AWS - Pop-up Loft...
Using HashiCorp’s Terraform to build your infrastructure on AWS - Pop-up Loft...Amazon Web Services
 
Infrastructure-as-Code (IaC) Using Terraform (Advanced Edition)
Infrastructure-as-Code (IaC) Using Terraform (Advanced Edition)Infrastructure-as-Code (IaC) Using Terraform (Advanced Edition)
Infrastructure-as-Code (IaC) Using Terraform (Advanced Edition)Adin Ermie
 
An introduction to terraform
An introduction to terraformAn introduction to terraform
An introduction to terraformJulien Pivotto
 
A brief introduction to IaC with Terraform by Kenton Robbins (codeHarbour May...
A brief introduction to IaC with Terraform by Kenton Robbins (codeHarbour May...A brief introduction to IaC with Terraform by Kenton Robbins (codeHarbour May...
A brief introduction to IaC with Terraform by Kenton Robbins (codeHarbour May...Alex Cachia
 
Infrastructure-as-Code (IaC) using Terraform
Infrastructure-as-Code (IaC) using TerraformInfrastructure-as-Code (IaC) using Terraform
Infrastructure-as-Code (IaC) using TerraformAdin Ermie
 
Terraform -- Infrastructure as Code
Terraform -- Infrastructure as CodeTerraform -- Infrastructure as Code
Terraform -- Infrastructure as CodeMartin Schütte
 
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 2018Anton Babenko
 
Comprehensive Terraform Training
Comprehensive Terraform TrainingComprehensive Terraform Training
Comprehensive Terraform TrainingYevgeniy Brikman
 
Terraform introduction
Terraform introductionTerraform introduction
Terraform introductionJason Vance
 
Kubernetes Helm: Why It Matters
Kubernetes Helm: Why It MattersKubernetes Helm: Why It Matters
Kubernetes Helm: Why It MattersPlatform9
 
Introduction To Terraform
Introduction To TerraformIntroduction To Terraform
Introduction To TerraformSasitha Iresh
 

Tendances (20)

Terraform Introduction
Terraform IntroductionTerraform Introduction
Terraform Introduction
 
Terraform in deployment pipeline
Terraform in deployment pipelineTerraform in deployment pipeline
Terraform in deployment pipeline
 
Best Practices of Infrastructure as Code with Terraform
Best Practices of Infrastructure as Code with TerraformBest Practices of Infrastructure as Code with Terraform
Best Practices of Infrastructure as Code with Terraform
 
Terraform
TerraformTerraform
Terraform
 
Terraform
TerraformTerraform
Terraform
 
Using HashiCorp’s Terraform to build your infrastructure on AWS - Pop-up Loft...
Using HashiCorp’s Terraform to build your infrastructure on AWS - Pop-up Loft...Using HashiCorp’s Terraform to build your infrastructure on AWS - Pop-up Loft...
Using HashiCorp’s Terraform to build your infrastructure on AWS - Pop-up Loft...
 
Infrastructure-as-Code (IaC) Using Terraform (Advanced Edition)
Infrastructure-as-Code (IaC) Using Terraform (Advanced Edition)Infrastructure-as-Code (IaC) Using Terraform (Advanced Edition)
Infrastructure-as-Code (IaC) Using Terraform (Advanced Edition)
 
An introduction to terraform
An introduction to terraformAn introduction to terraform
An introduction to terraform
 
Effective terraform
Effective terraformEffective terraform
Effective terraform
 
A brief introduction to IaC with Terraform by Kenton Robbins (codeHarbour May...
A brief introduction to IaC with Terraform by Kenton Robbins (codeHarbour May...A brief introduction to IaC with Terraform by Kenton Robbins (codeHarbour May...
A brief introduction to IaC with Terraform by Kenton Robbins (codeHarbour May...
 
Terraform
TerraformTerraform
Terraform
 
Infrastructure-as-Code (IaC) using Terraform
Infrastructure-as-Code (IaC) using TerraformInfrastructure-as-Code (IaC) using Terraform
Infrastructure-as-Code (IaC) using Terraform
 
Terraform -- Infrastructure as Code
Terraform -- Infrastructure as CodeTerraform -- Infrastructure as Code
Terraform -- Infrastructure as Code
 
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
 
Comprehensive Terraform Training
Comprehensive Terraform TrainingComprehensive Terraform Training
Comprehensive Terraform Training
 
Terraform introduction
Terraform introductionTerraform introduction
Terraform introduction
 
Terraform
TerraformTerraform
Terraform
 
Kubernetes Helm: Why It Matters
Kubernetes Helm: Why It MattersKubernetes Helm: Why It Matters
Kubernetes Helm: Why It Matters
 
Introduction To Terraform
Introduction To TerraformIntroduction To Terraform
Introduction To Terraform
 
Terraform
TerraformTerraform
Terraform
 

Similaire à Terraform infraestructura como código

Terraform at Scale - All Day DevOps 2017
Terraform at Scale - All Day DevOps 2017Terraform at Scale - All Day DevOps 2017
Terraform at Scale - All Day DevOps 2017Jonathon Brouse
 
DevOps Enabling Your Team
DevOps Enabling Your TeamDevOps Enabling Your Team
DevOps Enabling Your TeamGR8Conf
 
"Continuously delivering infrastructure using Terraform and Packer" training ...
"Continuously delivering infrastructure using Terraform and Packer" training ..."Continuously delivering infrastructure using Terraform and Packer" training ...
"Continuously delivering infrastructure using Terraform and Packer" training ...Anton Babenko
 
leboncoin DataEngineering / Terraform - beginner to advanced
leboncoin DataEngineering / Terraform - beginner to advancedleboncoin DataEngineering / Terraform - beginner to advanced
leboncoin DataEngineering / Terraform - beginner to advancedleboncoin engineering
 
Introductory Overview to Managing AWS with Terraform
Introductory Overview to Managing AWS with TerraformIntroductory Overview to Managing AWS with Terraform
Introductory Overview to Managing AWS with TerraformMichael Heyns
 
A Hands-on Introduction on Terraform Best Concepts and Best Practices
A Hands-on Introduction on Terraform Best Concepts and Best Practices A Hands-on Introduction on Terraform Best Concepts and Best Practices
A Hands-on Introduction on Terraform Best Concepts and Best Practices Nebulaworks
 
Terraform Modules and Continuous Deployment
Terraform Modules and Continuous DeploymentTerraform Modules and Continuous Deployment
Terraform Modules and Continuous DeploymentZane Williamson
 
Introduction to Apache Mesos
Introduction to Apache MesosIntroduction to Apache Mesos
Introduction to Apache MesosJoe Stein
 
OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...
OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...
OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...NETWAYS
 
Introduction To Apache Mesos
Introduction To Apache MesosIntroduction To Apache Mesos
Introduction To Apache MesosJoe Stein
 
An intro to Docker, Terraform, and Amazon ECS
An intro to Docker, Terraform, and Amazon ECSAn intro to Docker, Terraform, and Amazon ECS
An intro to Docker, Terraform, and Amazon ECSYevgeniy Brikman
 
Using Terraform to manage the configuration of a Cisco ACI fabric.
Using Terraform to manage the configuration of a Cisco ACI fabric.Using Terraform to manage the configuration of a Cisco ACI fabric.
Using Terraform to manage the configuration of a Cisco ACI fabric.Joel W. King
 
Workshop Infrastructure as Code - Suestra
Workshop Infrastructure as Code - SuestraWorkshop Infrastructure as Code - Suestra
Workshop Infrastructure as Code - SuestraMario IC
 
Infrastructure as Code for Azure: ARM or Terraform?
Infrastructure as Code for Azure: ARM or Terraform?Infrastructure as Code for Azure: ARM or Terraform?
Infrastructure as Code for Azure: ARM or Terraform?Katherine Golovinova
 
Debasihish da final.ppt
Debasihish da final.pptDebasihish da final.ppt
Debasihish da final.pptKalkey
 
Terraform on Oracle Cloud Infrastructure: A Primer for Database Administrators
Terraform on Oracle Cloud Infrastructure: A Primer for Database AdministratorsTerraform on Oracle Cloud Infrastructure: A Primer for Database Administrators
Terraform on Oracle Cloud Infrastructure: A Primer for Database AdministratorsSean Scott
 
Fullstack conf 2017 - Basic dev pipeline end-to-end
Fullstack conf 2017 - Basic dev pipeline end-to-endFullstack conf 2017 - Basic dev pipeline end-to-end
Fullstack conf 2017 - Basic dev pipeline end-to-endEzequiel Maraschio
 

Similaire à Terraform infraestructura como código (20)

London HUG 12/4
London HUG 12/4London HUG 12/4
London HUG 12/4
 
Terraform at Scale - All Day DevOps 2017
Terraform at Scale - All Day DevOps 2017Terraform at Scale - All Day DevOps 2017
Terraform at Scale - All Day DevOps 2017
 
DevOps Enabling Your Team
DevOps Enabling Your TeamDevOps Enabling Your Team
DevOps Enabling Your Team
 
"Continuously delivering infrastructure using Terraform and Packer" training ...
"Continuously delivering infrastructure using Terraform and Packer" training ..."Continuously delivering infrastructure using Terraform and Packer" training ...
"Continuously delivering infrastructure using Terraform and Packer" training ...
 
leboncoin DataEngineering / Terraform - beginner to advanced
leboncoin DataEngineering / Terraform - beginner to advancedleboncoin DataEngineering / Terraform - beginner to advanced
leboncoin DataEngineering / Terraform - beginner to advanced
 
Terraform in action
Terraform in actionTerraform in action
Terraform in action
 
Introductory Overview to Managing AWS with Terraform
Introductory Overview to Managing AWS with TerraformIntroductory Overview to Managing AWS with Terraform
Introductory Overview to Managing AWS with Terraform
 
A Hands-on Introduction on Terraform Best Concepts and Best Practices
A Hands-on Introduction on Terraform Best Concepts and Best Practices A Hands-on Introduction on Terraform Best Concepts and Best Practices
A Hands-on Introduction on Terraform Best Concepts and Best Practices
 
Terraform Modules and Continuous Deployment
Terraform Modules and Continuous DeploymentTerraform Modules and Continuous Deployment
Terraform Modules and Continuous Deployment
 
Introduction to Apache Mesos
Introduction to Apache MesosIntroduction to Apache Mesos
Introduction to Apache Mesos
 
OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...
OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...
OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...
 
Introduction To Apache Mesos
Introduction To Apache MesosIntroduction To Apache Mesos
Introduction To Apache Mesos
 
An intro to Docker, Terraform, and Amazon ECS
An intro to Docker, Terraform, and Amazon ECSAn intro to Docker, Terraform, and Amazon ECS
An intro to Docker, Terraform, and Amazon ECS
 
Using Terraform to manage the configuration of a Cisco ACI fabric.
Using Terraform to manage the configuration of a Cisco ACI fabric.Using Terraform to manage the configuration of a Cisco ACI fabric.
Using Terraform to manage the configuration of a Cisco ACI fabric.
 
Workshop Infrastructure as Code - Suestra
Workshop Infrastructure as Code - SuestraWorkshop Infrastructure as Code - Suestra
Workshop Infrastructure as Code - Suestra
 
Terraform day02
Terraform day02Terraform day02
Terraform day02
 
Infrastructure as Code for Azure: ARM or Terraform?
Infrastructure as Code for Azure: ARM or Terraform?Infrastructure as Code for Azure: ARM or Terraform?
Infrastructure as Code for Azure: ARM or Terraform?
 
Debasihish da final.ppt
Debasihish da final.pptDebasihish da final.ppt
Debasihish da final.ppt
 
Terraform on Oracle Cloud Infrastructure: A Primer for Database Administrators
Terraform on Oracle Cloud Infrastructure: A Primer for Database AdministratorsTerraform on Oracle Cloud Infrastructure: A Primer for Database Administrators
Terraform on Oracle Cloud Infrastructure: A Primer for Database Administrators
 
Fullstack conf 2017 - Basic dev pipeline end-to-end
Fullstack conf 2017 - Basic dev pipeline end-to-endFullstack conf 2017 - Basic dev pipeline end-to-end
Fullstack conf 2017 - Basic dev pipeline end-to-end
 

Plus de Victor Adsuar

AWS Valencia Meetup v2
AWS Valencia Meetup v2AWS Valencia Meetup v2
AWS Valencia Meetup v2Victor Adsuar
 
AWS Valencia Meetup v3
AWS Valencia Meetup v3AWS Valencia Meetup v3
AWS Valencia Meetup v3Victor Adsuar
 
AWS Cloud Levante Meetup 2v
AWS Cloud Levante Meetup 2vAWS Cloud Levante Meetup 2v
AWS Cloud Levante Meetup 2vVictor Adsuar
 
Data Beers ALC 15 mayo 2019
Data Beers ALC 15 mayo 2019Data Beers ALC 15 mayo 2019
Data Beers ALC 15 mayo 2019Victor Adsuar
 
Cloud Levante MeetUp V3
Cloud Levante MeetUp V3Cloud Levante MeetUp V3
Cloud Levante MeetUp V3Victor Adsuar
 
Integración y migración a aws
Integración y migración a awsIntegración y migración a aws
Integración y migración a awsVictor Adsuar
 

Plus de Victor Adsuar (6)

AWS Valencia Meetup v2
AWS Valencia Meetup v2AWS Valencia Meetup v2
AWS Valencia Meetup v2
 
AWS Valencia Meetup v3
AWS Valencia Meetup v3AWS Valencia Meetup v3
AWS Valencia Meetup v3
 
AWS Cloud Levante Meetup 2v
AWS Cloud Levante Meetup 2vAWS Cloud Levante Meetup 2v
AWS Cloud Levante Meetup 2v
 
Data Beers ALC 15 mayo 2019
Data Beers ALC 15 mayo 2019Data Beers ALC 15 mayo 2019
Data Beers ALC 15 mayo 2019
 
Cloud Levante MeetUp V3
Cloud Levante MeetUp V3Cloud Levante MeetUp V3
Cloud Levante MeetUp V3
 
Integración y migración a aws
Integración y migración a awsIntegración y migración a aws
Integración y migración a aws
 

Dernier

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 - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
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
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 

Dernier (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 - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
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
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 

Terraform infraestructura como código

  • 2. Victor Adsuar - Arquitecto Cloud victor@victorasuar.com https://victoradsuar.com twitter: @victoradsuar Me presento
  • 3. Bienvenidos a la gestión de infraestructura como código ¿Qué es Terraform?
  • 4. Producto Open Source de Hashicorp
  • 5. - Open Source (Mozilla Public License 2.0) - Sencillo de usar. (HCL) - Compatible con plataformas de virtualización y nube - Planes de ejecución para su versionado - Gráfico dependencias Características de Terraform:
  • 6. - Linux 32 y 64 bits, and ARM. - Mac Os X, 32 y 64 bits. - FreeBSD 32 y 64 bits. - OpenBSD 32 y 64 bits. - Illumos Distributions 64 bits - Windows 32 y 64 bits. ¿Dónde podemos instalar Terraform?
  • 7. - Linux 32 y 64 bits, and ARM. - Mac Os X, 32 y 64 bits. - FreeBSD 32 y 64 bits. - OpenBSD 32 y 64 bits. - Illumos Distributions 64 bits - Windows 32 y 64 bits. ¿Dónde podemos instalar Terraform?
  • 8. Instalación Linux $ wget https://releases.hashicorp.com/terraform/0.10.0/terraform_0.10.0_linux_amd64.zip $ unzip https://releases.hashicorp.com/terraform/0.10.0/terraform_0.10.0_linux_amd64.zip $ sudo mv terraform /usr/local/bin $ chown -R root:root /usr/local/bin/terraform Instalación Windows C:> MKDIR terraform C:> CD terraform https://releases.hashicorp.com/terraform/0.10.0/terraform_0.10.0_windows_amd64.zip Add Path $env:Path += ";C:terraform" Instalación Mac $ brew install terraform
  • 9. Comprobar instalación $ terraform version Terraform v0.10.0 $ terraform help terraform help Usage: terraform [--version] [--help] <command> [args] Common commands: apply Builds or changes infrastructure console Interactive console for Terraform interpolations destroy Destroy Terraform-managed infrastructure env Workspace management fmt Rewrites config files to canonical format get Download and install modules for the configuration graph Create a visual graph of Terraform resources import Import existing infrastructure into Terraform init Initialize a Terraform working directory output Read an output from a state file plan Generate and show an execution plan providers Prints a tree of the providers used in the configuration push Upload this Terraform module to Atlas to run refresh Update local state file against real resources show Inspect Terraform state or plan taint Manually mark a resource for recreation untaint Manually unmark a resource as tainted validate Validates the Terraform files version Prints the Terraform version workspace Workspace management All other commands: debug Debug output management (experimental) force-unlock Manually unlock the terraform state state Advanced state management
  • 11. /* This is a multi-line comment. This is a multi-line comment. This is a multi-line comment. This is a multi-line comment. This is a multi-line comment. This is a multi-line comment. */ provider "aws" { region = "eu-west-1" } # This is a single-line comment. resource "aws_instance" "base" { ami = "ami-ebd02392" instance_type = "t2.micro" } Ejemplo de ec2.tf Los parámetros no especificados cogerá los que AWS tenga definidos por defecto.
  • 12. Crear infraestructura Iniciar Terraform $ terraform init Plan $ terraform plan $ terraform plan -out base-`date +'%s'`.plan Crear $ terraform apply $ terraform apply base-1503252130.plan Comprobar $ terraform show $ terraform state list
  • 13. /* This is a multi-line comment. This is a multi-line comment. This is a multi-line comment. This is a multi-line comment. This is a multi-line comment. This is a multi-line comment. */ provider "aws" { region = "eu-west-1" } # This is a single-line comment. resource "aws_instance" "base" { ami = "ami-ebd02392" instance_type = "t2.micro" } resource "aws_eip" "base" { instance = "${aws_instance.base.id}" } Las variables, funciones y atributos de recursos se referencian por $ { }
  • 14. Modificar y Destruir Infraestructura Modificación $terraform apply + Recurso será añadido - Recurso será eliminado -/+ Recurso será eliminado y creado de nuevo ~ Recurso será modificado Destrucción $ terraform destroy
  • 15. Tipo de variables Strings “variable "region" { description = "The AWS region." default = "us-east-1" }” Maps “variable "ami" { type = "map" default = { us-east-1 = "ami-0d729a60" us-west-1 = "ami-7c4b331c" } description = "The AMIs to use." }” Lists “variable "security_group_ids" { type = "list" description = "List of security group IDs." default = ["sg-4f713c35", "sg-4f713c35", "sg-4f713c35"] }”
  • 16. Carga de variables Linea de Comando “terraform plan -var 'access_key=12345 -var 'secret_key=12345” Desde un fichero (terraform.tfvars) “access_key = "xyz245" secret_key = "xyz245" ami = { us-east-1 = "ami-0d729a60" us-west-1 = "ami-7c4b331c" }” Variables de Entorno “TF_VAR_comodin” $TF_VAR_aws_code = zxy245 Por defecto “variable "region" { description = "The AWS region." default = "eu-west-1" }”
  • 17. Módulos Llamada módulo fichero module "vpc" { source = "./modules" name = "WTFVPC" cidr = "10.0.0.0/16" } Llamada módulo internet module "vpc" { source = "github.com/wtf/wtf_vpc . . . } Definición módulo resource "aws_vpc" "vpc_wtf" { cidr_block = "${var.cidr}" enable_dns_hostnames = "${var.enable_dns_hostnames}" enable_dns_support = "${var.enable_dns_support}" tags { Name = "${var.name}" } }

Notes de l'éditeur

  1. Agradecimientos: Amazon Web Service. Grupo de usuarios de Valencia. CloudLevante: Lynxview y Devopensource.
  2. Ingeniero con algunos años de experiencia en proyectos tecnológicos y 6 años inmerso en proyectos cloud. Después de trabajar en diferentes empresas di un gran salto a trabajar con las personas con las que me identifico con mis valores. Sabes que estás en el camino correcto cuando interiormente tu dejas de ser un obstáculo para avanzar día a día. Cuando los lunes te despiertas con una sonrisa sabes que estás haciendo las cosas bien.
  3. Introducción a la infraestructura como código. La virtualización inició este movimiento, pero el cloud lo está acelerando.
  4. Terraform es un producto creado por Hashicorp para la creación y administración de infraestructura como código. Además incluye otros productos como Vagrant, Packer, Vault, Consul y Nomad. En el caso de infraestructura tenemos Vagrant, Terraform y Packer. Hoy nos centraremos en el uso de Terraform para la administración
  5. Terraform es casi compatible con todo y muy fácil de instalar
  6. Terraform es casi compatible con todo y muy fácil de instalar
  7. Terraform es casi compatible con todo y muy fácil de instalar
  8. La instalación de Terraform es muy simple en todos los sistemas operativos disponibles
  9. La instalación de Terraform es muy simple en todos los sistemas operativos disponibles
  10. Cómo funciona Terraform?
  11. Ejemplo de un fichero terraform básico.
  12. Ejemplo de un fichero terraform básico.
  13. L