HashiCorp Terraform-Associate-004 HashiCorp Certified: Terraform Associate (004) (HCTA0-004) Exam Practice Test
Total 384 questions
HashiCorp Certified: Terraform Associate (004) (HCTA0-004) Questions and Answers
You can configure multiple cloud blocks in your Terraform configuration to connect your workspace to both HCP Terraform and your Terraform Enterprise instance.
When should you use the force-unlock command?
Your root module contains a variable namednum_servers. Which is the correct way to pass its value to a child module with an input namedservers?
You just upgraded the version of a provider in an existing Terraform project. What do you need to do to install the new provider?
You should run terraform fnt to rewrite all Terraform configurations within the current working directory to conform to Terraform-style conventions.
Does terraform init create an example main.tf file in the current directory?
Terraform configuration (including any module references) can contain only one Terraform provider type.
Terraform variable names are saved in the state file.
You have a simple Terraform configuration containing one virtual machine (VM) in a cloud provider. You run terraform apply and the VM is created successfully. What will happen if you terraform apply again immediately afterward without changing any Terraform code?
The HCP Terraform private registry keeps the module configurations confidential within your organization.
What command can you run to generateDOT (Graphviz)formatted data to visualize Terraform dependencies?
When does Terraform create the .terraform.lock.hc1 file?
Which command doesnotcause Terraform to refresh its state?
How can you trigger a run in a Terraform Cloud workspace that is connected to a Version Control System (VCS) repository?
Which Terraform collection type should you use to store key/value pairs?
Which method for sharing Terraform modules fulfills the following criteria:
Keeps the module configurations confidential within your organization.
Supports Terraform ' s semantic version constraints.
Provides a browsable directory of your modules.
Which of these are features of Terraform Cloud? Choose two correct answers.
Which of the following commands would you use to access all of the attributes and details of a resource managed by Terraform?
Which of the following methods, used to provision resources into a public cloud, demonstrates the concept of infrastructure as code?
Which are benefits of migrating from a local state backend to a remote backend? (Pick the 2 correct responses below.)
When you run terraform apply, the Terraform CLI will print output values from both the root module and any child modules.
Which of the following is not a key principle of infrastructure as code?
Which argument can you set on a module block to prevent Terraform from updating the module’s configuration during an init or get operation?
Running terraform fmt without any flags in a directory with Terraform configuration files check the formatting of those files without changing their contents.
You have just upgraded the version constraint of a provider in an existing Terraform configuration. What command will install the new provider version?
What does this code do?
terraform { required_providers { aws = " > = 3.0 " }}
Which are examples of infrastructure as code? Choose two correct answers.
Which command add existing resources into Terraform state?
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?
Which of the following is not a valid string function in Terraform?
A Terraform provider is NOT responsible for:
You need to destroy all of the resources in your Terraform workspace, except for aws_instance.ubuntu[1], which you want to keep. How can you tell Terraform to stop managing that specific resource without destroying it?
Terraform variables and outputs that set the description argument will store that description in the state file.
Which of these statements about Terraform Cloud workspaces is false?
You just scaled your VM infrastructure and realize you set the count variable to the wrong value. You correct the value and save your change. What must you do next to make your infrastructure match your configuration?
Terraform can only manage resource dependencies if you set them explicitly with the depends_on argument.
You are creating a reusable Terraform configuration and want to include an optional billing_dept tag so your Finance team can track team-specific spending on resources. Which of the following billing_dept variable declarations will achieve this?
You have used Terraform lo create an ephemeral development environment in the (loud and are now ready to destroy all the Infrastructure described by your Terraform configuration To be safe, you would like to first see all the infrastructure that Terraform will delete.
Which command should you use to show all of the resources that mil be deleted? Choose two correct answers.
Which of these are features of HCP Terraform/Terraform Cloud? (Pick the 2 correct responses)
Which of the following is not a valid Terraform variable type?
What feature stops multiple users from operating on the Terraform state at the same time?
How can you configure a Terraform workspace to store its state remotely?
Terraform providers are always installed from the Internet.
Which command(s) adds existing resources in a public cloud into Terraform state?
Which command generates DOT (Document Template) formatted data to visualize Terraform dependencies?
terraform validate confirms the syntax of Terraform configuration files.
How can terraform plan aid in the development process?
How would you reference the volume IDs associated with the ebs_block_device blocks in this configuration?

terraform validate uses provider APIs to verify your infrastructure settings.
A resource block is shown in the Exhibit space of this page. What is the Terraform resource name of the resource block?
Which of these ate features of Terraform Cloud? Choose two correct answers.
Which command lets you experiment with terraform expressions?
You add a new provider to your configuration and immediately run terraform apply in the CD using the local backend. Why does the apply fail?
A module can always refer to all variables declared in its parent module.
You have set the TF_LOG_PATH environment variable for Terraform, and you would like to ensure the logs contain all debug-level messages and verbose process logs.
Which action should you take?
You have developed a new cloud-based service that uses proprietary APIs and want to use Terraform to create, manage, and delete users from the service. How can Terraform interact with the service?
terraform init creates an example main.tf file in the current directory.
A resource block is shown in the Exhibit section of this page. How would you reference the attribute name of this resource in HCL?
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
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.
A module block used in your configuration is shown in the exhibit. You have been asked to update the version of this module from 4.2.1 to 5.0.0.
Exhibit:
module " compute " {
source = " Azure/compute/azurerm "
version = " 4.2.1 "
}
Which two steps must you take to accomplish this?
Which is the best way to specify a tag of v1.0.0 when referencing a module stored in Git (for example.
Git::https://example.com/vpc.git)?
All standard backend types support state locking, and remote operations like plan, apply, and destroy.
When you run terraform apply -refresh-only, which of the following is not consulted by Terraform to update the state file?

A resource block is shown in the Exhibit space of this page. What is the provider for this resource?
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 correct responses)
Terraform installs its providers during which phase?
Terraform encrypts sensitive values stored in your state file.
What functionality do providers offer in Terraform? (Pick the 3 correct responses below.)
You add a new resource to an existing Terraform configuration, but do not update the version constraint in the configuration. The existing and new resources use the same provider. The working contains a .terraform.lock, hc1 file.
How will Terraform choose which version of the provider to use?
You need to deploy resources into two different regions in the same Terraform configuration using the block shown in the exhibit below.
What do you need to add to the provider configuration to deploy the resource to the us-west-2 AWS region?
Running terraform fmt without any flags in a directory with Terraform configuration files will check the formatting of those files, but will never change their contents.
A provider configuration block is required in every Terraform configuration.
Example:
You much initialize your working directory before running terraform validate.
Which of the following can you do with terraform plan?
Pick the two correct responses below.
How is terraform import run?
Which of the following should you put into the required_providers block?
You manage two workspaces in your HCP Terraform organization. The first workspace manages your network configuration. The second workspace manages your compute resources and retrieves values from the networking workspace.
What HCP Terraform feature lets you run an apply operation on the compute workspace every time you update the networking workspace?
Which parameters does terraform import require? Choose two correct answers.
Which of the following should you add in the required_providers block to define a provider version constraint?
What task does the terraform import command perform?
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?
What does terraform destroy do?
Which of the following is true about terraform apply?(Pick 2 correct responses)
Why is it considered important to treat your Terraform state file as sensitive?
Select the command that doesn’t cause Terraform to refresh its state.
How does the Terraform cloud integration differ from other state backends such as S3, Consul,etc?
The exhibit shows part of a configuration that you have been asked to update.
The name of the Azure Virtual Network must be set to the name of the resource group, followed by a dash and the word vnet.
Exhibit
data " azurerm_resource_group " " example " {
name = var.resource_group_name
}
resource " azurerm_virtual_network " " example " {
name = ________________________
}
Which expression fulfills this requirement?
When using multiple configuration of the same Terraform provider, what meta-argument must you include in any non-default provider configurations?
What is the primary purpose of IaC (Infrastructure as Code)?
Which of these ate secure options for storing secrets for connecting to a Terraform remote backend? Choose two correct answers.
Terraform providers are part of the Terraform core binary.
When you include a module block in your configuration that references a module from the Terraform Registry, the " version " attribute is required.
Your team is using version 3.1.4 of a module from the public Terraform Registry, and they are worried about possible breaking changes in future versions of the module. Which version argument should you add to the module block to prevent newer versions from being used?
What’s the proper syntax for the plan command?
Which of these commands makes your code more human readable?
Which two steps are required to provision new infrastructure in the Terraform workflow? (Pick the 2 correct responses below.)
Which provider authentication method prevents credentials from being stored in the state file?
You have a simple Terraform configuration containing one virtual machine (VM) in a cloud provider. You run terraform apply and the VM is created successfully.
What will happen if you delete the VM using the cloud provider console, then run terraform apply again without changing any Terraform code?
_______backends support state locking.
If a module declares a variable with a default, that variable must also be defined within the module.
What is modified when executing Terraform inrefresh-only mode?
Changing the Terraform backend from the default " local " backend to a different one after performing your first terrafom apply is:
Exhibit:
module " network " {
source = " terraform-google-modules/network/google "
version = " ~ > 11.0 "
}
What version of the source module does Terraform allow with the module block shown in the exhibit?
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?
What is the provider for the resource shown in the Exhibit?
resource " aws_vpc " " main " {
name = " test "
}
Which of the following is not an action performed by terraform init?
If a DevOps team adopts AWS CloudFormation as their standardized method for provisioning public cloud resoruces, which of the following scenarios poses a challenge for this team?
What is a Terraform provider not responsible for?
What is one disadvantage of using dynamic blocks in Terraform?
Which type of information does the Terraform Registry provide about the modules it hosts?
Which of the following is not a valid source path for specifying a module?
Your Terraform configuration declares a variable. You want to enforce that its value meets your specific requirements, and you want to block the Terraform operation if it does not. What should you add to your configuration?
What type of information can be found on the Terraform Registry when using published modules?
You can install community and partner plugins using terraform init.
Total 384 questions

