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.
Sample Answer
Sample Answer
Sample Answer
Sample Answer
# molecule.yml (simplified)
platforms:
- name: instance
image: geerlingguy/docker-ubuntu2004-ansible:latest # container scenario
pre_build_image: true
provisioner:
name: ansible
lint:
name: ansible-lint
scenario:
test_sequence:
- lint
- dependency
- create
- converge
- verify
- destroy- name: start wiremock
docker_container:
name: wiremock
image: rodolpheche/wiremock
state: started
published_ports: "8080:8080"def test_idempotent_and_error_handling(host):
svc = host.service("myservice")
# simulate failure
host.run("sudo systemctl stop myservice")
# run handler (invoke role handler or re-run converge)
result = host.run("ansible-playbook /tmp/recover.yml")
assert result.rc == 0
assert svc.is_runningSample Answer
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 ContinueJoin thousands of developers preparing for their dream job.