The Best HashiCorp TA-002-P Study Guides and Dumps of 2021 [Q177-Q192]

Share

The Best HashiCorp TA-002-P Study Guides and Dumps of 2021

Top HashiCorp TA-002-P Exam Audio Study Guide! Practice Questions Edition

NEW QUESTION 177
Where does the Terraform local backend store its state?

  • A. In the /tmp directory
  • B. In the user's .terraformrc file
  • C. In the terraform.tfstate file
  • D. In the terraform.tfvars file

Answer: C

Explanation:
The local backend stores state on the local filesystem, locks that state using system APIs, and performs operations locally.
Reference: https://www.terraform.io/docs/language/settings/backends/local.html

 

NEW QUESTION 178
When should you use the force-unlock command?

  • A. You have a high priority change
  • B. Automatic unlocking failed
  • C. You see a status message that you cannot acquire the lock
  • D. Your apply failed due to a state lock

Answer: B

Explanation:
Explanation
Manually unlock the state for the defined configuration.
Reference: https://www.terraform.io/docs/cli/commands/force-unlock.html

 

NEW QUESTION 179
Terraform has detailed logs which can be enabled by setting the _________ environmental variable.

  • A. TF_DEBUG
  • B. TF_INFO
  • C. TF_TRACE
  • D. TF_LOG

Answer: D

Explanation:
Terraform has detailed logs that can be enabled by setting the TF_LOG environment variable to any value. This will cause detailed logs to appear on stderr.
You can set TF_LOG to one of the log levels TRACE, DEBUG, INFO, WARN or ERROR to change the verbosity of the logs. TRACE is the most verbose and it is the default if TF_LOG is set to something other than a log level name.
https://www.terraform.io/docs/internals/debugging.html

 

NEW QUESTION 180
In the example below, the depends_on argument creates what type of dependency?

  • A. explicit dependency
  • B. internal dependency
  • C. implicit dependency
  • D. non-dependency resource

Answer: D

 

NEW QUESTION 181
By default, provisioners that fail will also cause the Terraform apply itself to error. How can you change this default behavior within a provisioner?

  • A. provisioner "local-exec" { on_failure = "continue" }
  • B. provisioner "local-exec" { on_failure = "next" }
  • C. provisioner "local-exec" { on_failure = continue }
  • D. provisioner "local-exec" { when = "failure" terraform apply }

Answer: A

Explanation:
Explanation
https://www.terraform.io/docs/provisioners/index.html

 

NEW QUESTION 182
Which Terraform command will check and report errors within modules, attribute names, and value types to make sure they are syntactically valid and internally consistent?

  • A. terraform show
  • B. terraform format
  • C. terraform fmt
  • D. terraform validate

Answer: D

Explanation:
Explanation
The terraform validate command validates the configuration files in a directory, referring only to the configuration and not accessing any remote services such as remote state, provider APIs, etc.
Validate runs checks that verify whether a configuration is syntactically valid and internally consistent, regardless of any provided variables or existing state. It is thus primarily useful for general verification of reusable modules, including the correctness of attribute names and value types.
It is safe to run this command automatically, for example as a post-save check in a text editor or as a test step for a re-usable module in a CI system.

 

NEW QUESTION 183
Complete the following sentence:
The terraform state command can be used to ____

  • A. modify state
  • B. refresh state
  • C. There is no such command
  • D. view state

Answer: A

Explanation:
Explanation
https://www.terraform.io/docs/commands/state/index.html

 

NEW QUESTION 184
What information does the public Terraform Module Registry automatically expose about published modules?

  • A. All of the above
  • B. None of the above
  • C. Optional inputs variables and default values
  • D. Required input variables
  • E. Outputs

Answer: B

 

NEW QUESTION 185
Why would you use the terraform taint command?

  • A. When you want Terraform to destroy all the infrastructure in your workspace
  • B. When you want to force Terraform to destroy and recreate a resource on the next apply
  • C. When you want to force Terraform to destroy a resource on the next apply
  • D. When you want Terraform to ignore a resource on the next apply

