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
22 practiced

What's the difference between count and for_each in Terraform? Show a short example using for_each with a map of rule definitions to create several security group rules, so each one keeps a stable identity if the rules change.

MediumTechnical
23 practiced

A teammate's Ansible task changes state every time it runs instead of converging, so re-running the playbook has unwanted side effects. Walk through how you'd diagnose why it isn't idempotent, how you'd fix it, and how the problem could have been caught before it reached production.

HardSystem Design
22 practiced

You are asked to build a reusable Terraform module for a three-tier application that includes networking, application compute, and a managed database. How would you split responsibilities between modules, and what would you expose so another team can compose it safely?

EasyTechnical
21 practiced

What's the practical difference between a resource and a data source in Terraform? Give an example of each in a typical module, and explain how a data source changes what shows up in plan and how it affects the dependency graph.

HardTechnical
18 practiced

One of your engineers discovers that a database password ended up committed in a Terraform state file that was pushed to a shared repository. Walk me through what you'd do right away, and what you'd change afterward so it can't happen again.

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.