Terraform: Infrastructure as Code Essentials

20 QuestionsAdvancedPublished:

Terraform: Infrastructure as Code Essentials

Up to 20 questions, shuffled on every run

Quiz Configuration
Enterto start

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.

  1. In Terraform dynamic blocks, which attribute determines the number of times the nested configuration is repeated?

    Answer`for_each`

  2. Which feature allows you to verify infrastructure health without needing to define a specific resource instance?

    Answer`check` blocks

  3. Which lifecycle meta-argument ensures a new resource is provisioned before the old one is removed?

    Answer`create_before_destroy`

  4. When refactoring code to rename a resource without destroying it, which block should be added to the HCL?

    Answer`moved`

  5. What is the correct priority order for variable values (lowest to highest precedence)?

    Answer`Env vars` < `terraform.tfvars` < `*.auto.tfvars` < `CLI flags`

  6. In HCP Terraform, what is the primary purpose of a 'Project'?

    AnswerGrouping related workspaces

  7. True or False: Values marked as 'sensitive = true' in HCL are encrypted within the state file.

    AnswerFalse

  8. Which command provides an interactive REPL to evaluate HCL expressions?

    Answer`terraform console`

  9. Which command removes a resource from the state file without deleting the cloud resource?

    Answer`terraform state rm`

  10. What is the function of the 'depends_on' meta-argument?

    AnswerForcing resource order

  11. Which command downloads providers and initializes the working directory?

    Answer`terraform init`

  12. What is the default number of concurrent operations used during a Terraform apply?

    Answer10

  13. Which built-in function is used to combine multiple maps into one?

    Answer`merge()`

  14. Which block type allows for code-based importing of existing infrastructure?

    Answer`import`

  15. Where does the 'local' backend store its data by default?

    Answer`terraform.tfstate`

  16. Which feature handles data that should not be persisted in the state file at all?

    AnswerEphemeral values

  17. What is the result of a creation-time provisioner failing during an apply?

    AnswerResource is tainted

  18. What is the definition of a 'child module' in Terraform?

    AnswerA module called by another

  19. Which command automatically updates HCL code to follow canonical styling?

    Answer`terraform fmt`

  20. In HCP Terraform, what is a 'Variable Set'?

    AnswerShared workspace variables

  21. Which lifecycle rule prevents a resource from being deleted during an apply or destroy?

    Answer`prevent_destroy`

  22. What is the primary technical benefit of using Remote Backends?

    AnswerState locking and sharing

  23. Which flag allows an operation to focus on a single specific resource?

    Answer`-target`

  24. Which value is used with the 'sensitive' argument to mask CLI output?

    Answer`true`

  25. What is the official name for HashiCorp's managed Terraform service?

    AnswerHCP Terraform

  26. Which block type is used for global settings like the required Terraform version?

    Answer`terraform`

  27. True or False: A provider block must be explicitly defined for every resource in the HCL.

    AnswerFalse

  28. Which command displays the current state file in a human-readable format?

    Answer`terraform show`

  29. What is an 'Implicit Dependency' in Terraform?

    AnswerResource attribute reference

  30. Which command verifies that HCL is syntactically correct and internally consistent?

    Answer`terraform validate`

Was this useful?

You might also enjoy

Check out some of our other posts on similar topics

Terragrunt: Infrastructure as Code Management

Terragrunt: Infrastructure as Code Management

Welcome to the Terragrunt Basics Quiz! This quiz covers fundamental Terragrunt concepts, including DRY configuration management, remote state handling, module dependencies, and best practices for mana

Packer: Infrastructure Image Building Fundamentals

Packer: Infrastructure Image Building Fundamentals

Welcome to the Packer Basics Quiz! Mastering Packer is the key to creating consistent, automated machine images across any platform. This quiz will test your knowledge of how Packer builds, provisione

Ansible: Configuration Management & Automation

Ansible: Configuration Management & Automation

Welcome to the Ansible Basics Quiz! This quiz covers fundamental Ansible concepts, modules, and best practices. Each question is multiple-choice, and you'll find hints to help you along the way. Good

AWS: Cloud Services & Architecture Fundamentals

AWS: Cloud Services & Architecture Fundamentals

Welcome to the AWS Basics Quiz! This quiz covers fundamental AWS concepts and best practices. Each question is multiple-choice, and you'll find hints to help you along the way. Good luck!

Infrastructure Patterns: IaC, Provisioning & Orchestration

Infrastructure Patterns: IaC, Provisioning & Orchestration

Welcome to the Infrastructure Patterns Quiz! This quiz will test your knowledge of key concepts in infrastructure management, including Infrastructure as Code (IaC), provisioning, configuration manage

Kubernetes: Container Orchestration Essentials

Kubernetes: Container Orchestration Essentials

Welcome to the Kubernetes Basics Quiz! This quiz covers fundamental Kubernetes concepts, container orchestration, and cloud-native application deployment best practices. Each question is multiple-choi

6 related posts