Answer: B

Explanation:
Explanation
The terraform taint command manually marks a Terraform-managed resource as tainted, forcing it to be destroyed and recreated on the next apply.
Reference: https://www.terraform.io/docs/cli/commands/taint.html

 

NEW QUESTION 186
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. 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.
  • C. 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.
  • D. Terraform module sharing is only available in Enterprise version via terraform private module registry , so no way to enable it in OSS version.

Answer: B

Explanation:
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 187
When using Terraform to deploy resources into Azure, which scenarios are true regarding state files? (Choose two.)

  • A. When a change is made to the resources via the Azure Cloud Console, the changes are recorded in the current state file
  • B. When a change is made to the resources via the Azure Cloud Console, Terraform will update the state file to reflect them during the next plan or apply
  • C. When a change is made to the resources via the Azure Cloud Console, the current state file will not be updated
  • D. When a change is made to the resources via the Azure Cloud Console, the changes are recorded in a new state file

Answer: B

 

NEW QUESTION 188
Terraform import command can import resources into modules as well directly into the root of your state.

  • A. False
  • B. True

Answer: B

Explanation:
Import will find the existing resource from ID and import it into your Terraform state at the given ADDRESS. ADDRESS must be a valid resource address. Because any resource address is valid, the import command can import resources into modules as well directly into the root of your state.
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. For 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.
As a result of the above command, the resource is recorded in the state file. We can now run terraform plan to see how the configuration compares to the imported resource, and make any adjustments to the configuration to align with the current (or desired) state of the imported object.
https://www.terraform.io/docs/commands/import.html

 

NEW QUESTION 189
terraform refresh will update the state file?

  • A. False
  • B. True

Answer: B

Explanation:
Explanation
The terraform refresh command is used to reconcile the state Terraform knows about (via its state file) with the real-world infrastructure. This can be used to detect any drift from the last-known state, and to update the state file.
This does not modify infrastructure, but does modify the state file. If the state is changed, this may cause changes to occur during the next plan or apply.

 

NEW QUESTION 190
Jim has created several AWS resources from a single terraform configuration file. Someone from his team has manually modified one of the EC2 instance.
Now to discard the manual change, Jim wants to destroy and recreate the EC2 instance. What is the best way to do it?

  • A. terraform refresh
  • B. terraform recreate
  • C. terraform destroy
  • D. terraform taint

Answer: D

Explanation:
The terraform taint command manually marks a Terraform-managed resource as tainted, forcing it to be destroyed and recreated on the next apply.
This command will not modify infrastructure, but does modify the state file in order to mark a resource as tainted. Once a resource is marked as tainted, the next plan will show that the resource will be destroyed and recreated and the next apply will implement this change.
Forcing the recreation of a resource is useful when you want a certain side effect of recreation that is not visible in the attributes of a resource. For example: re-running provisioners will cause the node to be different or rebooting the machine from a base image will cause new startup scripts to run.
Note that tainting a resource for recreation may affect resources that depend on the newly tainted resource. For example, a DNS resource that uses the IP address of a server may need to be modified to reflect the potentially new IP address of a tainted server. The plan command will show this if this is the case.
This example will taint a single resource:
$ terraform taint aws_security_group.allow_all
The resource aws_security_group.allow_all in the module root has been marked as tainted.
https://www.terraform.io/docs/commands/taint.html

 

NEW QUESTION 191
A colleague has informed you that a new version of a Terraform module that your team hosts on an Amazon S3 bucket is broken. The Amazon S3 bucket has versioning enabled. Your colleague tells you to make sure you are not using the latest version in your configuration. You have the following configuration block in your code that refers to the module:
module "infranet" { source = "s3::https://s3-us-west-2.amazonaws.com/infrabucket/infra_module.zip"} What is the best way to ensure that you are not using the latest version of the module?

  • A. Add a version key to the module configuration and specify a previous version.
  • B. Delete the latest version of the module in S3 to rollback to the previous version.
  • C. Add a module version constraint in your configuration's backend block and specify a previous version.
  • D. Add a version property to the module in Terraform's state file and specify a previous version.

Answer: B

Explanation:
Explanation
Version constraints are supported only for modules installed from a module registry, such as the Terraform Registry or Terraform Cloud's private module registry. Other module sources can provide their own versioning mechanisms within the source string itself, or might not support versions at all. In particular, modules sourced from local file paths do not support version; since they're loaded from the same source repository.
Only Terraform Registries support module versioning by using the version key, one cannot configure a previous version of the module in the configuration. Deleting the latest version of the module in S3 is the only option of the available options that ensures you won't use the latest version. You could also modify the source URL to specify a versionId URL parameter for a previous version.
https://www.terraform.io/docs/configuration/modules.html#source

 

NEW QUESTION 192
......


HashiCorp TA-002-P Exam Syllabus Topics:

TopicDetails
Topic 1
  • Describe secure secret injection best practice
  • Use resource addressing and resource parameters to connect resources together
Topic 2
  • Use Terraform built-in functions to write configuration
  • Generate and review an execution plan for Terraform (terraform plan)
Topic 3
  • Describe remote state storage mechanisms and supported standard backends
  • Describe how Terraform finds and fetches providers
Topic 4
  • Explain multi-cloud and provider-agnostic benefits
  • Understand infrastructure as code (IaC) concepts
Topic 5
  • Given a scenario: choose when to enable verbose logging and what the outcome/value is
  • Interact with module inputs and outputs
Topic 6
  • Given a scenario: choose when to use terraform taint to taint Terraform resources
  • Handle backend authentication methods
Topic 7
  • Execute changes to infrastructure with Terraform (terraform apply)
  • Handle Terraform and provider installation and versioning
Topic 8
  • Given a scenario: choose when to use terraform import to import existing infrastructure into your Terraform state
  • Understand Terraform basics
Topic 9
  • Explain when to use and not use provisioners and when to use local-exec or remote-exec
  • Describe advantages of IaC patterns
Topic 10
  • Create and differentiate resource and data configuration
  • Understand the use of collection and structural types
Topic 11
  • Discover modules from the public Terraform Module Registry
  • Initialize a Terraform working directory (terraform init)
Topic 12
  • Describe backend block in configuration and best practices for partial configurations
  • Demonstrate using multiple providers
Topic 13
  • Destroy Terraform managed infrastructure (terraform destroy)
  • Given a scenario: choose when to use terraform fmt to format code
Topic 14
  • Given a scenario: choose when to use terraform state to view Terraform state
  • Describe plugin based architecture
Topic 15
  • Describe the benefits of Sentinel, registry, and workspaces
  • Describe variable scope within modules/child modules
Topic 16
  • Given a scenario: choose when to use terraform workspace to create workspaces
  • Describe effect of Terraform refresh on state


Understanding functional and technical aspects of HashiCorp Certified: Terraform Associate TA-002-P Professional Exam Object Management

The following will be discussed in HASHICORP TA-002 dumps:

  • Learn the application of the collection and structural types
  • Express secure secret injection best practice
  • Utilize resource addressing and resource parameters to connect resources
  • Configure resource using a dynamic block
  • Exhibit use of variables and outputs
  • Use Terraform built-in functions to write configuration
  • Design and distinguish resource and data configuration
  • Advantages of Sentinel, registry, and workspaces Differentiate OSS and TFE workspaces
  • Summarize characteristics of Terraform Cloud
  • Specify built-in dependency management

 

Valid TA-002-P Exam Updates - 2021 Study Guide: https://www.itcertmagic.com/HashiCorp/real-TA-002-P-exam-prep-dumps.html

TA-002-P Certification - The Ultimate Guide: https://drive.google.com/open?id=1bDyQtMQ8mOaB9_BFKYYrLNNcY3wWLzj8