HomeInterview QuestionsHow do you write code in Terraform?

How do you write code in Terraform?

🟡 Medium Conceptual Junior level
1Times asked
May 2026Last seen
May 2026First seen

💡 Model Answer

Terraform configuration is written in HashiCorp Configuration Language (HCL). A typical file starts with a provider block, e.g., provider "aws" { region = "us-east-1" }. You then declare resources: resource "aws_s3_bucket" "example" { bucket = "my-bucket" }. Modules allow reuse of code, variables enable parameterization, and outputs expose values. Terraform manages state in a backend (local or remote), supports a plan/apply workflow, and uses declarative syntax to describe desired infrastructure. You can version your .tf files in Git, run terraform init, terraform plan, and terraform apply to provision resources.

This answer was generated by AI for study purposes. Use it as a starting point — personalize it with your own experience.

🎤 Get questions like this answered in real-time

Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers — invisible to screen sharing.

Get Assisting AI — Starts at ₹500