Successfully reported this slideshow.
Your SlideShare is downloading. ×

Using Terraform.io (Human Talks Montpellier, Epitech, 2014/09/09)

Ad

Using Terraform.io 
Build & Change an Infrastructure with Terraform 
2014/09/09

Ad

`whoami` 
@sjourdan 
@greenalto

Ad

Vagrant?

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Loading in …3
×

Check these out next

1 of 49 Ad
1 of 49 Ad

More Related Content

Using Terraform.io (Human Talks Montpellier, Epitech, 2014/09/09)

  1. 1. Using Terraform.io Build & Change an Infrastructure with Terraform 2014/09/09
  2. 2. `whoami` @sjourdan @greenalto
  3. 3. Vagrant?
  4. 4. Vagrant For development environments
  5. 5. Vagrant Mimic production environments
  6. 6. Vagrant !sharing !durability !evolution !services !production
  7. 7. Terraform
  8. 8. Terraform Infrastructure? servers, VMs (EC2, DigitalOcean…) services (Heroku, ELB, EIP…) DNS (DNSimple,…) email (Mailgun…)
  9. 9. Terraform
  10. 10. Terraform
  11. 11. Terraform APIs
  12. 12. Terraform
  13. 13. Terraform Launch infrastructure Change infrastructure
  14. 14. Terraform Simple file based configuration
  15. 15. 5 days since CoreOS on DO
  16. 16. Terraform resource "digitalocean_droplet" "coreos-1" { }
  17. 17. Terraform resource "digitalocean_droplet" "coreos-1" { name = “coreos-1” }
  18. 18. Terraform resource "digitalocean_droplet" "coreos-1" { name = “coreos-1” size = "512mb" }
  19. 19. Terraform resource "digitalocean_droplet" "coreos-1" { name = “coreos-1” size = “512mb" image = "coreos-alpha" }
  20. 20. Terraform resource "digitalocean_droplet" "coreos-1" { name = “coreos-1” size = “512mb" image = “coreos-alpha" region = "nyc3" }
  21. 21. Terraform resource "digitalocean_droplet" "coreos-1" { name = “coreos-1” size = “512mb" image = “coreos-alpha" region = “nyc3" private_networking = true }
  22. 22. Terraform resource "digitalocean_droplet" "coreos-1" { name = “coreos-1” size = “512mb" image = “coreos-alpha" region = “nyc3" private_networking = true ssh_keys = [ "131228" ] }
  23. 23. Terraform $ terraform apply
  24. 24. Terraform $ terraform apply digitalocean_droplet.ht-coreos-1: Creating... image: "" => "coreos-alpha" name: "" => "ht-coreos-1" private_networking: "" => "true" region: "" => "nyc3" size: "" => "512mb" ssh_keys.#: "" => "1" ssh_keys.0: "" => "131228" digitalocean_droplet.ht-coreos-1: Creation complete ! Apply complete! Resources: 1 added, 0 changed, 0 destroyed. ! The state of your infrastructure has been saved to the path below. This state is required to modify and destroy your infrastructure, so keep it safe. To inspect the complete state use the `terraform show` command. ! State path: terraform.tfstate
  25. 25. Terraform $ terraform show terraform.tfstate
  26. 26. Terraform $ terraform show terraform.tfstate digitalocean_droplet.ht-coreos-1: id = 2574081 image = coreos-alpha ipv4_address = 104.131.47.30 ipv4_address_private = 10.132.241.137 locked = false name = ht-coreos-1 private_networking = true region = nyc3 size = 512mb ssh_keys.# = 1 ssh_keys.0 = 131228 status = active
  27. 27. Terraform
  28. 28. Terraform Scale? Handle Change?
  29. 29. Terraform
  30. 30. Terraform $ terraform plan
  31. 31. Terraform $ terraform plan -out=terraform.plan ! + digitalocean_droplet.ht-coreos-2 ! […] ! + digitalocean_droplet.ht-coreos-3 […]
  32. 32. Terraform $ terraform apply digitalocean_droplet.ht-coreos-1: Refreshing state... (ID: 2574081) digitalocean_droplet.ht-coreos-2: Creating... […] digitalocean_droplet.ht-coreos-3: Creating... […] digitalocean_droplet.ht-coreos-3: Creation complete digitalocean_droplet.ht-coreos-2: Creation complete ! Apply complete! Resources: 2 added, 0 changed, 0 destroyed.
  33. 33. Terraform
  34. 34. Terraform Downscale ?
  35. 35. Terraform $ terraform plan -out=terraform.plan ! […] - digitalocean_droplet.ht-coreos-1
  36. 36. Terraform $ terraform apply digitalocean_droplet.ht-coreos-1: Refreshing state... (ID: 2574081) digitalocean_droplet.ht-coreos-3: Refreshing state... (ID: 2574214) digitalocean_droplet.ht-coreos-2: Refreshing state... (ID: 2574215) digitalocean_droplet.ht-coreos-1: Destroying... digitalocean_droplet.ht-coreos-1: Destruction complete ! Apply complete! Resources: 0 added, 0 changed, 1 destroyed.
  37. 37. Terraform
  38. 38. Terraform
  39. 39. Terraform terraform.tfstate => git pull your infrastructure state!
  40. 40. Terraform
  41. 41. Terraform
  42. 42. Terraform Provisionners echo, cat or grep myapp.conf Chef, Puppet, Ansible, whatever
  43. 43. Terraform provisioner "remote-exec" { inline = [ "curl -L https://www.opscode.com/chef/ install.sh | sudo bash", "sudo chef-solo -j chef/node.json" ] }
  44. 44. Terraform resource "dnsimple_record" “cluster-1" { domain = “humantalks.com" name = "cluster-1" value = “${digitalocean_droplet.web.ipv4_address}" type = "A" }
  45. 45. Terraform autoscaling_group db_instance security_group eip elb instance route53 s3 …
  46. 46. Terraform (Sept. 2014)
  47. 47. Terraform 2014/07/28: 0.1.0 2014/08/28: 0.2.0
  48. 48. Terraform https://github.com/hashicorp/terraform/ http://www.terraform.io/
  49. 49. Q&A Questions ?

×