SlideShare ist ein Scribd-Unternehmen logo
1 von 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

Weitere ähnliche Inhalte

Was ist angesagt?

Comprehensive Terraform Training
Comprehensive Terraform TrainingComprehensive Terraform Training
Comprehensive Terraform TrainingYevgeniy Brikman
 
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
 
Terraform introduction
Terraform introductionTerraform introduction
Terraform introductionJason Vance
 
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
 
Terraform modules restructured
Terraform modules restructuredTerraform modules restructured
Terraform modules restructuredAmi Mahloof
 
Configuration management II - Terraform
Configuration management II - TerraformConfiguration management II - Terraform
Configuration management II - TerraformXavier Serrat Bordas
 
An introduction to terraform
An introduction to terraformAn introduction to terraform
An introduction to terraformJulien Pivotto
 
Infrastructure-as-Code (IaC) Using Terraform (Intermediate Edition)
Infrastructure-as-Code (IaC) Using Terraform (Intermediate Edition)Infrastructure-as-Code (IaC) Using Terraform (Intermediate Edition)
Infrastructure-as-Code (IaC) Using Terraform (Intermediate Edition)Adin Ermie
 
Developing Terraform Modules at Scale - HashiTalks 2021
Developing Terraform Modules at Scale - HashiTalks 2021Developing Terraform Modules at Scale - HashiTalks 2021
Developing Terraform Modules at Scale - HashiTalks 2021TomStraub5
 

Was ist angesagt? (20)

Comprehensive Terraform Training
Comprehensive Terraform TrainingComprehensive Terraform Training
Comprehensive Terraform Training
 
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
 
Final terraform
Final terraformFinal terraform
Final terraform
 
Terraform introduction
Terraform introductionTerraform introduction
Terraform introduction
 
Effective terraform
Effective terraformEffective terraform
Effective terraform
 
Terraform
TerraformTerraform
Terraform
 
AWS CloudFormation Masterclass
AWS CloudFormation MasterclassAWS CloudFormation Masterclass
AWS CloudFormation Masterclass
 
Terraform on Azure
Terraform on AzureTerraform on Azure
Terraform on Azure
 
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...
 
Terraform modules restructured
Terraform modules restructuredTerraform modules restructured
Terraform modules restructured
 
Terraform on Azure
Terraform on AzureTerraform on Azure
Terraform on Azure
 
Terraform
TerraformTerraform
Terraform
 
Terraform
TerraformTerraform
Terraform
 
Configuration management II - Terraform
Configuration management II - TerraformConfiguration management II - Terraform
Configuration management II - Terraform
 
An introduction to terraform
An introduction to terraformAn introduction to terraform
An introduction to terraform
 
Terraform
TerraformTerraform
Terraform
 
Infrastructure-as-Code (IaC) Using Terraform (Intermediate Edition)
Infrastructure-as-Code (IaC) Using Terraform (Intermediate Edition)Infrastructure-as-Code (IaC) Using Terraform (Intermediate Edition)
Infrastructure-as-Code (IaC) Using Terraform (Intermediate Edition)
 
Developing Terraform Modules at Scale - HashiTalks 2021
Developing Terraform Modules at Scale - HashiTalks 2021Developing Terraform Modules at Scale - HashiTalks 2021
Developing Terraform Modules at Scale - HashiTalks 2021
 

Ähnlich wie Terraform infraestructura como código

Terraform in deployment pipeline
Terraform in deployment pipelineTerraform in deployment pipeline
Terraform in deployment pipelineAnton Babenko
 
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
 
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
 
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
 

Ähnlich wie Terraform infraestructura como código (20)

London HUG 12/4
London HUG 12/4London HUG 12/4
London HUG 12/4
 
Terraform in deployment pipeline
Terraform in deployment pipelineTerraform in deployment pipeline
Terraform in deployment pipeline
 
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
 
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)
 
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
 

Mehr von 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
 

Mehr von 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
 

Kürzlich hochgeladen

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
 
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
 
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
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
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
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
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 future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
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
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 

Kürzlich hochgeladen (20)

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
 
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
 
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...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
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
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 

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}" } }

Hinweis der Redaktion

  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