We at Crack4sure are committed to giving students who are preparing for the HashiCorp Terraform-Associate-004 Exam the most current and reliable questions . To help people study, we've made some of our HashiCorp Certified: Terraform Associate (004) (HCTA0-004) exam materials available for free to everyone. You can take the Free Terraform-Associate-004 Practice Test as many times as you want. The answers to the practice questions are given, and each answer is explained.
What is modified when executing Terraform inrefresh-only mode?
Which command add existing resources into Terraform state?
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?
You ' re writing a Terraform configuration that needs to read input from a local file called id_rsa.pub . Which built-in Terraform function can you use to import the file ' s contents as a string?
Exhibit:
data " vsphere_datacenter " " dc " {}
resource " vsphere_folder " " parent " {
path = " Production "
type = " vm "
datacenter_id = _________
}
You want to pass the id of the vsphere_datacenter data source to the datacenter_id argument of the vsphere_folder resource. Which reference would you use?
What kind of configuration block will manage an infrastructure object with settings specified within the block?
What value does the Terraform Cloud private registry provide over the public Terraform Module Registry?
Which backend does the Terraform CLI use by default?
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 type of block fetches or computes information for use elsewhere in a Terraform configuration?
How does the use of Infrastructure as Code (IaC) enhance the reliability of your infrastructure?
Pick the two correct responses below.
Which of the following methods, used to provision resources into a public cloud, demonstrates the concept of infrastructure as code?
Select the command that doesn’t cause Terraform to refresh its state.
Terraform installs its providers during which phase?
You’ve updated your Terraform configuration, and you need to preview the proposed changes to your infrastructure. Which command should you run?
You want to bring an existing database under Terraform management. What information is required to create a new import block for the database?
Pick the two correct responses below.
You’ve enabled DEBUG-level logging for Terraform, and you’d like to send the log data to a file. Which action should you take?
Why would you use the -replace flag for terraform apply?
You have a list of numbers that represents the number of free CPU cores on each virtual cluster:
numcpus = [ 18, 3, 7, 11, 2 ]
What Terraform function could you use to select the largest number from the list?
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?
Which of these are features of Terraform Cloud? Choose two correct answers.
Terraformrequiresthe Go runtime as a prerequisite for installation.
Which of these statements about Terraform Cloud workspaces is false?
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)?
If you don’t use the local Terraform backend, where else can Terraform save resource state?
Which of the following statements about Terraform modules is not true?
Which command must you first run before performing further Terraform operations in a working directory?
terraform init creates an example main.tf file in the current directory.
When using a remote backend or terraform Cloud integration, where does Terraform save resource sate?
In a Terraform Cloud workpace linked to a version control repository speculative plan rum start automatically commit changes to version control.
A senior admin accidentally deleted some of your cloud instances. What will Terraform do when you run terraform apply?
Exhibit:
data " aws_ami " " web " {
most_recent = true
owners = [ " self " ]
tags = {
Name = " web-server "
}
}
A data source is shown in the exhibit. How do you reference the id attribute of this data source?
Multiple team members are collaborating on infrastructure using Terraform and want to format the* Terraform code following standard Terraform-style convention.
How should they ensure the code satisfies conventions?
How can you trigger a run in a Terraform Cloud workspace that is connected to a Version Control System (VCS) repository?
When should you use the force-unlock command?
Which of these are benefits of using Sentinel with HCP Terraform/Terraform Cloud? (Pick the 3 correct responses)
What is the provider for the resource shown in the Exhibit?
resource " aws_vpc " " main " {
name = " test "
}
Terraform can only manage resource dependencies if you set them explicitly with the depends_on argument.
Your team is collaborating on infrastructure using Terraform and wants to format code to follow Terraform language style conventions. How can you update your code to meet these requirements?
What is the provider for this resource?
What is the purpose of state locking in a remote backend?
Where in your Terraform configuration do you specify remote state storage settings?
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.
Terraform encrypts sensitive values stored in your state file.
A module block is shown in the Exhibit space of this page. When you use a module block to reference a module from the Terraform Registry such as the one in the example, how do you specify version 1.0.0 of the module?
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?
Why would you use the -replace flag for terraform apply?
Which of these is true about Terraform ' s plugin-based architecture?
By default, if you do not define a backend for your configuration, where does Terraform store information about the resources that it manages?
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?
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?
When does Sentinel enforce policy logic during a Terraform Cloud run?
Outside of the required_providers block, Terraform configurations always refer to providers by their local names.
Exhibit:
variable " sizes " {
type = list(string)
description = " Valid server sizes "
default = [ " small " , " medium " , " large " ]
}
A variable declaration is shown in the exhibit. Which is the correct way to get the value of medium from this variable?
You have to initialize a Terraform backend before it can be configured.
Where does the Terraform local backend store its state?
You cannot install third party plugins using terraform init.
You created infrastructure outside the Terraform workflow that you now want to manage using Terraform. Which command brings the infrastructure into Terraform state?
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?
You are tasked with making a change to an infrastructure stack running in a public cloud using HCP Terraform/Terraform Cloud. Which pattern follows IaC best practices?
What does terraform import do?
When you use a remote backend that needs authentication, HashiCorp recommends that you:
You must use different Terraform commands depending on the cloud provider you use.
Variables declared within a module are accessible outside of the module.
Which two steps are required to provision new infrastructure in the Terraform workflow? (Pick the 2 correct responses below.)
Which of these actions are forbidden when the Terraform state file is locked? (Pick the 3 correct responses)
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?
Which task does terraform init not perform?
What does the default " local " Terraform backend store?
Exhibit:
provider " aws " { region = " us-east-1 " }
provider " aws " { region = " us-west-2 " }
You need to deploy resources into two different AWS regions in the same Terraform configuration using the provider blocks shown in the exhibit. What do you need to add to the provider configuration to deploy a resource to the us-west-2 AWS region?
When declaring a variable, setting the sensitive argument to true will prevent the value from being stored in the state file.
The terraform output command shows outputs from child modules.
Why does this backend configuration not follow best practices?

_______backends support state locking.
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?
As a developer, you want to ensure your plugins are up to date with the latest versions. Which Terraform command should you use?
Setting the TF_LOG environment variable to DEBUG causes debug messages to be logged into stdout.
Which of these actions will prevent two Terraform runs from changing the same state file at the same time?
It is best practice to store secret data in the same version control repository as your Terraform configuration.
Where in your Terraform configuration do you specify a state backend?
Terraform variable names are saved in the state file.
You used Terraform to create an ephemeral development environment in the cloud 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 the resources that will be deleted? (Pick the 2 correct responses)
When using multiple configuration of the same Terraform provider, what meta-argument must you include in any non-default provider configurations?
You can reference a resource created with for_each using a Splat ( *) expression.
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?
How does Terraform determine dependencies between resources?
Define the purpose of state in Terraform.
A resource block is shown in the Exhibit section of this page. How would you reference the attribute name of this resource in HCL?
Which of the following locations can Terraform use as aprivate sourcefor modules?(Pick 2 correct responses)
You have declared a variable called var.list which is a list of objects that all have an attribute id . Which options will produce a list of the IDs? Choose two correct answers.
3 Months Free Update
3 Months Free Update
3 Months Free Update