$30 off During Our Annual Pro Sale. View Details »

Workshop de Terraform

Workshop de Terraform

Pequeña charla sobre Terraform que di en nerdearla 2016, contando mi experiencia usando terraform en mi trabajo (invisionapp.com) Buenos Aires, Argentina

Pablo Fredrikson

June 23, 2017
Tweet

More Decks by Pablo Fredrikson

Other Decks in Technology

Transcript

  1. Terraform: Infraestructura como código bit.ly/pablokbs-1

  2. Pablo Fredrikson @pablokbs Devops Leader @ invisionapp Nerd 10 años

    con Linux
  3. En la prehistoria...

  4. En la prehistoria...

  5. Y encima...

  6. Ah, y también

  7. Recapitulemos Código para los servicios Código para aprovisionar servidores (chef,

    puppet) Código para generar los trabajos para Jenkins (Job DSL) Servidores (+DNS, +ELBs, etc) a mano
  8. ¿Qué necesitamos? Poder tener una lista de nuestra infraestructura completa

    (conteniendo servers y recursos externos como DNS, CDN, S3, SQS, etc) Manejar infraestructura de forma simple y rápida Manejar el ciclo de vida de los recursos Portabilidad entre proveedores (Google, Digital Ocean, AWS, DNSimple, CloudFare) Que sea seguro OpenSource
  9. resource "digitalocean_droplet" "web" { name = "tf-web" size = "512mb"

    image = "centos-5-8-x32" region = "sfo1" } resource "dnsimple_record" "hello" { domain = "example.com" name = "test" value = "${digitalocean_droplet.web.ipv4_address}" type = "A" } Terraform
  10. $ terraform plan ¿Cómo se usa? $ terraform apply

  11. + digitalocean_droplet.web backups: "" => "<computed>" image: "" => "centos-5-8-x32"

    ipv4_address: "" => "<computed>" ipv4_address_private: "" => "<computed>" name: "" => "tf-web" private_networking "" => "<computed>" region: "" => "sfo1" size: "" => "512mb" status "" => "<computed>" + dnsimple_record.hello domain: "" => "example.com" domain_id: "" => "<computed>" hostname: "" => "<computed>" name: "" => "test" priority: "" => "<computed>" ttl: "" => "<computed>" type: "" => "A" value: "" => "${digitalocean_droplet.web.ipv4_address}"
  12. Terraform Siempre usar plan $ terraform apply ... Apply complete!

    Resources: 0 added, 0 changed, 180 destroyed. TERRORFORM
  13. Plugins y proveedores

  14. terraform modules module "consul" { source = "github.com/hashicorp/consul/terraform/aws" servers =

    5 version = "0.4.0" } resource "dnsimple_record" "consul" { domain = "example.com" name = "consul" value = "${module.consul.ip_address}" type = "A" }
  15. Demo - Q&A