ExamGecko
Home Home / HashiCorp / Terraform Associate 003

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

Question list
Search
Search

Which task does terraform init not perform?

A.
Validates all required variables are present
A.
Validates all required variables are present
Answers
B.
Sources any modules and copies the configuration locally
B.
Sources any modules and copies the configuration locally
Answers
C.
Connects to the backend
C.
Connects to the backend
Answers
D.
Sources all providers used in the configuration and downloads them
D.
Sources all providers used in the configuration and downloads them
Answers
Suggested answer: A

Explanation:

The terraform init command is used to initialize a working directory containing Terraform configuration files. This command performs several different initialization steps to prepare the current working directory for use with Terraform, which includes initializing the backend, installing provider plugins, and copying any modules referenced in the configuration. However, it does not validate whether all required variables are present; that is a task performed by terraform plan or terraform apply1.

Reference = This information can be verified from the official Terraform documentation on the terraform init command provided by HashiCorp Developer1.

Which of the following is not a benefit of adopting infrastructure as code?

A.
Versioning
A.
Versioning
Answers
B.
A Graphical User Interface
B.
A Graphical User Interface
Answers
C.
Reusability of code
C.
Reusability of code
Answers
D.
Automation
D.
Automation
Answers
Suggested answer: B

Explanation:

Infrastructure as Code (IaC) provides several benefits, including the ability to version control infrastructure, reuse code, and automate infrastructure management. However, IaC is typically associated with declarative configuration files and does not inherently provide a graphical user interface (GUI). A GUI is a feature that may be provided by specific tools or platforms built on top of IaC principles but is not a direct benefit of IaC itself1.

Reference = The benefits of IaC can be verified from the official HashiCorp documentation on ''What is Infrastructure as Code with Terraform?'' provided by HashiCorp Developer1.

Which of these is true about Terraform's plugin-based architecture?

A.
Terraform can only source providers from the internet
A.
Terraform can only source providers from the internet
Answers
B.
Every provider in a configuration has its own state file for its resources
B.
Every provider in a configuration has its own state file for its resources
Answers
C.
You can create a provider for your API if none exists
C.
You can create a provider for your API if none exists
Answers
D.
All providers are part of the Terraform core binary
D.
All providers are part of the Terraform core binary
Answers
Suggested answer: C

Explanation:

Terraform is built on a plugin-based architecture, enabling developers to extend Terraform by writing new plugins or compiling modified versions of existing plugins1. Terraform plugins are executable binaries written in Go that expose an implementation for a specific service, such as a cloud resource, SaaS platform, or API2. If there is no existing provider for your API, you can create one using the Terraform Plugin SDK3 or the Terraform Plugin Framework4. Reference =

* 1: Plugin Development - How Terraform Works With Plugins | Terraform | HashiCorp Developer

* 2: Lab: Terraform Plug-in Based Architecture - GitHub

* 3: Terraform Plugin SDK - Terraform by HashiCorp

* 4: HashiCorp Terraform Plugin Framework Now Generally Available

The Terraform binary version and provider versions must match each other in a single configuration.

A.
True
A.
True
Answers
B.
False
B.
False
Answers
Suggested answer: B

Explanation:

The Terraform binary version and provider versions do not have to match each other in a single configuration. Terraform allows you to specify provider version constraints in the configuration's terraform block, which can be different from the Terraform binary version1. Terraform will use the newest version of the provider that meets the configuration's version constraints2. You can also use the dependency lock file to ensure Terraform is using the correct provider version3. Reference =

* 1: Providers - Configuration Language | Terraform | HashiCorp Developer

* 2: Multiple provider versions with Terraform - Stack Overflow

* 3: Lock and upgrade provider versions | Terraform - HashiCorp Developer

Which of the following is not true of Terraform providers?

A.
An individual person can write a Terraform Provider
A.
An individual person can write a Terraform Provider
Answers
B.
A community of users can maintain a provider
B.
A community of users can maintain a provider
Answers
C.
HashiCorp maintains some providers
C.
HashiCorp maintains some providers
Answers
D.
Cloud providers and infrastructure vendors can write, maintain, or collaborate on Terraform
D.
Cloud providers and infrastructure vendors can write, maintain, or collaborate on Terraform
Answers
E.
providers
E.
providers
Answers
F.
None of the above
F.
None of the above
Answers
Suggested answer: F

