Skip to content

qaware/state-of-terraform-2025

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

state-of-terraform-2025

This repo is complementary to the talk "State of terraform 2025".

How to demo

1. Basic setup

  1. Start LocalStack Container
docker run --rm -it -p 4566:4566 -p 4510-4559:4510-4559 localstack/localstack:4.1.0
  1. Run Terraform init
tofu init
terraform init
  1. Run Terraform apply
tofu apply
terraform apply
  1. Open the Static Website in Browser The link will be displayed in the console output of terraform apply and will look something like https://some-example-bucket-for-a-static-website.s3-website.localhost.localstack.cloud:4566/.

  2. List bucket created in localstack: awslocal s3api list-buckets.

2. Validations

  1. Validation fails
tofu plan --var bucket_name="1.1.1.1"
terraform plan --var bucket_name="1.1.1.1"
  1. Validation passes
tofu plan --var bucket_name="some-example-bucket-for-a-static-website"
terraform plan --var bucket_name="some-example-bucket-for-a-static-website"

3. Preconditions

This would fail the precondition:

tofu plan --var website_index_object_key="hello_world.html"
terraform plan --var website_index_object_key="hello_world.html"

4. Postconditions

This would fail the postcondition:

tofu apply --var enable_versioning=false
terraform apply --var enable_versioning=false

This would satisfy the postcondition again:

tofu apply --var enable_versioning=true
terraform apply --var enable_versioning=true

Note, that this command does not fail the postcondition:

tofu plan --var enable_versioning=false
terraform plan --var enable_versioning=false

5. "Unit Tests" / "Integration Tests"

tofu test
terraform test

6. Checks ("End-to-End Tests")

Rerun terraform apply or tofu apply and watch the output. You can also change something in the assertion in check.tf to see how the check fails.