Pass HashiCorp TA-002-P Exam with Guarantee Updated 450 Questions [Q69-Q86]

Share

Pass HashiCorp TA-002-P Exam with Guarantee Updated 450 Questions

Latest TA-002-P Pass Guaranteed Exam Dumps Certification Sample Questions

NEW QUESTION 69
While using generic git repository as a module source, which of the below options allows terraform to select a specific version or tag instead of selecting the HEAD.

  • A. Append ref argument as
    module "vpc" { source = "git::https://example.com/vpc.git?ref=v1.2.0"}
  • B. Append ref argument as
    module "vpc" { source = "git::https://example.com/vpc.git#ref=v1.2.0"}
  • C. By default, Terraform will clone and use the default branch (referenced by HEAD) in the selected repository and you can not override this.
  • D. Append version argument as
    module "vpc" { source = "git::https://example.com/vpc.git?version=v1.2.0"}

Answer: A

Explanation:
Explanation
By default, Terraform will clone and use the default branch (referenced by HEAD) in the selected repository.
You can override this using the ref argument:
module "vpc" {
source = "git::https://example.com/vpc.git?ref=v1.2.0"
}
The value of the ref argument can be any reference that would be accepted by the git checkout command, including branch and tag names.
https://www.terraform.io/docs/modules/sources.html

 

NEW QUESTION 70
What does terraform refresh modify?

  • A. Your Terraform plan
  • B. Your state file
  • C. Your Terraform configuration
  • D. Your cloud infrastructure

Answer: B

Explanation:
Explanation
The terraform refresh command reads the current settings from all managed remote objects and updates the
Terraform state to match. Source: https://www.terraform.io/cli/commands/refresh

 

NEW QUESTION 71
If a module uses a local variable, you can expose that value with a terraform output.

  • A. True
  • B. False

Answer: A

Explanation:
Explanation
Output values are like function return values.
Reference: https://www.terraform.io/docs/language/values/locals.html
https://www.terraform.io/docs/language/values/outputs.html

 

NEW QUESTION 72
Which flag would be used within a Terraform configuration block to identify the specific version of a provider required?

  • A. required-version
  • B. required_versions
  • C. required_providers
  • D. required-provider

Answer: C

Explanation:
Explanation
For production use, you should constrain the acceptable provider versions via configuration file to ensure that new versions with breaking changes will not be automatically installed by terraform init in the future.
Example
terraform {
required_providers {
aws = ">= 2.7.0"
}
}

 

NEW QUESTION 73
Which option can not be used to keep secrets out of Terraform configuration files?

  • A. secure string
  • B. A -var flag
  • C. Environment variables
  • D. A Terraform provider

Answer: D

 

NEW QUESTION 74
During a terraform plan, a resource is successfully created but eventually fails during provisioning. What happens to the resource?

  • A. it is automatically deleted
  • B. the resource is marked as tainted
  • C. the terraform plan is rolled back and all provisioned resources are removed
  • D. Terraform attempts to provision the resource up to three times before exiting with an error

Answer: B

Explanation:
Explanation
If a resource successfully creates but fails during provisioning, Terraform will error and mark the resource as "tainted". A resource that is tainted has been physically created, but can't be considered safe to use since provisioning failed. Terraform also does not automatically roll back and destroy the resource during the apply when the failure happens, because that would go against the execution plan: the execution plan would've said a resource will be created, but does not say it will ever be deleted.

 

NEW QUESTION 75
Your security team scanned some Terraform workspaces and found secrets stored in a plaintext in state files.
How can you protect sensitive data stored in Terraform state files?

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

Answer: C

 

NEW QUESTION 76
Your organization has moved to AWS and has manually deployed infrastructure using the console. Recently, a
decision has been made to standardize on Terraform for all deployments moving forward.
What can you do to ensure that all existing is managed by Terraform moving forward without interruption to
existing services?

  • A. Delete the existing resources and recreate them using new a Terraform configuration so Terraform can
    manage them moving forward.
  • B. Resources that are manually deployed in the AWS console cannot be imported by Terraform.
  • C. Submit a ticket to AWS and ask them to export the state of all existing resources and use terraform
    import to import them into the state file.
  • D. Using terraform import, import the existing infrastructure into your Terraform state.

Answer: D

Explanation:
Explanation
Terraform is able to import existing infrastructure. This allows us take resources we've created by some other
means (i.e. via console) and bring it under Terraform management.
This is a great way to slowly transition infrastructure to Terraform.
The terraform import command is used to import existing infrastructure.
To import a resource, first write a resource block for it in our configuration, establishing the name by which it
will be known to Terraform.
Example:
resource "aws_instance" "import_example" {
# ...instance configuration...
}
Now terraform import can be run to attach an existing instance to this resource configuration.
$ terraform import aws_instance.import_example i-03efafa258104165f
aws_instance.import_example: Importing from ID "i-03efafa258104165f"...
aws_instance.import_example: Import complete!
Imported aws_instance (ID: i-03efafa258104165f)
aws_instance.import_example: Refreshing state... (ID: i-03efafa258104165f)
Import successful!
The resources that were imported are shown above. These resources are now in
your Terraform state and will henceforth be managed by Terraform.
This command locates the AWS instance with ID i-03efafa258104165f (which has been created outside
Terraform) and attaches its existing settings, as described by the EC2 API, to the name
aws_instance.import_example in the Terraform state.

 

