Slide 1

Slide 1 text

Deploying at Scale with HashiCorp Terraform AWS User Group Las Vegas

Slide 2

Slide 2 text

Senior Developer Advocate, Infrastructure & Orchestration he / him @ksatirli Kerim Satirli

Slide 3

Slide 3 text

HashiCorp Terraform Deploying at Scale Agenda Next Steps 2 3 Traditional and Modern IT Infrastructure 1 4

Slide 4

Slide 4 text

01 Traditional and Modern IT Infrastructure

Slide 5

Slide 5 text

Slow Deployments of hardware and software based around manual processes Error-prone Mistakes during deployment executions lead to larger problems Hard to control Complicated processes needed to control complicated processes Traditional IT Infrastructure

Slide 6

Slide 6 text

Fast Deployments of hardware and software based around automated processes Secure Deployments are scripted, minimizing errors and enabling validation Scaleable One or all available regions or continents, multiple accounts, multiple clouds. Modern IT Infrastructure

Slide 7

Slide 7 text

IT Infrastructure server with web shop

Slide 8

Slide 8 text

IT Infrastructure without Code server with web shop

Slide 9

Slide 9 text

IT Infrastructure with Code server with web shop

Slide 10

Slide 10 text

02 HashiCorp Terraform

Slide 11

Slide 11 text

Documented code is readable for both human operators and machines alike Versioned code is plain-text and can easily be version- controlled with any VCS Verified code can easily be verified against org-specific deployment rules IT Infrastructure as Code

Slide 12

Slide 12 text

main executable; interface between user, HCL, CLI operations, and providers Terraform Translates HCL definitions into API calls and manages service- specific resources Provider Combines IT Infrastructure definitions into (reusable) building blocks Module Terraform Concepts

Slide 13

Slide 13 text

Terraform Landscape

Slide 14

Slide 14 text

ca. 400 Providers built by HashiCorp and HashiCorp Technology partners Azure, Splunk, VMware vSphere, etc. ca. 4050 Provider built by the community Pingdom, Sentry, Unifi, etc. Terraform Landscape - Provider

Slide 15

Slide 15 text

ca. 140 Modules built by Technology Partners ca. 17500 Terraform Landscape - Modules Modules built by the community

Slide 16

Slide 16 text

Handles Create, Read, Update, Delete operations of a resource Resource Handles Read operations of a resource Data Source Manages resource and data source configuration State Terraform Concepts

Slide 17

Slide 17 text

Terraform Code resource "server" "factory" { count = 10 image = "rhel-8.1" type = "large" has_public_ip = true region = "eu-west-2" }

Slide 18

Slide 18 text

Terraform Code resource "server" "factory" { count = 10 name = "factory-${count.index}" image = var.image type = var.type has_public_ip = true region = "eu-west-2" }

Slide 19

Slide 19 text

Security Lifecycle Management Infrastructure Lifecycle Management HashiCorp Products

Slide 20

Slide 20 text

03 Deploying at Scale

Slide 21

Slide 21 text

©2024 HASHICORP How many Regions does AWS support?

Slide 22

Slide 22 text

Multi-Region Deployment data "aws_regions" "main" {}

Slide 23

Slide 23 text

Multi-Region Deployment aws_regions = toset([ "af-south-1", "ap-east-1", "ap-northeast-1", "ap-northeast-2", "ap-northeast-3", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-southeast-3", "ca-central-1", "eu-central-1", "eu-north-1", "eu-south-1", "eu-south-2", "eu-west-1", "eu-west-2", "eu-west-3", "me-south-1", "sa-east-1", "us-east-1", Multi-Region Deployment

Slide 24

Slide 24 text

Multi-Regional Workspaces module "regional_aws_workspaces" { for_each = toset(data.aws_regions.main.names) source = "ksatirli/regional-workspace/tfe" version = "1.2.0" region = { category = "terraform" identifier = each.key prefix = "aws" variable = "aws_region" } vcs_repo = { identifier = "workloads/regional-aws-deployment" branch = "main" } }

Slide 25

Slide 25 text

Multi-Regional Failures

Slide 26

Slide 26 text

Single-region Service Quotas console.aws.amazon.com/support

Slide 27

Slide 27 text

Multi-Region Deployment # look up Service Code for EC2 instances data "aws_servicequotas_service" "ec2" { provider = "aws.us-east-1" service_name = "Amazon Elastic Compute Cloud (Amazon EC2)" } # update Service Quota for M5 EC2 instances resource "aws_servicequotas_service_quota" "ec2" { provider = "aws.us-east-1" # allow up to 100 M5 instances quota_code = "L-8B7BF662" service_code = data.aws_servicequotas_service.ec2.service_code value = 100 }

Slide 28

Slide 28 text

✉ from AWS Support mail.google.com

Slide 29

Slide 29 text

Multi-Region Deployment app.terraform.io/app/workloads/workspaces

Slide 30

Slide 30 text

✉ from AWS Support mail.google.com

Slide 31

Slide 31 text

Multi-Region Deployment

Slide 32

Slide 32 text

04 Next Steps

Slide 33

Slide 33 text

Terraform Tutorials developer.hashicorp.com/terraform

Slide 34

Slide 34 text

Demo Code github.com/workloads/

Slide 35

Slide 35 text

©2024 HASHICORP

Slide 36

Slide 36 text

Thank you speakerdeck.com/ksatirli