• Home
  • About
  • Résumé
  • RunLog
  • Posts
    • All Posts
    • All Tags

Infrastructure as Code Presentation

12 May 2017

Reading time ~1 minute

What is Infrastructure as Code?

  • Process of automatically manage and provision infrastructure with code
  • Eliminates one-off machines/Manual Changes
  • Rebuildable/Repeatable
    • Deploying IaC in dev, all the way to prod
  • Version Control

Build and Operate Infrastructure as Software

Application Infrastructure
Source Code JSON
Interpreter AWS Service API
Desired application state Desired infrastructure state

What is Terraform?

Allows ops teams to build, change infrastructure safely and efficiently.

  • Supports multiple cloud providers
  • Documentation is executable (always up-to-date)

  • TF resources allow us to set/change infrastructure attributes:
    • Instance Type
    • Region
    • VPC
    • Security Groups

Reusable TF Modules

Here are some reusable TF modules we have at reflektion

  • Webology (all the core services)
  • Elasticache
  • ECS stack

Recycling code in multiple environments, just by updating few tags in the new resources.

How is Terraform apply to Reflektion?

  • Create/Update/Rebuild our infrastructure

Workflow

  1. Create a resource which calls for modules we have written
  2. Run terraform plan
    • TF locks state file on the backend (S3) to prevent state corruption
  3. Run terraform apply
    • Creates the AWS resources - security group, dns entries
    • Applies user_data contents
      • Post provision setup such as installing additional softwares, cloning Webology, etc.
  4. Update resource attributes to make additional changes
  5. Re-run terraform plan and terraform apply

Live Demo

  • remove manual changes with apply
  • update resource to scale up instances
  • scale down instances


technologydocdevopsterraform Share Tweet +1