Slide 1

Slide 1 text

Infrastructure as Code with HashiCorp Terraform Thorsten Hans @ThorstenHans Consultant

Slide 2

Slide 2 text

Focus: Cloud Native & Infrastructure as Code Consultant @ Thinktecture AG [email protected] [email protected] thinktecture.com thorsten-hans.com @ThorstenHans Thorsten Hans

Slide 3

Slide 3 text

Talking Points Terraform and Infrastructure as Code Introduction Terraforming Microsoft Azure Continuous Integration with GitHub Actions Terraform Resources

Slide 4

Slide 4 text

by HashiCorp • Toolset for Infrastructure as Code • Written in Go • Available for Windows, Linux, macOS, FreeBSD, OpenBSD, Solaris • Open Source • Optional paid services • Terraform Cloud (adds collaboration features) • Terraform Enterprise (adds governance features) Terraform

Slide 5

Slide 5 text

Terraform Write, Plan, and Create 1 Infrastructure as Code 2 Preview Changes before applying 3 Build reproducible infrastructure

Slide 6

Slide 6 text

Terraform Write, Plan, and Create 1 Infrastructure as Code 2 Preview Changes before applying 3 Build reproducible infrastructure

Slide 7

Slide 7 text

Infrastructure as Code • Automate your Infrastructure • Can be stored in a version control system (git) • Change History / Change Tracking • Collaboration • Better documentation • Eliminates the Truck Factor (or Single Point of Failure) • Predictable deployments Terraform - Write

Slide 8

Slide 8 text

Terraform Write, Plan, and Create 1 Infrastructure as Code 2 Preview Changes before applying 3 Build reproducible infrastructure

Slide 9

Slide 9 text

Preview changes before applying • Execution plan tells you which parts of the environment will be • Created • Modified • Deleted • Displayed / Verified before modifying the targeting infrastructure • Think of git status Terraform - Plan

Slide 10

Slide 10 text

Terraform Write, Plan, and Create 1 Infrastructure as Code 2 Preview Changes before applying 3 Build reproducible infrastructure

Slide 11

Slide 11 text

Build reproducible infrastructure • One Terraform script can be applied million times • Configurable environments • Variables • Interpolation • Built-in functions Terraform - Create

Slide 12

Slide 12 text

Write Code Terraform plan Verify Terraform apply Consume The Terraform Lifecycle Terraform Destroy

Slide 13

Slide 13 text

HashiCorp Configuration Language • Declarative language used to code your infrastructure • Based on JSON but more focused • Simple but powerful type system • Strings, Numbers, Booleans, Maps, Lists • One language for all infrastructure vendors • Using dedicated Providers Meet the HCL

Slide 14

Slide 14 text

Talking Points Terraform and Infrastructure as Code Introduction Terraforming Microsoft Azure Continuous Integration with GitHub Actions Terraform Resources

Slide 15

Slide 15 text

The AzureRM Provider • Terraform Provider supports all ARM API Features • Different Authentication patterns supported • Reuse Azure CLI Authentication • Dedicated Service Principal • Dedicated Managed Service Identity • Read/Write Azure Resources Terraforming Microsoft Azure

Slide 16

Slide 16 text

Demo Terraforming Microsoft Azure

Slide 17

Slide 17 text

Talking Points Terraform and Infrastructure as Code Introduction Terraforming Microsoft Azure Continuous Integration with GitHub Actions Terraform Resources

Slide 18

Slide 18 text

Terraform in GitHub Actions • Use official Action provided by HashiCorp to setup Terraform • Use GitHub’s Repository Secrets to establish context Continuous Integration

Slide 19

Slide 19 text

Demo Continuous Integration with GitHub Actions

Slide 20

Slide 20 text

Talking Points Terraform and Infrastructure as Code Introduction Terraforming Microsoft Azure Continuous Integration with GitHub Actions Terraform Resources

Slide 21

Slide 21 text

Essential Features • Modules • https://thns.io/2R73oIQ • Workspaces • https://thns.io/2OZMs4Y • Terraform State • https://thns.io/2AftGS2 • Backends • https://thns.io/2DFyNOy Terraform Resources

Slide 22

Slide 22 text

Great free and paid resources • Terraform Guide for Azure enthusiasts • https://thns.io/terraform-guide • Terraform Best Practices • https://thns.io/2P0mb6z • Book: Terraform: Up and Running • https://thns.io/2QdJSNz Terraform Resources

Slide 23

Slide 23 text

Q&A If you have further questions: shoot me a mail at [email protected] / [email protected] or tweet at @ThorstenHans