Terraform and AWS at
Tempus
What is Terraform?
• Collection of DSLs for the AWS API
DRYing Terraform
• App Specific things - Plugins for Blueprints
• “Blueprints” - Iterate over modules
• Modules
Network Blueprint / Module
• VPCs (Scenario 2)
• Public/Private
• Multi-Zone
• Peering
• MGMT (bastion, proxy)
Env Specific VPC
VPC Blueprint
VPC Module
App Stack Overview
• Module / Blueprints
• CloudFront -> S3
• AutoScaling Groups
• Instances
• ELB
• RDS
• Security Groups
Shared Data
• Certs
• SSH Public Keys
• VPC Data
App Deploy
• File = Just a bunch of bash
• Every app uses the same module for Deploying
Instance Cloud-init
• Write Docker-compose (user data)
• Auth with ECR
• docker-compose -f thatfile.yml -d
• Healthcheck = Success
RDS -> S3
• There should be an ingress rule here too
• “I’m going to open this up to the pub real quick”
Common Utils
• Common VPC Peered to all other “App” VPCs
• Output Security Info, CIDRs, etc (sick of IPV4 stuff yet?)
• Jenkins (workers in specific SGs)
• Log Shipping
IAM
• Users (Devs and Machine Users)
• Groups / Products
• Roles & Policies
• Controlling Dev and Machine access to
Specific ENVs
CloudFront
• CDNs with Bucket origins
• Static Assets are Deployed to Buckets
• Certs are pushed out to CDNs through Cert
Manager
• CORS policies
Deploying
• Jenkins - Builds Container off Merges, Runs TF
code (Jenkinsfile)
• Docker Compose
• Glue for extraneous TF things
• Gem - GitHub -> AWS SDK -> Terraform
Monitoring
• Cloudwatch -> SNS -> Pagerduty
• Cloudwatch -> ASGs -> scaling and rolling
instances
One-off Scaffolding
• Stateful Instances (<5%)
• Everything “around” the instance is in TF and we
plug in an AMI
Globals and API Region
Support
Results
• The more we control, the less configuration drift
there is
• Output and Import all the things; tight grasp on
ACLs
• Deploy times ~ 5 Minutes
• Build Time ~5 Minutes
Questions

20170831 - Greg Palmier: Terraform & AWS at Tempus