HashiCorp Certified: Terraform Associate (003) (HCTA0-003) Questions and Answers
A Terraform provider is NOT responsible for:
Which statement describes a goal of Infrastructure as Code (IaC)?
Which of these are features of HCP Terraform/Terraform Cloud? (Pick the 2 correct responses)
Before you can use a new backend or HCP Terraform/Terraform Cloud integration, you must first execute terraform init.
Which of these actions will prevent two Terraform runs from changing the same state file at the same time?
Terraform configuration can only call modules from the public registry.
Which of these statements about Terraform Cloud workspaces is false?
You have a Terraform configuration that defines a single virtual machine with no references to it, You have run terraform apply to create the resource, and then removed the resource definition from your Terraform configuration file.
What will happen you run terraform apply in the working directory again?
Changing the Terraform backend from the default "local" backend to a different one after performing your first terrafom apply is:
You can configure Terraform to log to a file using the TF_LOG environment variable.
What is the Terraform style convention for indenting a nesting level compared to the one above it?
You are using a networking module in your Terraform configuration with the name label my-network. In your main configuration you have the following code:
When you run terraform validate, you get the following error:
What must you do to successfully retrieve this value from your networking module?
While attempting to deploy resources into your cloud provider using Terraform, you begin to see some odd behavior and experience slow responses. In order to troubleshoot you decide to turn on Terraform debugging. Which environment variables must be configured to make Terraform's logging more verbose?
Which provider authentication method prevents credentials from being stored in the state file?
What does this code do?
terraform { required_providers { aws = ">= 3.0" }}
Which of the following is not a valid Terraform collection type?
What does terraform import do?
Where can Terraform not load a provider from?
Which of the following is availableonlyinHCP Terraform workspacesandnot in Terraform CLI?
What is the name of the default file where Terraform stores the state?
Type your answer in the field provided. The text field is not case-sensitive and all variations of the correct answer are accepted.
It is best practice to store secret data in the same version control repository as your Terraform configuration.
Module version is required to reference a module on the Terraform Module Registry.
Which of the following locations can Terraform use as aprivate sourcefor modules?(Pick 2 correct responses)
You created infrastructure outside the Terraform workflow that you now want to manage using Terraform. Which command brings the infrastructure into Terraform state?
Which are examples of infrastructure as code? Choose two correct answers.
You're building a CI/CD (continuous integration/continuous delivery) pipeline and need to inject sensitive variables into your Terraform run. How can you do this safely?
You want to define a single input variable to capture configuration values for a server. The values must represent memory as a number, and the server name as a string.
Which variable type could you use for this input?
In a Terraform Cloud workpace linked to a version control repository speculative plan rum start automatically commit changes to version control.
You have deployed a new webapp with a public IP address on a cloud provider. However, you did not create any outputs for your code. What is the best method to quickly find the IP address of the resource you deployed?
When do changes invoked by terraform apply take effect?
Which of these are benefits of using Sentinel with HCP Terraform/Terraform Cloud? (Pick the 3 correct responses)
terraform apply is failing with the following error. What next step should you take to determine the root cause of the problem?
Error:
yaml
CopyEdit
Error loading state: AccessDenied: Access Denied
status code: 403, request id: 288766CE5CCA24A0, host id: web.example.com
Which configuration consistency errors does terraform validate report?
Which of the following is not a valid Terraform variable type?
You should run terraform fnt to rewrite all Terraform configurations within the current working directory to conform to Terraform-style conventions.
In Terraform HCL, an object type of object({name=string, age-number}) would match this value.

