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

Infrastructure as code with Terraform - Apericoder CodersTUG

Infrastructure as code with Terraform - Apericoder CodersTUG

Have you ever found tedious to manage cloud services on a scattered ecosystem of GUI and CLI tools pushed by every vendor?
Did you find awful to think on how to do the right things in the right order to change infrastructure to your desired state?
Have you ever destroyed the wrong production VM or removed the wrong DNS record?
Let's take a look to Terraform, an open-source tool for building, changing, and combining infrastructure safely and efficiently, brought to us by Hashicorp (have you ever heard about Vagrant?).

Example code: https://gist.github.com/gionn/787a3fc379eeac0ce01f
ssh_config_generator: https://gist.github.com/gionn/fabbd0f6d6ad897d0338

Giovanni Toraldo

July 03, 2015
Tweet

More Decks by Giovanni Toraldo

Other Decks in Technology

Transcript

  1. Infrastructure as Code
    with Terraform
    Giovanni Toraldo
    Lead developer @ClouDesire
    Twitter: @gionn
    #coderstug #apericoder

    View Slide

  2. View Slide

  3. What is Terraform?
    Like vagrant, but for production

    View Slide

  4. Features
    ● Build, change, destroy resources:
    ○ IaaS: AWS, DigitalOcean, GCE, OpenStack
    ○ PaaS: Heroku, CloudFoundry
    ○ SaaS: Atlas, DNSimple, CloudFlare
    ● Current state is versioned
    ● Generates an execution plan to transition
    from current state to the desired state

    View Slide

  5. Use cases
    ● Multi-tier applications (easy scale up/down)
    ● Self-service clusters (production-like)
    ● Demos (vagrant on clouds)
    ● Disposable environments (staging/QA)
    ● Multi-cloud environments

    View Slide

  6. Demo time!
    https://gist.github.com/gionn/787a3fc379eeac0ce01f

    View Slide

  7. How we use it in ClouDesire
    ● To manage infrastructure and DNS for on-
    demand staging and productions:
    ○ Before: everything by hand, using GUI
    ○ Now: everything with terraform, state versioned on
    git
    ● Custom script to generate ssh_config:
    https://gist.github.com/gionn/fabbd0f6d6ad897d0338
    Used by fabric to knows on which nodes chef-
    solo should be launched

    View Slide

  8. More?
    ● Modules can be created to encapsulate
    resources in a reusable way
    ● State push/pull to remote: S3, HTTP, Atlas
    ● Atlas integration: SaaS control room for
    teams, managed by HashiCorp

    View Slide

  9. Cheers!

    View Slide