Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

HashiCorp Terraform Associate Exam Preparation: Questions and Answers, Exams of Computer Science

A collection of questions and answers related to the hashicorp terraform associate exam. It covers various aspects of terraform, including commands, concepts, and best practices. Designed to help individuals prepare for the terraform associate certification exam by providing a comprehensive understanding of terraform's functionalities and its application in infrastructure management.

Typology: Exams

2024/2025

Available from 11/16/2024

EXAMDOC
EXAMDOC 🇺🇸

3.3

(4)

4.5K documents

1 / 5

Toggle sidebar

Related documents


Partial preview of the text

Download HashiCorp Terraform Associate Exam Preparation: Questions and Answers and more Exams Computer Science in PDF only on Docsity!

Hashicorp Terraform Associate questions with

correct answers

What command can you use to display details about the resource as shown below? resource "aws_internet_gateway" "demo" { vpc_id = aws_vpc.vpc.id tags = { Name = "demo_igw" } } CORRECT ANSWER terraform state show aws_internet_gateway.demo Your organization has multiple engineers that have permission to manage Terraform as well as administrative access to the public cloud where these resources are provisioned. If an engineer makes a change outside of Terraform, what command can you run to detect drift and update the state file? CORRECT ANSWER terraform apply -refresh-only "To instruct Terraform to refresh the state file based on the current configuration of managed resources, you can use the terraform apply -refresh-only command. If Terraform discovers drift, it will update the state file with the changes." You have infrastructure deployed with Terraform. A developer recently submitted a support ticket to update a security group to permit a new port. To satisfy the ticket, you update the Terraform configuration to reflect the changes and run a Terraform plan. However, a co-worker has since logged into the console and manually updated the security group. What will happen when you run a Terraform apply? CORRECT ANSWER Nothing. Terraform will validate the infras matches the desired state.

After deploying a new virtual machine using Terraform, you find that the local script didn't run properly. However, Terraform reports the virtual machine was successfully created. How can you force Terraform to replace the virtual machine without impacting the rest of the managed infrastructure? CORRECT ANSWER Use terraform apply -replace to tag the resource for replacement True or False? In order to use the Terraform console command, the CLI must be able to lock state to prevent changes. CORRECT ANSWER True "The terraform console command will read the Terraform configuration in the current working directory and the Terraform state file from the configured backend so that interpolations can be tested against both the values in the configuration and the state file. When you execute a Terraform console command, you'll get this output: $ terraform console Acquiring state lock. This may take a few moments..." You need to enable logging for Terraform and persist the logs to a specific file. What two environment variables can be set to enable logs and write them to a file? CORRECT ANSWER TF_LOG_TRACE TF_LOG_PATH=<file_path> You have a configuration file that you've deployed to one AWS region already but you want to deploy the same configuration file to a second AWS region without making changes to the configuration file. What feature of Terraform can you use to accomplish this? CORRECT ANSWER terraform workspace

True or False? A provider block is required in every configuration file so Terraform can download the proper plugin. CORRECT ANSWER False "You don't have to specify a provider block since Terraform is smart enough to download the right provider based on the specified resources. That said, Terraform official documentation states that Terraform configurations must declare which providers they require so that Terraform can install and use them. Although Terraform CAN be used without declaring a plugin, you should follow best practices and declare it along with the required_version argument to explicitly set the version constraint." Where is the most secure place to store credentials when using a remote backend? CORRECT ANSWER Defined outside of Terraform map (or object) CORRECT ANSWER a group of values identified by named labels, like {name = "Mabel", age = 52}. Maps are used to store key/value pairs. A Terraform module (usually the root module of a configuration) can call other modules to include their resources into the configuration. A module that has been called by another module is often referred to as _______________. CORRECT ANSWER child module Which statement below is true regarding using Sentinel in Terraform Enterprise? CORRECT ANSWER Sentinel runs before a configuration is applied and can reduce public cloud costs. You are using Terraform to manage some of your AWS infrastructure. You notice that a new version of the provider now includes additional functionality you want to take advantage of. What command do you need to run to upgrade the provider? CORRECT ANSWER terraform get hashicorp/aws

dynamic block CORRECT ANSWER produces nested types instead of a complex typed value (like a for loop) terraform block CORRECT ANSWER Terraform-specific settings and behaviors are declared in this configuration block type What is the best and easiest way for Terraform to read and write secrets from HashiCorp Vault? CORRECT ANSWER Vault provider In Terraform Enterprise, a workspace can be mapped to how many VCS repos? CORRECT ANSWER 1 In the terraform block, which configuration would be used to identify the specific version of a provider required? CORRECT ANSWER required_providers What represents a feature of Terraform Cloud that is NOT free to customers? CORRECT ANSWER team management and governance By default, where does Terraform OSS/CLI store its state file? CORRECT ANSWER current working directory terraform plan ~ is used to signify CORRECT ANSWER a resource will be changed, not destroyed index command CORRECT ANSWER finds the element index for a given value in a list starting with index 0 lookup CORRECT ANSWER retrieves the value of a single element from a map, given its key. If the given key does not exist, the given default value is returned

instead. In this case, the function call is searching for the key "c". Because there is no key "c", the default value of "what?" is returned. tostring CORRECT ANSWER is not a string function, it is a type conversion function. tostring converts its argument to a string value. Where is local state stored? CORRECT ANSWER For local state, Terraform stores the workspace states in a directory called terraform.tfstate.d. What command changes workspaces in Terraform? CORRECT ANSWER terraform workspace select What is the purpose of terraform import command? CORRECT ANSWER The terraform import command is used to import existing resources into Terraform. This allows you to take resources that you've created by some other means and bring them under Terraform management. Note that terraform import DOES NOT generate configuration, it only modifies state. You'll still need to write a configuration block for the resource for which it will be mapped using the terraform import command.