×
Copy
Open
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Slide 1
Slide 1 text
©2024 HASHICORP Getting started with HashiCorp Terraform 1
Slide 2
Slide 2 text
©2024 HASHICORP Developer Advocate HashiCorp he/him @bschaatsbergen Bruno Schaatsbergen
Slide 3
Slide 3 text
©2024 HASHICORP Infrastructure
Slide 4
Slide 4 text
©2024 HASHICORP 4 Execution errors lead to challenging problems. Traditional IT infrastructure Manual hardware and software provisioning. Not easy to enforce compliance standards.
Slide 5
Slide 5 text
©2024 HASHICORP 5 Minimize errors and reduce blast radius with policies. Modern IT infrastructure Automated hardware and software provisioning. From one or two continents to global and multi-cloud.
Slide 6
Slide 6 text
©2024 HASHICORP Infrastructure as Code
Slide 7
Slide 7 text
©2024 HASHICORP 7 Write once, deploy everywhere. Benefits of Infrastructure as Code Track, review and revert. Enforce compliance and security policies.
Slide 8
Slide 8 text
©2024 HASHICORP
Slide 9
Slide 9 text
©2024 HASHICORP Terraform providers Terraform Provider Target API Terraform Terraform Provider Target API Terraform
Slide 10
Slide 10 text
©2024 HASHICORP Terraform providers Terraform Provider Target API Terraform
Slide 11
Slide 11 text
©2024 HASHICORP A community-powered product Providers by HashiCorp and partners AWS, Google, Kubernetes, etc. Providers by our community Dominos, Unifi, Spotify, etc.
Slide 12
Slide 12 text
©2024 HASHICORP A community-powered product Modules by our community Modules by HashiCorp and partners
Slide 13
Slide 13 text
©2024 HASHICORP Providers are a logical abstraction of an upstream API. Terraform Registry
Slide 14
Slide 14 text
©2024 HASHICORP resource "kubernetes_namespace" "example" { metadata { name = "example-namespace" } }
Slide 15
Slide 15 text
©2024 HASHICORP Terraform is supported on macOS, Windows, and across many Linux and BSD versions. Installation
Slide 16
Slide 16 text
©2024 HASHICORP Specify the required providers and configure version constraints. HashiCorp Terraform Defining requirements terraform { required_version = ">= 1.8.0" required_providers { aws = { source = "hashicorp/aws" version = ">= 5.0.0, < 6.0.0" } } } terraform.tf
Slide 17
Slide 17 text
©2024 HASHICORP Configure how a Terraform provider interacts with an upstream API. HashiCorp Terraform Configuring a provider provider "aws" { region = "eu-central-1" default_tags { tags = { "environment" = "dev" } } } providers.tf
Slide 18
Slide 18 text
©2024 HASHICORP Defines an S3 bucket with a unique name and enables object versioning. HashiCorp Terraform Defining a resource resource "aws_s3_bucket" "example" { bucket_prefix = "example" } resource "aws_s3_bucket_versioning" "example" { bucket = aws_s3_bucket.example.id versioning_configuration { status = "Enabled" } } bucket.tf
Slide 19
Slide 19 text
©2024 HASHICORP Downloads the provider and creates a lock file. HashiCorp Terraform Initializing a directory >_ terraform init Initializing provider plugins… - Finding hashicorp/aws versions matching ">= 5.0.0" - Installing hashicorp/aws v5.55.0 - Installed hashicorp/aws v5.55.0 (signed by HashiCorp) Terraform has created a lock file .terraform.lock.hcl to record the provider selections it made above. Terraform has been successfully initialized! Terminal
Slide 20
Slide 20 text
©2024 HASHICORP Creates an execution plan to preview Terraformʼs planned changes to your infrastructure. HashiCorp Terraform Planning a change >_ terraform plan Terraform will perform the following actions: # aws_s3_bucket.example will be created + resource "aws_s3_bucket" "example" # aws_s3_bucket_versioning.example will be created + resource "aws_s3_bucket_versioning" "example" Plan: 2 to add, 0 to change, 0 to destroy. To perform these actions, run the following command to apply: terraform apply Terminal
Slide 21
Slide 21 text
©2024 HASHICORP Applies the execution plan, making Terraformʼs planned changes to your infrastructure. HashiCorp Terraform Applying a change >_ terraform apply aws_s3_bucket.example: Creating... aws_s3_bucket.example: Creation complete aws_s3_bucket_versioning.example: Creating... aws_s3_bucket_versioning.example: Creation complete Apply complete! Resources: 2 added, 0 changed, 0 destroyed. Terminal
Slide 22
Slide 22 text
©2024 HASHICORP
[email protected]