InterviewStack.io LogoInterviewStack.io

Infrastructure as Code and Configuration Management Questions

Infrastructure as Code and Configuration Management covers designing, implementing, and operating infrastructure defined as code and the practices that keep that infrastructure consistent and auditable. Topics include Infrastructure as Code principles and patterns, declarative versus imperative approaches, idempotency, state management, module and template design for reusable infrastructure, version control integration, testing and validation of infrastructure code, drift detection and remediation, safe rollout and rollback strategies, policy as code and Git operations for infrastructure, and how to scan and remediate infrastructure misconfigurations. This topic also encompasses integration points with system configuration tools and considerations for managing secrets and secure defaults within infrastructure definitions.

EasyTechnical
31 practiced
Provide a Terraform HCL snippet that provisions an AWS EC2 instance using a data source to fetch the latest Amazon Linux 2 AMI, creates a security group allowing SSH from a variable CIDR block, and tags both the instance and security group. Assume provider credentials are configured; keep the snippet minimal and clear.
HardSystem Design
30 practiced
You are responsible for testing IaC at platform scale across 10k resources. Propose a testing strategy including linting, policy tests, unit/contract tests, integration tests, smoke tests, test data management, ephemeral environment provisioning, cost control, and how to parallelize tests in CI to obtain reasonable feedback times without excessive cloud spend.
EasyTechnical
26 practiced
What is configuration drift in cloud infrastructure and how does it typically occur? Give a concrete example of drift in AWS and describe methods for detecting drift across Terraform and CloudFormation managed resources, including native tools and community scanning approaches.
MediumTechnical
30 practiced
Write a Conftest or OPA Rego policy that enforces a required tag 'cost-center' on AWS EC2 and S3 resources in a Terraform plan. Describe how you would integrate this policy into a CI pipeline so that failed policy checks block merges or deployments, and how you would provide a mechanism for approved exceptions.
MediumSystem Design
29 practiced
Design a reusable Terraform module for an AWS VPC that supports N availability zones, public and private subnets, optional NAT gateways, flow logs, route tables, and outputs required by downstream modules (private_subnet_ids, public_subnet_ids, route_table_ids). Describe the module interface: inputs, outputs, versioning strategy, and how you would test and document the module for team reuse.

Unlock Full Question Bank

Get access to hundreds of Infrastructure as Code and Configuration Management interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.