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

416c04c6f0793e236381c2f5df80c9ed?s=128

Giovanni Toraldo

July 03, 2015
Tweet

Transcript

  1. 2.
  2. 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
  3. 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
  4. 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
  5. 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
  6. 9.