Terraform-Associate-004 HashiCorp Certified: Terraform Associate (004) (HCTA0-004) Questions and Answers
Which of these are benefits of using Sentinel with HCP Terraform/Terraform Cloud? (Pick the 3 correct responses)
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?
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?
Where does HashiCorp recommend you store API tokens and other secrets within your team’s Terraform workspaces?
Pick the three correct responses below.
You just upgraded the version of a provider in an existing Terraform project. What do you need to do to install the new provider?
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 the following can you do with terraform plan? (Pick 2 correct responses)
You are responsible for a set of infrastructure that is managed by two workspaces: example-network and example-compute . The example-compute workspace uses data from output values configured in the example-network workspace and must be deployed afterward. Currently, this is a manual process:
An operator deploys changes to the example-network workspace.
They manually copy the output values from the example-network workspace to input variables configured for the example-compute workspace.
They deploy the example-compute workspace.
Which HCP Terraform features can you use to automate this process?
Pick the two correct responses below.
What is the Terraform style convention for indenting a nesting level compared to the one above it?
When using multiple configuration of the same Terraform provider, what meta-argument must you include in any non-default provider configurations?
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.
How can you trigger a run in a Terraform Cloud workspace that is connected to a Version Control System (VCS) repository?
All modules published on the official Terraform Module Registry have been verified by HasihCorp.
A developer accidentally launched a VM (virtual machine) outside of the Terraform workflow and ended up with two servers with the same name. They don ' t know which VM Terraform manages but do have a list of all active VM IDs.
Which of the following methods could you use to discover which instance Terraform manages?
Terraform can only manage resource dependencies if you set them explicitly with the depends_on argument.
You are working on some new application features and you want to spin up a copy of your production deployment to perform some quick tests. In order to avoid having to configure a new state backend, what open source Terraform feature would allow you create multiple states but still be associated with your current code?
Running terraform fmt without any flags in a directory with Terraform configuration files check the formatting of those files without changing their contents.
Which of the following isnotan advantage of using Infrastructure as Code (IaC) operations?
Changing the Terraform backend from the default " local " backend to a different one after performing your first terrafom apply is:
Which of these actions will prevent two Terraform runs from changing the same state file at the same time?
Module version is required to reference a module on the Terraform Module Registry.
Which provider authentication method prevents credentials from being stored in the state file?
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 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?
All standard backend types support state locking, and remote operations like plan, apply, and destroy.
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.
When you include a module block in your configuration that references a module from the Terraform Registry, the " version " attribute is required.
Exhibit:
module " web_stack " {
source = " ./modules/web_stack "
}
Your configuration defines the module block shown in the exhibit. The web_stack module accepts an input variable named servers. Which of the following changes to the module block sets the servers variable to the value of 3?
Setting the TF_LOG environment variable to DEBUG causes debug messages to be logged into stdout.
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?
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?
Your DevOps team is currently using the local backend for your Terraform configuration. You would like to move to a remote backend to store the state file in a central location. Which of the following backends would not work?
Which type of block fetches or computes information for use elsewhere in a Terraform configuration?
Which of these ate secure options for storing secrets for connecting to a Terraform remote backend? Choose two correct answers.
When using a remote backend or terraform Cloud integration, where does Terraform save resource sate?
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.
Terraform variables and outputs that set the description argument will store that description in the state file.
Before you can use a new backend or HCP Terraform/Terraform Cloud integration, you must first execute terraform init.
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?
Exhibit:
Root module configuration:
output " vnet_id " {
value = module.my_network.vnet_id
}
Error:
Error: Reference to undeclared output value
on main.tf line 12, in output " vnet_id " :
12: value = module.my_network.vnet_id
You are using a networking module in your Terraform configuration with the name my_network. Your root module includes the configuration shown. When you run terraform validate, you get the error shown. Which option would successfully retrieve this value from your networking module?
Which of the following should you add in the required_providers block to define a provider version constraint?
Your risk management organization requires that new AWS S3 buckets must be private and encrypted at rest. How can Terraform Cloud automatically and proactively enforce this security control?
In a Terraform Cloud workpace linked to a version control repository speculative plan rum start automatically commit changes to version control.
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)
If one of your modules uses a local value, you can expose that value to callers of the module by defining a Terraform output in the module’s configuration.
A developer on your team is going to leaf down an existing deployment managed by Terraform and deploy a new one. However, there is a server resource named aws instant.ubuntu[l] they would like to keep. What command should they use to tell Terraform to stop managing that specific resource?
Which are forbidden actions when the terraform state file is locked? Choose three correct answers.
What functionality do providers offer in Terraform? (Pick the 3 correct responses below.)
Which of these actions are forbidden when the Terraform state file is locked? (Pick the 3 correct responses)
What kind of configuration block will manage an infrastructure object with settings specified within the block?
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.
You want to define multiple data disks as nested blocks inside the resource block for a virtual machine. What Terraform feature would help you define the blocks using the values in a variable?
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?
When you run terraform apply, the Terraform CLI will print output values from both the root module and any child modules.
A resource block is shown in the Exhibit section of this page. How would you reference the attribute name of this resource in HCL?
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?
