InterviewStack.io LogoInterviewStack.io

Infrastructure as Code Tool Proficiency (Terraform/CloudFormation/Ansible) Questions

Deep proficiency in at least one IaC tool. For Terraform: understand resources, data sources, variables, outputs, local values, modules, state management, state locking, backend configuration (S3, Terraform Cloud), and best practices (remote state, sensitive variables, module organization). For CloudFormation: understand templates (YAML/JSON), stacks, parameters, conditions, mappings, resources, outputs, and intrinsic functions. For Ansible: understand playbooks, roles, inventory, variables, handlers, and idempotency. Write reusable, maintainable code: modules for Terraform, roles for Ansible. Understand code organization, naming conventions, and team collaboration practices.

EasyTechnical
31 practiced
Write a reusable Terraform module (HCL) that creates an AWS S3 bucket with server-side encryption enabled and versioning turned on. The module must accept variables for: bucket_name (string), environment (string), and enable_public_access_block (bool). Provide a concise outline of variables.tf, main.tf (resource block), and outputs.tf. Assume the AWS provider is configured outside the module.
MediumSystem Design
45 practiced
Design a CI/CD pipeline for Terraform deployments (choose a runner like GitHub Actions, GitLab CI, or Jenkins) that enforces: terraform fmt, linting (tflint), a terraform plan on PRs with plan output posted to the PR, policy-as-code checks (OPA or Checkov), and manual approval gates for production applies. Explain credentials handling and separation between plan and apply stages.
MediumSystem Design
31 practiced
Design a Terraform strategy to manage infrastructure across an AWS Organization of ~50 accounts: include recommended module boundaries (shared VPCs, IAM, platform services), how to structure remote state for each account, cross-account role assumption for automation, and CI/CD considerations (bootstrapping accounts, permissions, and promotion paths).
EasyTechnical
24 practiced
Explain the differences between Ansible playbooks, roles, and collections. Describe static versus dynamic inventory and give a scenario where dynamic inventory is necessary (for example, EC2 instances that scale). How do roles improve reuse and collaboration within a team?
MediumTechnical
30 practiced
Describe the directory structure and key files for an Ansible role that installs and configures PostgreSQL. Provide example contents (short) of tasks/main.yml, handlers/main.yml, defaults/main.yml, and templates/postgresql.conf.j2. Explain how this role can be parameterized and tested.

Unlock Full Question Bank

Get access to hundreds of Infrastructure as Code Tool Proficiency (Terraform/CloudFormation/Ansible) interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.