As a member of an operations team that uses infrastructure as code (lac) practices, you are tasked with making a change to an infrastructure stack running in a public cloud. Which pattern would follow laC best practices for making a change?
Which of the following commands would you use to access all of the attributes and details of a resource managed by Terraform?
Terraform providers are part of the Terraform core binary.
terraform init retrieves and caches the configuration for all remote modules.
Which of the following should you add in the required_providers block to define a provider version constraint?
Which command add existing resources into Terraform state?
If you manually destroy infrastructure, what is the best practice reflecting this change in Terraform?
You ate making changes to existing Terraform code to add some new infrastructure. When is the best time to run terraform validate?
terraform init creates an example main.tf file in the current directory.
The public Terraform Module Registry is free to use.
Which is the best way to specify a tag of v1.0.0 when referencing a module stored in Git (for example.
terraform validate confirms that your infrastructure matches the Terraform state file.
Which of these is true about Terraform's plugin-based architecture?
Running terraform fmt without any flags in a directory with Terraform configuration files check the formatting of those files without changing their contents.
You've used Terraform to deploy a virtual machine and a database. You want to replace this virtual machine instance with an identical one without affecting the database. What is the best way to achieve this using Terraform?
Terraform encrypts sensitive values stored in your state file.
You have multiple team members collaborating on infrastructure as code (IaC) using Terraform, and want to apply formatting standards for readability.
How can you format Terraform HCL (HashiCorp Configuration Language) code according to standard Terraform style convention?
Which of the following are advantages of using infrastructure as code (laC) instead of provisioning with a graphical user interface (GUI)? Choose two correct answers.
What is modified when executing Terraform inrefresh-only mode?
You are writing a child Terraform module that provisions an AWS instance. You want to reference the IP address returned by the child module in the root configuration. You name the instance resource "main'.
Which of these is the correct way to define the output value?
You decide to move a Terraform state file to Amazon S3 from another location. You write the code below into a file called backend.tf.

Which command will migrate your current state file to the new S3 remote backend?
When you use a remote backend that needs authentication, HashiCorp recommends that you:
Which of the following arguments are required when declaring a Terraform output?
A terraform apply can not _________ infrastructure.
One cloud block always maps to a single HCP Terraform/Terraform Cloud workspace.
All modules published on the official Terraform Module Registry have been verified by HasihCorp.
You modified your Terraform configuration to fix a typo in the resource ID by renaming it from photoes to photos. What configuration will you add to update the resource ID in state without destroying the existing resource?
Original configuration:
resource "aws_s3_bucket" "photoes" {
bucket_prefix = "images"
}
Updated configuration:
resource "aws_s3_bucket" "photos" {
bucket_prefix = "images"
}
You want to use API tokens and other secrets within your team's Terraform workspaces. Where does HashiCorp recommend you store these sensitive values? (Pick 3)
Which of the following is not true of Terraform providers?
What does Terraform use the .terraform.lock.hc1 file for?
All standard backend types support state locking, and remote operations like plan, apply, and destroy.
A developer launched a VM outside of the Terraform workflow and ended up with two servers with the same name. They are unsure which VM is managed with Terraform, but they do have a list of all active VM IDs. Which method could you use to determine which instance Terraform manages?
Which two steps are required to provision new infrastructure in the Terraform workflow? Choose two correct answers.
You use a cloud provider account that is shared with other team members. You previously used Terraform to create a load balancer that listens on port 80. After application changes, you updated the Terraform code to change the port to 443.
You run terraform plan and see that the execution plan shows the port changing from 80 to 443 like you intended and step away to grab some coffee.
In the meantime, another team member manually changes the load balancer port to 443 through the cloud provider console before you get back to your desk.
What will happen when you run terraform apply upon returning to your desk?
You want to know from which paths Terraform is loading providers referenced in your Terraform configuration (* files). You need to enable additional logging messages to find this out. Which of the following would achieve this?
Infrastructure as Code (laC) can be stored in a version control system along with application code.
What is a key benefit of the Terraform state file?
You have provisioned some virtual machines (VMs) on Google Cloud Platform (GCP) using the gcloud command line tool. However, you are standardizing with Terraform and want to manage these VMs using Terraform instead. What are the two things you must do to achieve this? Choose two correct answers.
You modified your Terraform configuration and run Terraform plan to review the changes. Simultaneously, your teammate manually modified the infrastructure component you are working on. Since you already ran terraform plan locally, the execution plan for terraform apply will be the same.