NEW QUESTION 77
Your team uses terraform OSS . You have created a number of resuable modules for important , independent network components that you want to share with your team to enhance consistency . What is the correct option/way to do that?

  • A. Terraform modules cannot be shared in OSS version . Each developer needs to maintain their own modules and leverage them in the main tf file.
  • B. Store your modules in a NAS/ shared file server , and ask your team members to directly reference the code from there. This is the only viable option in terraform OSS ,which is better than individually maintaining module versions for every developer.
  • C. Terraform module sharing is only available in Enterprise version via terraform private module registry , so no way to enable it in OSS version.
  • D. Upload your modules with proper versioning in the terraform public module registry . Terraform OSS is directly integrated with the public module registry , and can reference the modules from the code in the main tf file.

Answer: D

Explanation:
Software development encourages code reuse through reusable artifacts, such as libraries, packages and modules. Most programming languages enable developers to package and publish these reusable components and make them available on a registry or feed. For example, Python has Python Package Index and PowerShell has PowerShell Gallery.
For Terraform users, the Terraform Registry enables the distribution of Terraform modules, which are reusable configurations. The Terraform Registry acts as a centralized repository for module sharing, making modules easier to discover and reuse.
The Registry is available in two variants:
* Public Registry houses official Terraform providers -- which are services that interact with an API to expose and manage a specific resource -- and community-contributed modules.
* Private Registry is available as part of the Terraform Cloud, and can host modules internally within an organization.
https://www.terraform.io/docs/registry/index.html

 

NEW QUESTION 78
Which of the following statements best describes the Terraform list(...) type?

  • A. a collection of unique values that do not have any secondary identifiers or ordering.
  • B. a sequence of values identified by consecutive whole numbers starting with zero.
  • C. a collection of values where each is identified by a string label.
  • D. a collection of named attributes that each have their own type.

Answer: B

Explanation:
Explanation
A terraform list is a sequence of values identified by consecutive whole numbers starting with zero. https://www.terraform.io/docs/configuration/types.html#structural-types

 

NEW QUESTION 79
Terraform and Terraform providers must use the same major version number in a single configuration.

  • A. False
  • B. True

Answer: A

 

NEW QUESTION 80
You need to constrain the GitHub provider to version 2.1 or greater.
Which of the following should you put into the Terraform 0.12 configuration's provider block?

  • A. version = "<= 2.1"
  • B. version >= 2.1
  • C. version ~> 2.1
  • D. version = ">= 2.1"

Answer: D

Explanation:
Explanation
version = ">= 1.2.0, < 2.0.0"
A version constraint is a string literal containing one or more conditions, which are separated by commas.
Each condition consists of an operator and a version number.
Version numbers should be a series of numbers separated by periods (like 1.2.0), optionally with a suffix to
indicate a beta release.
The following operators are valid:
= (or no operator): Allows only one exact version number. Cannot be combined with other conditions.
!=: Excludes an exact version number.
>, >=, <, <=: Comparisons against a specified version, allowing versions for which the comparison is true.
"Greater-than" requests newer versions, and "less-than" requests older versions.
~>: Allows only the rightmost version component to increment. For example, to allow new patch releases
within a specific minor release, use the full version number: ~> 1.0.4 will allow installation of 1.0.5 and 1.0.10
but not 1.1.0. This is usually called the pessimistic constraint operator.
https://www.terraform.io/language/expressions/version-constraints

 

NEW QUESTION 81
Select all features which are exclusive to Terraform Enterprise. (Select Three)

  • A. Cost Estimation
  • B. SAML/SSO
  • C. Clustering
  • D. Sentinel
  • E. Audit Logs

Answer: B,C,E

Explanation:
Sentinel and Cost Estimation are also available in Terraform Cloud
https://www.hashicorp.com/products/terraform/pricing/

 

NEW QUESTION 82
When using parent/child modules to deploy infrastructure, how would you export a value from one module to import into another module.
For example, a module dynamically deploys an application instance or virtual machine, and you need the IP address in another module to configure a related DNS record in order to reach the newly deployed application.

  • A. Configure an output value in the application module in order to use that value for the DNS module.
  • B. Preconfigure the IP address as a parameter in the DNS module.
  • C. Configure the pertinent provider's configuration with a list of possible IP addresses to use.
  • D. Export the value using terraform export and input the value using terraform input.

Answer: A

Explanation:
Explanation
Output values are like the return values of a Terraform module, and have several uses:
* A child module can use outputs to expose a subset of its resource attributes to a parent module.
* A root module can use outputs to print certain values in the CLI output after running terraform apply.
* When using remote state, root module outputs can be accessed by other configurations via a terraform_remote_state data source.
https://www.terraform.io/docs/configuration/outputs.html

 

NEW QUESTION 83
What features does the hosted service Terraform Cloud provide? (Choose two.)

  • A. Automated infrastructure deployment visualization
  • B. A web-based user interface (UI)
  • C. Automatic backups
  • D. Remote state storage

Answer: C,D

Explanation:
Reference:
https://www.terraform.io/docs/enterprise/admin/automated-recovery.html
https://www.terraform.io/docs/language/state/remote.html

 

NEW QUESTION 84
Terraform can run on Windows or Linux, but it requires a Server version of the Windows operating system.

  • A. True
  • B. False

Answer: A

 

NEW QUESTION 85
The terraform state command can be used to ____

  • A. Update current state
  • B. Refresh existing state file
  • C. It is not a valid command
  • D. Print the current state file in console

Answer: A

Explanation:
The terraform state command is used for advanced state management. Rather than modify the state directly, the terraform state commands can be used in many cases instead.
https://www.terraform.io/docs/commands/state/index.html

 

NEW QUESTION 86
......

New TA-002-P Test Materials & Valid TA-002-P Test Engine: https://examcompass.topexamcollection.com/TA-002-P-vce-collection.html