Browse all practice questions for the HashiCorp Terraform Infrastructure as Code (IaC) Practice Test. Search by topic, open any question and review its full explanation, then test yourself in the practice quiz.

HashiCorp Terraform IaC Practice Test 2026 – Your Comprehensive All-in-One Guide to Master Infrastructure as Code! course image
More practice questions

These questions are part of the practice quiz. Start practicing

  • Which Terraform feature allows for finding and managing resource dependencies?
  • Which of the following tasks is NOT the responsibility of a Terraform provider?
  • Which file extension is commonly used for Terraform files?
  • What is a Terraform module?
  • What does the 'terraform plan' command do?
  • Which argument must be included in the module block?
  • Which of the following is NOT a valid string function in Terraform?
  • What command do you use to initialize a Terraform configuration?
  • Which Terraform command is used to validate configurations?
  • What does the terraform plan command do?
  • What concept allows Terraform to integrate variables and resource attributes together?
  • What is the primary purpose of 'terraform import' command?
  • What is Terraform primarily used for?
  • In Terraform, what does the 'output' block do?
  • Which of the following resources can be created using Terraform?
  • Which command is used to view the changes that will be made by applying a Terraform configuration?
  • Which file type is primarily used for writing Terraform configurations?
  • In Terraform, which file format is typically used for defining infrastructure resources and configurations?
  • What is a "tainted" resource in Terraform?
  • To return all the IDs of attached EBS volumes for an AWS virtual machine, which expression should be used?
  • What is the primary purpose of Terraform?
  • What command will get the latest version of plugins in Terraform that complies with the configuration's version constraints?
  • What is the purpose of Terraform modules?
  • How do you declare a variable in a Terraform configuration?
  • What keyword is used to declare a new module in a Terraform configuration file?
  • How would you define a variable in a Terraform configuration file?
  • Which Terraform Workflow involves a backend configured to use Terraform Cloud and pull requests for changes?
  • Which method is NOT suitable for keeping secrets out of Terraform configuration files?
  • In Terraform, what command would you use to export the state to a JSON file?
  • What is the effect of the 'terraform taint' command?
  • When running a terraform refresh command, which of the following is NOT processed?
  • Which command would you use to test your Terraform configuration without applying it?
  • How does Terraform determine changes needed for the infrastructure?
  • Which Terraform command is used to initialize a working directory?
  • In the provided dynamic block, what is the issue that causes it to result in an error?
  • Which of the following types in Terraform is considered a complex type?
  • What language is used to write Terraform configuration files?
  • What distinguishes a map from a list type in Terraform?
  • In regards to backend configuration, what is the default behavior of specifying a remote backend?
  • Which of the following is considered an IaC file?
  • What does the 'terraform refresh' command do?
  • What is the function of the 'terraform import' command?
  • Describe the concept of 'resource' in Terraform.
  • How do you define dependencies between resources in Terraform?
  • Which of the following tasks does terraform init perform?
  • Which feature is NOT available in the free tier of Terraform Cloud?
  • Which command is used to create or update infrastructure in Terraform?
  • In Terraform, what does the 'terraform init' command do?
  • Which two languages are typically used in Terraform configurations?
  • How can you override a variable value during execution?
  • What attribute would you use to specify the default value for a variable in Terraform?
  • What is the benefit of implementing Terraform workspaces?
  • What is the recommended approach to protect sensitive data identified by the security team in Terraform state files?
  • What subcommand would you use to list all resources in the Terraform state?
  • How can a DevOps Engineer expose values from a child module that defines AWS VPC resources to the CLI?
  • What feature in Terraform allows for setting default values for input variables?
  • Which command is used to initialize a Terraform configuration?
  • What command is used to enable a new workspace in Terraform?
  • What is the purpose of the 'terraform validate' command?
  • How can you ensure consistent environments when using Terraform?
  • Which command initializes a directory containing Terraform configuration files?
  • Which provider would you configure to manage AWS resources in Terraform?
  • In Terraform, what does the term 'state' refer to?
  • What is the use-case for terraform output?
  • What functionality does Terraform's `output` variable provide?
  • What file is typically used to specify multiple environments in Terraform?
  • What command is primarily used to create or update infrastructure in Terraform?
  • What is the role of 'depends_on' in Terraform modules?
  • Which command applies changes to the infrastructure as specified in the Terraform configuration files?
  • Which Terraform command assists in detecting and managing drift?
  • What file format does Terraform primarily use for its configuration files?
  • What does setting the TF_LOG environment variable to DEBUG impact?
  • What is a remote backend in Terraform?
  • Which command outputs the current state of the managed infrastructure?
  • What command initializes a Terraform configuration?
  • How can you prevent certain resources from being destroyed in Terraform?
  • Which variable type is most suitable for storing both a server name (string) and memory size (number) in Terraform?
  • What is the best practice to protect sensitive values in Terraform state files?
  • Which command would you use to see the resources currently being managed in a Terraform state file?
  • What is the default state file for Terraform?
  • What is the main purpose of the 'terraform graph' command?
  • What benefit does Terraform Cloud provide for team collaboration?
  • Which command allows you to see anytime your infrastructure will change?
  • What does the 'terraform validate' command do?
  • What does IaC stand for in the context of HashiCorp Terraform?
  • What is the benefit of using 'terraform plan -out'?
  • What does the command 'terraform state show' do?
  • How does Terraform handle resource dependencies?
  • Which of the following is a valid way to refer to a module in Terraform?
  • What command can you use to create an execution plan in Terraform?
  • What file extension do Terraform configuration files use?
  • Is it mandatory to include a provisioner within a resource block when configuring resources in Terraform?
  • What method can be employed to ensure infrastructure changes are reviewed before being applied?
  • Which command is used to apply changes required to reach the desired state?
  • What is a data source in Terraform?
  • Which of these Terraform commands is used to clean or remove all associated resources of the current directory?
  • Which command should you use to view the Terraform state?
  • What is the purpose of the triggers block in a null_resource?
  • How can outputs be exported in Terraform?
  • What is the correct command to delete a workspace in Terraform?
  • What is the purpose of the 'terraform validate' command?
  • Which expression is used to apply the splat operator to return multiple EBS volume IDs?
  • Can a Terraform local value reference other local values?
  • What is the safest way to include sensitive variables in a CI/CD pipeline for Terraform?
  • What is the primary benefit of using Terraform Cloud?
  • How do you target a specific resource when applying changes?
  • What can you do with Terraform Cloud Run Triggers?
  • How does Terraform handle sensitive variables?
  • What type of configuration does Terraform primarily manage?
  • What does the Terraform command 'terraform apply -refresh-only' do?
  • What is a provider in Terraform?
  • What command is used to initialize a new Terraform configuration?
  • What action does 'terraform state mv' perform?
  • In Terraform, what does a module represent?
  • What command is used to apply changes required to reach the desired state of the configuration?
  • What is a workspace in Terraform?
  • In Terraform, what is the purpose of `count`?
  • What is a resource in Terraform?
  • What command would you run to switch to a different workspace in Terraform?
  • What is a workspace in Terraform?
  • How can you prevent sensitive data from being exposed in state files?
  • Which of the following is a valid terraform import command?
  • Which command initializes a Terraform configuration?
  • Which file extensions are associated with Terraform configuration files?
  • Which file type is used to define the resources and configurations for Terraform?
  • In Terraform, what does the 'terraform apply' command do?
  • What does the command 'terraform resource list aws_instance.server' do?
  • Which command would you use to check for discrepancies between the actual infrastructure and your Terraform configuration?
  • Is it mandatory to include a provider configuration block in every Terraform configuration?
  • Is Terraform considered open-source software (OSS)?
  • What is the purpose of a Terraform module?
  • What is a data source in Terraform?
  • What is the scope of local values defined in child modules in Terraform?
  • What is the purpose of the `terraform state` command?
  • How can you protect sensitive information in Terraform variables?
  • How does Terraform determine the correct provider version to use?
  • In Terraform, what is an output value?
  • What does the `terraform plan` command do?
  • What file extension is typically used for Terraform configuration files?
  • What is the primary function of the 'terraform login' command?
  • Which command lists the workspaces in Terraform?
  • How is versioning handled in Terraform?
  • Which command is used to remove Terraform-managed infrastructure?
  • Which command is used to show a resource in the Terraform state?
  • What is the purpose of the 'terraform fmt' command?
  • When Terraform crashes because Golang results in a panic, where will it log the results?
  • What command is used to initialize the backend configuration in Terraform?
  • How can you change the behavior of a resource during lifecycle events?
  • What is the purpose of the .terraform.lock.hcl file?
  • How do you set up a Terraform backend?
  • What does the coalesce built-in function in Terraform return?
  • What type of values can variables in Terraform hold?
  • Which command saves the execution plan to a file?
  • What does the 'terraform output' command provide?
  • How does Terraform manage state?
  • How can you maintain idempotency in Terraform configurations?
  • What is the primary language used to write Terraform configurations?
  • What is the primary function of a remote backend in Terraform?
  • What is the primary purpose of Terraform?
  • What is the difference between 'terraform apply' and 'terraform plan'?
  • Where can an API Token for Terraform Cloud or Terraform Enterprise be stored?
  • What is the function of a remote backend in Terraform?
  • Can Terraform be used to manage resources outside of cloud providers?
  • Which of the following is a key feature of Terraform's infrastructure as code?
  • What does the term "Partial configuration" refer to in Terraform?
  • Which command is used to manually mark a resource as tainted in Terraform?
  • What does the command 'terraform state rm' do?
  • Why is it important to use remote state storage?
  • What block structure correctly defines a remote backend to Amazon S3?
  • Can you write a Terraform configuration that includes both AWS and Azure providers?
  • What is the purpose of the 'terraform plan' command?
  • What is the best way to protect sensitive data in Terraform projects?
  • What does the 'terraform apply' command do?
  • When would it be appropriate to use a null_resource in Terraform?
  • How are variables passed into Terraform configurations?
  • What does the 'terraform state' command do?
  • Which command should you use to ensure a null resource in Terraform re-runs a backup process after script changes?
  • How can developers inject secrets via Vault at the time of terraform apply within their configuration file?
  • What does the state locking mechanism in Terraform do?
  • What types of search terms can the Terraform Registry use?
  • What are provisioners primarily used for in Terraform?
  • What command is used to apply changes in Terraform?
  • What is the purpose of the 'terraform apply' command?
  • What type of resources can Terraform manage?
  • What does the command 'terraform refresh' do?
  • What is the function of the 'terraform destroy' command?
  • What are the common attributes of a Terraform resource block?
  • Which two components can a connection block be nested within?
  • Which file extension is commonly used for Terraform configuration files?
  • How do you set a custom path for Terraform Logging via environment variable?
  • What file type does Terraform use for configuration files?
  • What is a primary benefit of using modules in Terraform?
  • What does the Terraform lifecycle block define?
  • How do you specify the provider you want to use in Terraform?
  • What is the primary purpose of a Terraform state file?
  • How can variables be set in a Terraform configuration?
  • How can outputs be utilized in Terraform?
  • How do you extract a list of IDs from a variable named var.list containing a list of objects?
  • What does the command 'terraform workspace show' do?
  • What does the command 'terraform state list' do?
  • What are variables used for in Terraform?
  • In Terraform, what is a workspace?
  • How do you define dependencies manually if Terraform cannot automatically resolve them?
  • What does the 'terraform refresh' command do?
  • What is the name of the dependency lock file created by Terraform when it locks its state?
  • Does the command 'terraform refresh' modify the existing infrastructure?
Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy