Terraform-Associate-004 HashiCorp Certified: Terraform Associate (004) (HCTA0-004) Questions and Answers
Before you can use a new backend or HCP Terraform/Terraform Cloud integration, you must first execute terraform init.
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?
Which of these ate secure options for storing secrets for connecting to a Terraform remote backend? Choose two correct answers.
A resource block is shown in the Exhibit space of this page. What is the Terraform resource name of the resource block?
How can you trigger a run in a Terraform Cloud workspace that is connected to a Version Control System (VCS) repository?
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)
Which command should you run to check if all code in a Terraform configuration that references multiple modules is properly formatted without making changes?
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 should you add in the required_providers block to define a provider version constraint?
Which of these are benefits of using Sentinel with HCP Terraform/Terraform Cloud? (Pick the 3 correct responses)
Setting the TF_LOG environment variable to DEBUG causes debug messages to be logged into stdout.
You should run terraform fnt to rewrite all Terraform configurations within the current working directory to conform to Terraform-style conventions.
What is the Terraform style convention for indenting a nesting level compared to the one above it?
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?
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.
Your security team scanned some Terraform workspaces and found secrets stored in plaintext in state files. How can you protect that data?
What kind of configuration block will create an infrastructure object with settings specified within the block?
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.
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.
Which two steps are required to provision new infrastructure in the Terraform workflow? Choose two correct answers.
When you use a remote backend that needs authentication, HashiCorp recommends that you:
Which method for sharing Terraform configurations fulfills the following criteria:
1. Keeps the configurations confidential within your organization
2. Support Terraform’s semantic version constrains
3. Provides a browsable directory
Which of the following is true about terraform apply?(Pick 2 correct responses)
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 command must you first run before performing further Terraform operations in a working directory?
In a Terraform Cloud workpace linked to a version control repository speculative plan rum start automatically commit changes to version control.
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?

A resource block is shown in the Exhibit space of this page. What is the Terraform resource name of that resource block?
A senior admin accidentally deleted some of your cloud instances. What will Terraform do when you run terraform apply?
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?
Which of these are features of HCP Terraform/Terraform Cloud? Pick the 2 correct responses below.
Which of the following should you add in the required_providers block to define a provider version constraint?
A provider configuration block is required in every Terraform configuration.
Example:

The Terraform binary version and provider versions must match each other in a single configuration.
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?
In Terraform HCL, an object type of object({name=string, age-number}) would match this value.

Module variable assignments are inherited from the parent module and you do not need to explicitly set them.
If a module declares a variable without a default value, you must pass the value of the variable within the module block when you call the module in your configuration.
Which of the following can you do with terraform plan? (Pick 2 correct responses)
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?
It is best practice to store secret data in the same version control repository as your Terraform configuration.
What does Terraform not reference when running a terraform apply -refresh-only ?
You can reference a resource created with for_each using a Splat ( *) expression.
Changing the Terraform backend from the default "local" backend to a different one after performing your first terrafom apply is:
Exhibit.

You need to deploy resources into two different regions in the same Terraform configuration. To do this, you declare multiple provider configurations as shown in the Exhibit space on this page.
What meta-argument do you need to configure in a resource block to deploy the resource to the us-west-2 AWS region?