Interview Prep/Terraform/Lifecycle, Dependencies, Provisioners and Drift

What does `terraform test` do at a basic level?

BeginnerConceptLifecycle, Dependencies, Provisioners and Drift
Answer

Since 1.6 it runs .tftest.hcl files containing run blocks that apply (or plan) real configuration and assert on results, then destroys what it created.

run "bucket_is_private" {
  command = plan
  assert {
    condition     = aws_s3_bucket_public_access_block.b.block_public_acls == true
    error_message = "Public ACLs must be blocked"
  }
}
All Terraform questions Roadmap: Terraform in production

More on Lifecycle, Dependencies, Provisioners and Drift