Explanation:

All of the statements are true of Terraform providers. Terraform providers are plugins that enable Terraform to interact with various APIs and services1. Anyone can write a Terraform provider, either as an individual or as part of a community2. HashiCorp maintains some providers, such as the AWS, Azure, and Google Cloud providers3. Cloud providers and infrastructure vendors can also write, maintain, or collaborate on Terraform providers, such as the VMware, Oracle, and Alibaba Cloud providers. Reference =

* 1: Providers - Configuration Language | Terraform | HashiCorp Developer

* 2: Plugin Development - How Terraform Works With Plugins | Terraform | HashiCorp Developer

* 3: Terraform Registry

* : Terraform Registry

How can you trigger a run in a Terraform Cloud workspace that is connected to a Version Control System (VCS) repository?

A.
Only Terraform Cloud organization owners can set workspace variables on VCS connected workspaces
A.
Only Terraform Cloud organization owners can set workspace variables on VCS connected workspaces
Answers
B.
Commit a change to the VCS working directory and branch that the Terraform Cloud workspace is connected to
B.
Commit a change to the VCS working directory and branch that the Terraform Cloud workspace is connected to
Answers
C.
Only Terraform Cloud organization owners can approve plans in VCS connected workspaces
C.
Only Terraform Cloud organization owners can approve plans in VCS connected workspaces
Answers
D.
Only members of a VCS organization can open a pull request against repositories that are connected to Terraform Cloud workspaces
D.
Only members of a VCS organization can open a pull request against repositories that are connected to Terraform Cloud workspaces
Answers
Suggested answer: B

Explanation:

This will trigger a run in the Terraform Cloud workspace, which will perform a plan and apply operation on the infrastructure defined by the Terraform configuration files in the VCS repository.

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?

A.
Copy the sensitive variables into your Terraform code
A.
Copy the sensitive variables into your Terraform code
Answers
B.
Store the sensitive variables in a secure_varS.tf file
B.
Store the sensitive variables in a secure_varS.tf file
Answers
C.
Store the sensitive variables as plain text in a source code repository
C.
Store the sensitive variables as plain text in a source code repository
Answers
D.
Pass variables to Terraform with a -var flag
D.
Pass variables to Terraform with a -var flag
Answers
Suggested answer: D

Explanation:

This is a secure way to inject sensitive variables into your Terraform run, as they will not be stored in any file or source code repository. You can also use environment variables or variable files with encryption to pass sensitive variables to Terraform.

When should you write Terraform configuration files for existing infrastructure that you want to start managing with Terraform?

A.
You can import infrastructure without corresponding Terraform code
A.
You can import infrastructure without corresponding Terraform code
Answers
B.
Terraform will generate the corresponding configuration files for you
B.
Terraform will generate the corresponding configuration files for you
Answers
C.
Before you run terraform Import
C.
Before you run terraform Import
Answers
D.
After you run terraform import
D.
After you run terraform import
Answers
Suggested answer: C

Explanation:

You need to write Terraform configuration files for the existing infrastructure that you want to import into Terraform, otherwise Terraform will not know how to manage it. The configuration files should match the type and name of the resources that you want to import.

Variables declared within a module are accessible outside of the module.

A.
True
A.
True
Answers
B.
False
B.
False
Answers
Suggested answer: B

Explanation:

Variables declared within a module are only accessible within that module, unless they are explicitly exposed as output values1.

Your security team scanned some Terraform workspaces and found secrets stored in plaintext in state files. How can you protect that data?

A.
Edit your state file to scrub out the sensitive data
A.
Edit your state file to scrub out the sensitive data
Answers
B.
Always store your secrets in a secrets.tfvars file
B.
Always store your secrets in a secrets.tfvars file
Answers
C.
Delete the state file every time you run Terraform
C.
Delete the state file every time you run Terraform
Answers
D.
Store the state in an encrypted backend
D.
Store the state in an encrypted backend
Answers
Suggested answer: D

Explanation:

This is a secure way to protect sensitive data in the state file, as it will be encrypted at rest and in transit2. The other options are not recommended, as they could lead to data loss, errors, or security breaches.

Total 195 questions
Go to page: of 20