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
30 practiced
After a failed migration your Terraform state is partially corrupted: several resource entries are missing and terraform plan wants to recreate resources that must not be recreated. Outline a recovery strategy using state backups, terraform state list, terraform state mv, terraform state rm, and terraform import. Include a step-by-step checklist for verification, team coordination, and minimization of downtime or data loss.
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.
HardSystem Design
29 practiced
You must migrate complex CloudFormation stacks that include custom resources backed by Lambda and exported outputs to Terraform. Explain a migration plan that minimizes downtime and maintains resource identifiers used by downstream systems. Cover how to import resources, handle custom resource recreation, preserve exports, test in staging, and perform a safe cutover with rollback steps.
MediumTechnical
26 practiced
Write a CloudFormation YAML template snippet that defines an Application Load Balancer, a Launch Template or Launch Configuration with cloud-init user-data that installs nginx, an Auto Scaling Group parameterized by InstanceType and DesiredCapacity, and an Output for the ALB DNSName. Keep the snippet concise and use intrinsic functions to reference parameters and resources.
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.
Unlock Full Question Bank
Get access to hundreds of Infrastructure as Code Tool Proficiency (Terraform/CloudFormation/Ansible) interview questions and detailed answers.