This repo is complementary to the talk "State of terraform 2025".
- Start LocalStack Container
docker run --rm -it -p 4566:4566 -p 4510-4559:4510-4559 localstack/localstack:4.1.0
- Run Terraform init
tofu init
terraform init
- Run Terraform apply
tofu apply
terraform apply
-
Open the Static Website in Browser The link will be displayed in the console output of
terraform apply
and will look something likehttps://some-example-bucket-for-a-static-website.s3-website.localhost.localstack.cloud:4566/
. -
List bucket created in localstack:
awslocal s3api list-buckets
.
- Validation fails
tofu plan --var bucket_name="1.1.1.1"
terraform plan --var bucket_name="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"
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"
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
tofu test
terraform test
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.