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

Terraform workspaces

Terraform workspaces

How can you use Terraform workspaces and how can you structure your Terraform projects better.

Mattias Gees

January 17, 2018
Tweet

More Decks by Mattias Gees

Other Decks in Programming

Transcript

  1. Mattias Gees • Cloud Engineer @skyscrapers • Avid runner •

    Likes to experiment github.com/mattiasgees twitter.com/mattiasgees blog.mattiasgees.be
  2. Remote config v1 terraform remote config \ -backend=s3 \ -backend-config="bucket=s3-bucket"

    \ -backend-config="key=project" \ -backend-config="region=us-east-1"
  3. Remote config v2 terraform { required_version = ">= 0.11.2" backend

    "s3" { bucket = "s3-bucket" key = "project" region = "us-east-1" dynamodb_table = "terraform-state-lock-example-default" encrypt = true } }
  4. Remote config v2 • http • manta • s3 •

    swift • terraform enterprise
  5. What are they? • First called terraform env • Introduced

    in 0.9.0, renamed in 0.10.0 • One codebase, multiple deployments • Works with certain backends
  6. Terragrunt • Var file per workspace • Specific Terraform CLI

    flags • Execute on multiple projects at once • ...
  7. CI/CD Tools • Testing • Kitchen-Terraform • AWSpec • Deployment

    • Atlantis from Hootsuite • HashiCorp Terraform Enterprise • Your own CI/CD tool