Your browser doesn't support the features required by impress.js, so you are presented with a simplified version of this presentation.

For the best experience please use the latest Chrome, Opera, Safari or Firefox browser.

Terraform Workshop

Beginner Terraform (AWS) workshop, plus a bit of Github + CircleCI for automation.

Terraform?

Tool for building, changing, and versioning infrastructure.

Infrastructure as code

CI/CD Demo

...

HCL

Terraform uses its own configuration language, but you have an option to use plain JSON

Why use HCL

  • ✅ syntax highlight
  • ✅ type checks
  • ✅ inline help and suggestions
  • ☑️ learn new language

Providers

Terraform is designed to be extendable, so every service implemented as a provider

Providers

Providers and plugins are downloaded automatically into .terraform folder during terraform init

.terraform

Workflow

  • terraform init
  • terraform plan -out tfplan
  • terraform apply tfplan
  • ...
  • PROFIT

terraform init

init

terraform plan

plan

terraform apply

apply

Workspaces

Multiple workspaces to separate deployments but re-use same infrastructure config

  • terraform workspace list
  • ... new
  • ... select
  • ... delete

Workspaces

Using workspace name

Modules

State

.terraform/terraform.tfstate

Remote states

Remote state

TF_LOG=TRACE

Install

AWS CLI profiles

Fill your aws keys

Check AWS CLI

root.tf

www/bucket.tf

www/policy.tf

root.tf

www/bucket.tf

src/index.html.tmpl

src/error.html.tmpl

www/files.tf

root.tf

Deploy