ExamGecko
Home Home / HashiCorp / Terraform Associate 003

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

Question list
Search
Search

What does terraform import do?

A.
Imports existing resources into the state file
A.
Imports existing resources into the state file
Answers
B.
Imports all infrastructure from a given cloud provider
B.
Imports all infrastructure from a given cloud provider
Answers
C.
Imports a new Terraform module
C.
Imports a new Terraform module
Answers
D.
Imports clean copies of tainted resources
D.
Imports clean copies of tainted resources
Answers
E.
None of the above
E.
None of the above
Answers
Suggested answer: A

Explanation:

The terraform import command is used to import existing infrastructure into your Terraform state. This command takes the existing resource and associates it with a resource defined in your Terraform configuration, updating the state file accordingly. It does not generate configuration for the resource, only the state.

A Terraform output that sets the 'sensitive' argument to true will not store that value in the state file.

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

Explanation:

A Terraform output that sets the 'sensitive' argument to true will store that value in the state file. The purpose of setting sensitive = true is to prevent the value from being displayed in the CLI output during terraform plan and terraform apply, and to mask it in the Terraform UI. However, it does not affect the storage of the value in the state file. Sensitive outputs are still written to the state file to ensure that Terraform can manage resources correctly during subsequent operations.

Terraform documentation on sensitive outputs: Terraform Output Values

All standard backend types support state locking, and remote operations like plan, apply, and destroy.

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

Explanation:

Not all standard backend types support state locking and remote operations like plan, apply, and destroy. For example, the local backend does not support remote operations and state locking. State locking is a feature that ensures that no two users can make changes to the state file at the same time, which is crucial for preventing race conditions. Remote operations allow running Terraform commands on a remote server, which is supported by some backends like remote or consul, but not all.

Terraform documentation on backends: Terraform Backends

Detailed backend support: Terraform Backend Types

Which of the following is not a valid source path for specifying a module?

A.
source - 'github.com/hashicorp/examplePref-ul.0.8M
A.
source - 'github.com/hashicorp/examplePref-ul.0.8M
Answers
B.
source = './module?version=vl.6.0'
B.
source = './module?version=vl.6.0'
Answers
C.
source - 'hashicorp/consul/aws'
C.
source - 'hashicorp/consul/aws'
Answers
D.
source - './module'
D.
source - './module'
Answers
Suggested answer: B

Explanation:

Terraform modules are referenced by specifying a source location. This location can be a URL or a file path. However, specifying query parameters such as ?version=vl.6.0 directly within the source path is not a valid or supported method for specifying a module version in Terraform. Instead, version constraints are specified using the version argument within the module block, not as part of the source string. Reference = This clarification is based on Terraform's official documentation regarding module usage, which outlines the correct methods for specifying module sources and versions.

Which of these are features of Terraform Cloud? Choose two correct answers.

A.
A web-based user interface (Ul)
A.
A web-based user interface (Ul)
Answers
B.
Automated infrastructure deployment visualization
B.
Automated infrastructure deployment visualization
Answers
C.
Automatic backups
C.
Automatic backups
Answers
D.
Remote state storage
D.
Remote state storage
Answers
Suggested answer: A, D

Explanation:

Terraform Cloud includes several features designed to enhance collaboration and infrastructure management. Two of these features are:

A web-based user interface (UI): This allows users to interact with Terraform Cloud through a browser, providing a centralized interface for managing Terraform configurations, state files, and workspaces.

Remote state storage: This feature enables users to store their Terraform state files remotely in Terraform Cloud, ensuring that state is safely backed up and can be accessed by team members as needed.

What is terraform refresh-only intended to detect?

A.
Terraform configuration code changes
A.
Terraform configuration code changes
Answers
B.
Corrupt state files
B.
Corrupt state files
Answers
C.
State file drift
C.
State file drift
Answers
D.
Empty state files
D.
Empty state files
Answers
Suggested answer: C

Explanation:

The terraform refresh-only command is intended to detect state file drift. This command synchronizes the state file with the actual infrastructure, updating the state to reflect any changes that have occurred outside of Terraform.

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.

A.

A Git repository containing your modules.

A.

A Git repository containing your modules.

Answers
B.

Public Terraform module registry.

B.

Public Terraform module registry.

Answers
C.

A subfolder within your workspace.

C.

A subfolder within your workspace.

Answers
D.

HCP Terraform/Terraform Cloud private registry.

D.

HCP Terraform/Terraform Cloud private registry.

Answers
Suggested answer: D

Explanation:

Confidentiality: Using HCP Terraform/Terraform Cloud's private registry keeps the module configurations within your organization, ensuring privacy and access control.

Browsable Directory: The private registry offers a user interface to browse modules, making it easy for users within the organization to locate and manage modules.

This setup aligns with HashiCorp's design for private registry support in Terraform, meeting all listed requirements for secure, version-controlled, and searchable module storage.

When do you need to explicitly execute Terraform in refresh-only mode?

A.

Before every terraform plan.

A.

Before every terraform plan.

Answers
B.

Before every terraform apply.

B.

Before every terraform apply.

Answers
C.

Before every terraform import.

C.

Before every terraform import.

Answers
D.

None of the above.

D.

None of the above.

Answers
Suggested answer: C

Explanation:

Purpose of Refresh-Only Mode: Running Terraform in refresh-only mode updates Terraform's state file with the current state of resources in your infrastructure without making changes to the resources themselves.

Context of Terraform Import: When using terraform import, you're adding existing resources to the state file, and running Terraform in refresh-only mode before this operation can ensure that any initial configuration syncs precisely with the actual state.

For more on refresh-only mode in relation to terraform import, refer to Terraform's import documentation.

When do you need to explicitly execute Terraform in refresh-only mode?

A.

Before every terraform plan.

A.

Before every terraform plan.

Answers
B.

Before every terraform apply.

B.

Before every terraform apply.

Answers
C.

Before every terraform import.

C.

Before every terraform import.

Answers
D.

None of the above.

D.

None of the above.

Answers
Suggested answer: C

Explanation:

Purpose of Refresh-Only Mode: Running Terraform in refresh-only mode updates Terraform's state file with the current state of resources in your infrastructure without making changes to the resources themselves.

Context of Terraform Import: When using terraform import, you're adding existing resources to the state file, and running Terraform in refresh-only mode before this operation can ensure that any initial configuration syncs precisely with the actual state.

For more on refresh-only mode in relation to terraform import, refer to Terraform's import documentation.

Terraform encrypts sensitive values stored in your state file.

A.

True

A.

True

Answers
B.

False

B.

False

Answers
Suggested answer: B

Explanation:

Terraform state files are not automatically encrypted by default. Sensitive values are stored in plaintext within the state file. However, you can protect the state file by using remote backends that support encryption, such as AWS S3 with server-side encryption enabled or Terraform Cloud, which offers encrypted state storage.

References:

Terraform State

Total 195 questions
Go to page: of 20