Infrastructure as Code and Automation Questions

Defining, provisioning, and automating infrastructure programmatically. Covers declarative IaC with Terraform and comparable tools like CloudFormation (resource and provider model, state management and remote backends, module design and reuse, workspaces, drift detection, and safe plan/apply workflows), plus the broader automation discipline: provisioning pipelines, golden-image and machine-image building, scripting glue, self-service platforms, and end-to-end environment stand-up. The authoring, lifecycle, and automation of infrastructure code that reduces manual toil across provisioning workflows.

EasyTechnical
21 practiced

What does terraform import actually do, and can you think of a time you'd reach for it instead of just writing a fresh resource block?

HardTechnical
23 practiced

You have a resource block using for_each = var.app_servers, where app_servers is declared as a list in variables.tf, and Terraform errors with "Invalid for_each argument". Explain why that happens and show the minimal HCL changes, to both the variable and the resource, that fix it while keeping stable, unique resource keys.

HardTechnical
24 practiced

How do you make sure Terraform or CloudFormation never accidentally destroys a production resource on the next apply? Talk through the guardrails you'd put in place, from policy checks and manual approvals to how you'd recover quickly if a destroy did slip through.

HardSystem Design
21 practiced

Design a drift-detection and remediation system for thousands of cloud resources spread across multiple accounts and regions. How would it decide what to auto-fix versus what needs a human to sign off, and how do you keep the whole thing auditable?

MediumTechnical
16 practiced

How would you design a Terraform module that other teams can safely reuse across dev, staging, and prod? Talk through directory layout, how you'd handle inputs and defaults, and how you'd version it so consumers aren't afraid to upgrade.

Unlock Full Question Bank

Get access to all Infrastructure as Code and Automation interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.