Upgrade to Pro — share decks privately, control downloads, hide ads and more …

[2017.04] Meetup #12] [TALK] André Bação - Terr...

[2017.04] Meetup #12] [TALK] André Bação - Terraform your Cloud

An introduction to the power of managed infrastructure with Terraform. In this talk we will see how to start using Terraform from the ground up and how to achieve a cloud infrastructure by code.

André Bação: Linux Lover by choice, Open-source supporter by mind and DevOps by profession.

GitHub rep: https://github.com/abacao/devopslx-terraform

DevOps Lisbon

April 10, 2017
Tweet

More Decks by DevOps Lisbon

Other Decks in Technology

Transcript

  1. It is an open source tool that codifies APIs into

    declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed and versioned.
  2. Terraform syntax and interpolation are part of a open source

    language and specification called HCL – Hashicorp Configuration Language. * HCL is written in Go and looks a bit like NGINX
  3. Advantages of Terraform? Hashicorp Terraform AWS CloudFormation Open source VS

    Closed Source Multi Cloud VS Amazon only HCL VS JSON or YAML
  4. Advantages of Terraform? Hashicorp Terraform AWS CloudFormation Open source VS

    Closed Source Multi Cloud VS Amazon only HCL VS JSON or YAML Managing States VS No States
  5. Resource It represents a component of a given provider such

    as: • AWS Instance • Bitbucket Repository
  6. Resource It represents a component of a given provider such

    as: • AWS Instance • Bitbucket Repository • Cloudflare Record
  7. Resource It represents a component of a given provider such

    as: • AWS Instance • Bitbucket Repository • Cloudflare Record • DigitalOcean Volume
  8. Resource It represents a component of a given provider such

    as: • AWS Instance • Bitbucket Repository • Cloudflare Record • DigitalOcean Volume • Azure SQL Server
  9. Resource Resources have both: • Arguments (inputs) • Attributes (outputs)

    These are specific to each resource. Resources also have meta-parameters such as count and lifecycle.
  10. (Resource) Argument The resource “aws_instance” accepts as input: • ami

    • associate_public_ip_address • availability_zone • volume_size
  11. (Resource) Attribute This is an output or a computed value

    only available after the resource creation. For example: public_ip
  12. DigitalOcean Provider Example: provider "digitalocean" { token = "${var.do_token}" }

    resource "digitalocean_droplet" "devops" { image = "ubuntu-16-04-x64" region = "fra1" size = "512mb" name = "devops-tf-1" }
  13. AWS Provider Example: provider "aws" { access_key = "${var.aws_access_key}" secret_key

    = "${var.aws_secret_key}" region = "${var.aws_region}" } resource "aws_instance" "master" { instance_type = "t2.micro" ami = "ami-e4c63e8b" }
  14. Variables File: variable "aws_accesskey" { description = <<DESCRIPTION Insert your

    AccessKey: DESCRIPTION } variable "aws_region" { description = <<DESCRIPTION Your Favourite Region: DESCRIPTION default = "eu-central-1" }
  15. + +