Practice Infrastructure as Code testing vocabulary: unit testing IaC with Terratest and pytest, real infrastructure in tests, mocking cloud providers, linting, and reading terraform plan output.
0 / 5 completed
1 / 5
The platform team writes ___ tests for their Terraform modules using Terratest.
IaC unit tests verify that individual modules or resources behave as expected. Terratest (Go) and pytest-terraform (Python) are popular frameworks. Unlike application unit tests, IaC unit tests often provision real cloud resources because infrastructure cannot be meaningfully tested without it.
2 / 5
A Terratest test ___ up real infrastructure in AWS to verify the module, then tears it down after.
'The module test spins up real infrastructure' means Terratest actually calls AWS/GCP/Azure APIs to create resources, runs assertions against them, and then destroys them. This catches issues that mocks miss but is slower and costs money.
3 / 5
For fast feedback the CI pipeline ___ the cloud provider in unit tests, avoiding real API calls.
Mocking the cloud provider in IaC unit tests means using tools like LocalStack (AWS), the Terraform testing framework's mock_provider, or similar to simulate API responses locally. Tests run faster and do not incur cloud costs, but cannot catch all real-world issues.
4 / 5
The CI pipeline runs ___ on all Terraform files to catch style and misconfiguration issues before plan.
IaC linting tools like tflint (Terraform), cfn-lint (CloudFormation), or checkov check HCL/YAML for syntax errors, deprecated resource types, missing required variables, and policy violations — catching issues before any infrastructure is provisioned.
5 / 5
The pull request review includes the terraform ___ output: it shows 3 resources will be destroyed.
terraform plan generates an execution plan showing exactly which resources will be added (+), changed (~), or destroyed (-) if terraform apply is run. Reviewing the plan output before applying is a critical safety practice, especially when deletions are shown.