Terraform-Associate-003 HashiCorp Certified: Terraform Associate (003) (HCTA0-003) Questions and Answers
Changing the Terraform backend from the default "local" backend to a different one after performing your first terrafom apply is:
You have never used Terraform before and would like to test it out using a shared team account for a cloud provider. The shared team account already contains 15 virtual machines (VM). You develop a Terraform configuration containing one VM. perform terraform apply, and see that your VM was created successfully. What should you do to delete the newly-created VM with Terraform?
You should run terraform fnt to rewrite all Terraform configurations within the current working directory to conform to Terraform-style conventions.
A senior admin accidentally deleted some of your cloud instances. What will Terraform do when you run terraform apply?
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?
Infrastructure as Code (laC) can be stored in a version control system along with application code.
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?
What is the Terraform style convention for indenting a nesting level compared to the one above it?
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?
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 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
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.
Which of the following is availableonlyinHCP Terraform workspacesandnot in Terraform CLI?
In a Terraform Cloud workpace linked to a version control repository speculative plan rum start automatically commit changes to version control.
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 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 type of information can be found on the Terraform Registry when using published modules?
What value does the Terraform Cloud private registry provide over the public Terraform Module Registry?
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?
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?
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?
A provider configuration block is required in every Terraform configuration.
Example:

You can reference a resource created with for_each using a Splat ( *) expression.
Which provider authentication method prevents credentials from being stored in the state file?
You ate making changes to existing Terraform code to add some new infrastructure. When is the best time to run terraform validate?
In a HCP Terraform/Terraform Cloud workspace linked to a version control repository, speculative plan runs start automatically when you merge or commit changes to version control.
Outside of the required_providers block, Terraform configurations always refer to providers by their local names.
How would you reference the volume IDs associated with the ebs_block_device blocks in this configuration?

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?
In Terraform HCL, an object type of object({name=string, age-number}) would match this value.

What are some benefits of using Sentinel with Terraform Cloud/Terraform Cloud? Choose three correct answers.
Which of the following is true about terraform apply?(Pick 2 correct responses)
When you include a module block in your configuration that references a module from the Terraform Registry, the "version" attribute is required.
Which of these actions are forbidden when the Terraform state file is locked? (Pick the 3 correct responses)
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.
Your security team scanned some Terraform workspaces and found secrets stored in plaintext in state files. How can you protect that data?
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 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?
Which argument can you use toprevent unexpected updatesto a module's configuration when calling Terraform Registry modules?
Once you configure a new Terraform backend with a terraform code block, which command(s) should you use to migrate the state file?
Which command should you run to check if all code in a Terraform configuration that references multiple modules is properly formatted without making changes?
terraform validate confirms that your infrastructure matches the Terraform state file.
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?
If you update the version constraint in your Terraform configuration, Terraform will update your lock file the next time you run terraform Init.
All modules published on the official Terraform Module Registry have been verified by HasihCorp.
Running terraform fmt without any flags in a directory with Terraform configuration files check the formatting of those files without changing their contents.
Which type of block fetches or computes information for use elsewhere in a Terraform configuration?
