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.

HardTechnical
28 practiced
A new major version of the AWS Terraform provider introduces schema changes that could cause resource recreation during apply. Describe how you would plan, test, and roll out a provider upgrade across dev, staging, and production environments. Cover pinning provider versions, creating a canary environment, state backups, running terraform plan to detect changes, rollbacks, and communication with dependent teams.
MediumTechnical
26 practiced
Write a reusable Terraform module in HCL that provisions an AWS S3 bucket with optional versioning and server-side encryption, plus a lifecycle rule to remove noncurrent versions after 30 days. The module should accept variables: name_prefix (string), tags (map), enable_versioning (bool). It should output bucket_arn and bucket_id. Provide the core snippets for main.tf, variables.tf, and outputs.tf and explain your design choices for reusability and safety.
EasyTechnical
28 practiced
Explain idempotency in the context of Ansible playbooks. Provide a clear example of a non-idempotent task (for example using 'shell: echo >> /etc/myconfig') and show how to rewrite that task using Ansible modules or conditional checks to become idempotent. Mention how --check mode relates to idempotency.
MediumTechnical
27 practiced
In a Terraform codebase where multiple modules create IAM roles and S3 buckets with similar names, explain how you would implement a consistent naming convention using variables and local values to guarantee uniqueness across environments, accounts, and teams. Provide example local value expressions or naming templates and explain how to enforce them in CI or pre-commit hooks.
MediumTechnical
26 practiced
How do you prevent sensitive data such as API keys or database passwords from being leaked into Terraform state or plan output? Discuss using the 'sensitive' attribute on variables/outputs, state encryption at rest, avoiding interpolation of secrets in outputs, and integrating with external secrets managers like HashiCorp Vault or AWS SSM Parameter Store without placing secrets in cleartext in state.

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.