Terraform: Infrastructure as Code Essentials
Terraform: Infrastructure as Code Essentials
Up to 20 questions, shuffled on every run
Welcome to the Terraform Basics Quiz! This quiz is designed to test your understanding of fundamental Terraform concepts and best practices. Each question is multiple-choice, and you’ll find hints to help you along the way. Good luck!
Answer key and explanations20 questions
The quiz above draws 20 questions at random from these 30, so a second attempt will not be the same run. Everything in the pool is listed here.
In Terraform dynamic blocks, which attribute determines the number of times the nested configuration is repeated?
Answer`for_each`
Which feature allows you to verify infrastructure health without needing to define a specific resource instance?
Answer`check` blocks
Which lifecycle meta-argument ensures a new resource is provisioned before the old one is removed?
Answer`create_before_destroy`
When refactoring code to rename a resource without destroying it, which block should be added to the HCL?
Answer`moved`
What is the correct priority order for variable values (lowest to highest precedence)?
Answer`Env vars` < `terraform.tfvars` < `*.auto.tfvars` < `CLI flags`
In HCP Terraform, what is the primary purpose of a 'Project'?
AnswerGrouping related workspaces
True or False: Values marked as 'sensitive = true' in HCL are encrypted within the state file.
AnswerFalse
Which command provides an interactive REPL to evaluate HCL expressions?
Answer`terraform console`
Which command removes a resource from the state file without deleting the cloud resource?
Answer`terraform state rm`
What is the function of the 'depends_on' meta-argument?
AnswerForcing resource order
Which command downloads providers and initializes the working directory?
Answer`terraform init`
What is the default number of concurrent operations used during a Terraform apply?
Answer10
Which built-in function is used to combine multiple maps into one?
Answer`merge()`
Which block type allows for code-based importing of existing infrastructure?
Answer`import`
Where does the 'local' backend store its data by default?
Answer`terraform.tfstate`
Which feature handles data that should not be persisted in the state file at all?
AnswerEphemeral values
What is the result of a creation-time provisioner failing during an apply?
AnswerResource is tainted
What is the definition of a 'child module' in Terraform?
AnswerA module called by another
Which command automatically updates HCL code to follow canonical styling?
Answer`terraform fmt`
In HCP Terraform, what is a 'Variable Set'?
AnswerShared workspace variables
Which lifecycle rule prevents a resource from being deleted during an apply or destroy?
Answer`prevent_destroy`
What is the primary technical benefit of using Remote Backends?
AnswerState locking and sharing
Which flag allows an operation to focus on a single specific resource?
Answer`-target`
Which value is used with the 'sensitive' argument to mask CLI output?
Answer`true`
What is the official name for HashiCorp's managed Terraform service?
AnswerHCP Terraform
Which block type is used for global settings like the required Terraform version?
Answer`terraform`
True or False: A provider block must be explicitly defined for every resource in the HCL.
AnswerFalse
Which command displays the current state file in a human-readable format?
Answer`terraform show`
What is an 'Implicit Dependency' in Terraform?
AnswerResource attribute reference
Which command verifies that HCL is syntactically correct and internally consistent?
Answer`terraform validate`








