Terraform interview question
Write a reusable Terraform module for a private, encrypted S3 bucket, and show how it's used.
Hands-on Asked in DevOps Engineer · Cloud Engineer · Site Reliability Engineer (SRE) interviews
Summary
The module takes a name and tags, creates the bucket with public access blocked, encryption (SSE-KMS or SSE-S3), versioning and ownership controls, and outputs the bucket name and ARN. Callers use it with one block per bucket, so every bucket gets the same secure defaults.
Keep reading with a membership
The full answer with examples, key points and comparisons is part of the membership, along with every other interview answer, progress tracking and Daily Review. Most-asked answers stay free to read.
More Terraform questions
- Terraform apply fails halfway through — some resources were created, others were not. How do you recover?
- Someone manually deletes an EC2 instance that Terraform manages. What happens on the next plan and apply?
- When do you need depends_on in Terraform, and when is it a code smell?
- What are the main terraform state subcommands, and when do you use them?
- How do you configure OIDC authentication between GitHub Actions and AWS for Terraform pipelines?
- How should nonprod and production Terraform configurations differ, and how do you enforce those differences?
- How do you use Terraform to deploy the same infrastructure to nonprod and production AWS accounts?
- What is Terraform, and how does it work at a high level?