ExamGecko
Home / HashiCorp / Terraform Associate 003 / List of questions
Ask Question

HashiCorp Terraform Associate 003 Practice Test - Questions Answers, Page 9

List of questions

Question 81

Report
Export
Collapse

Module version is required to reference a module on the Terraform Module Registry.

True
True
False
False
Suggested answer: B

Explanation:

Module version is optional to reference a module on the Terraform Module Registry.If you omit the version constraint, Terraform will automatically use the latest available version of the module

asked 18/09/2024
Sacha CONTI
43 questions

Question 82

Report
Export
Collapse

You ate creating a Terraform configuration which needs to make use of multiple providers, one for AWS and one for Datadog. Which of the following provider blocks would allow you to do this?

A)

HashiCorp Terraform Associate 003 image Question 82 30520 09182024192049000000

B)

HashiCorp Terraform Associate 003 image Question 82 30520 09182024192049000000

C)

HashiCorp Terraform Associate 003 image Question 82 30520 09182024192049000000

D)

HashiCorp Terraform Associate 003 image Question 82 30520 09182024192049000000

Option A
Option A
Option B
Option B
Option C
Option C
Option D
Option D
Suggested answer: C

Explanation:

Option C is the correct way to configure multiple providers in a Terraform configuration.Each provider block must have a name attribute that specifies which provider it configures2. The other options are either missing the name attribute or using an invalid syntax.

asked 18/09/2024
Piroon Dechates
24 questions

Question 83

Report
Export
Collapse

terraform validate confirms that your infrastructure matches the Terraform state file.

True
True
False
False
Suggested answer: B

Explanation:

terraform validate does not confirm that your infrastructure matches the Terraform state file.It only checks whether the configuration files in a directory are syntactically valid and internally consistent3. To confirm that your infrastructure matches the Terraform state file, you need to use terraform plan or terraform apply with the -refresh-only option.

asked 18/09/2024
Yener Yuksel
39 questions

Question 84

Report
Export
Collapse

Which command must you first run before performing further Terraform operations in a working directory?

terraform import
terraform import
terraform workspace
terraform workspace
terraform plan
terraform plan
terraform init
terraform init
Suggested answer: D

Explanation:

terraform init is the first command that should be run after writing a new Terraform configuration or cloning an existing one from version control. It initializes a working directory containing Terraform configuration files and downloads any required providers and modules. The other commands are used for different purposes, such as importing existing resources, switching between workspaces, generating execution plans, etc.

asked 18/09/2024
Martin Ojeda Knapp
25 questions

Question 85

Report
Export
Collapse

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?

Run terraform state list to find the names of all VMs, then run terraform state show for each of them to find which VM ID Terraform manages
Run terraform state list to find the names of all VMs, then run terraform state show for each of them to find which VM ID Terraform manages
Update the code to include outputs for the ID of all VMs, then run terraform plan to view the outputs
Update the code to include outputs for the ID of all VMs, then run terraform plan to view the outputs
Run terraform taint/code on all the VMs to recreate them
Run terraform taint/code on all the VMs to recreate them
Use terraform refresh/code to find out which IDs are already part of state
Use terraform refresh/code to find out which IDs are already part of state
Suggested answer: A

Explanation:

The terraform state list command lists all resources that are managed by Terraform in the current state file1.The terraform state show command shows the attributes of a single resource in the state file2. By using these two commands, you can compare the VM IDs in your list with the ones in the state file and identify which one is managed by Terraform.

asked 18/09/2024
Jimmy Wasson
37 questions

Question 86

Report
Export
Collapse

When does Sentinel enforce policy logic during a Terraform Cloud run?

Before the plan phase
Before the plan phase
During the plan phase
During the plan phase
Before the apply phase
Before the apply phase
After the apply phase
After the apply phase
Suggested answer: C

Explanation:

Sentinel policies are checked after the plan stage of a Terraform run, but before it can be confirmed or the terraform apply is executed3. This allows you to enforce rules on your infrastructure before it is created or modified.

asked 18/09/2024
juan otero
28 questions

Question 87

Report
Export
Collapse

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.

Run the terraform Import-gcp command
Run the terraform Import-gcp command
Write Terraform configuration for the existing VMs
Write Terraform configuration for the existing VMs
Use the terraform import command for the existing VMs
Use the terraform import command for the existing VMs
Provision new VMs using Terraform with the same VM names
Provision new VMs using Terraform with the same VM names
Suggested answer: B, C

Explanation:

To import existing resources into Terraform, you need to do two things1:

Write a resource configuration block for each resource, matching the type and name used in your state file.

Run terraform import for each resource, specifying its address and ID. There is no such command as terraform Import-gcp, and provisioning new VMs with the same names will not import them into Terraform.

asked 18/09/2024
Marcin Piotrowski
40 questions

Question 88

Report
Export
Collapse

Which of the following ate advantages of using infrastructure as code (laC) instead of provisioning with a graphical user interface (GUI)? Choose two correct answers.

Lets you version, reuse, and share infrastructure configuration
Lets you version, reuse, and share infrastructure configuration
Provisions the same resources at a lower cost
Provisions the same resources at a lower cost
Secures your credentials
Secures your credentials
Reduces risk of operator error
Reduces risk of operator error
Prevents manual modifications to your resources
Prevents manual modifications to your resources
Suggested answer: A, D

Explanation:

It lets you version, reuse, and share infrastructure configuration as code files, which can be stored in a source control system and integrated with your CI/CD pipeline.

It reduces risk of operator error by automating repetitive tasks and ensuring consistency across environments. IaC does not necessarily provision resources at a lower cost, secure your credentials, or prevent manual modifications to your resources - these depend on other factors such as your cloud provider, your security practices, and your access policies.

asked 18/09/2024
CHING SHENG WU
36 questions

Question 89

Report
Export
Collapse

Outside of the required_providers block, Terraform configurations always refer to providers by their local names.

True
True
False
False
Suggested answer: B

Explanation:

Outside of the required_providers block, Terraform configurations can refer to providers by either their local names or their source addresses. The local name is a short name that can be used throughout the configuration, while the source address is a global identifier for the provider in the format registry.terraform.io/namespace/type. For example, you can use either aws or registry.terraform.io/hashicorp/aws to refer to the AWS provider.

asked 18/09/2024
Bruce Baynes
27 questions

Question 90

Report
Export
Collapse

Terraform providers are always installed from the Internet.

True
True
False
False
Suggested answer: B

Explanation:

Terraform providers are not always installed from the Internet. There are other ways to install provider plugins, such as from a local mirror or cache, from a local filesystem directory, or from a network filesystem. These methods can be useful for offline or air-gapped environments, or for customizing the installation process. You can configure the provider installation methods using the provider_installation block in the CLI configuration file.

asked 18/09/2024
Daniela Const
38 questions
Total 195 questions
Go to page: of 20