
2021 Updated Verified Pass TA-002-P Exam - Real Questions & Answers
Dumps Moneyack Guarantee - TA-002-P Dumps Approved Dumps
NEW QUESTION 107
Given the Terraform configuration below, in which order will the resources be created?
1. resource "aws_instance" "web_server"
2. {
3. ami = "ami-b374d5a5"
4. instance_type = "t2.micro"
5. }
6. resource "aws_eip" "web_server_ip"
7. {
8. vpc = true instance = aws_instance.web_server.id
9. }
- A. Resources will be created simultaneously
- B. aws_eip will be created first
aws_instance will be created second - C. aws_eip will be created first
aws_instance will be created second - D. aws_instance will be created first
aws_eip will be created second
Answer: D
Explanation:
Explanation
Implicit and Explicit Dependencies
By studying the resource attributes used in interpolation expressions, Terraform can automatically infer when one resource depends on another. In the example above, the reference to aws_instance.web_server.id creates an implicit dependency on the aws_instance named web_server.
Terraform uses this dependency information to determine the correct order in which to create the different resources.
# Example of Implicit Dependency
resource "aws_instance" "web_server" {
ami = "ami-b374d5a5"
instance_type = "t2.micro"
}
resource "aws_eip" "web_server_ip" {
vpc = true
instance = aws_instance.web_server.id
}
In the example above, Terraform knows that the aws_instance must be created before the aws_eip.
Implicit dependencies via interpolation expressions are the primary way to inform Terraform about these relationships, and should be used whenever possible.
Sometimes there are dependencies between resources that are not visible to Terraform. The depends_on argument is accepted by any resource and accepts a list of resources to create explicit dependencies for.
For example, perhaps an application we will run on our EC2 instance expects to use a specific Amazon S3 bucket, but that dependency is configured inside the application code and thus not visible to Terraform. In that case, we can use depends_on to explicitly declare the dependency:
# Example of Explicit Dependency
# New resource for the S3 bucket our application will use.
resource "aws_s3_bucket" "example" {
bucket = "terraform-getting-started-guide"
acl = "private"
}
# Change the aws_instance we declared earlier to now include "depends_on" resource "aws_instance" "example" { ami = "ami-2757f631" instance_type = "t2.micro"
# Tells Terraform that this EC2 instance must be created only after the
# S3 bucket has been created.
depends_on = [aws_s3_bucket.example]
}
https://learn.hashicorp.com/terraform/getting-started/dependencies.html
NEW QUESTION 108
Which of the following value will be accepted for var1?
variable "var1" {
type = string
}
- A. None of the above
- B. Both A and B
- C. "5"
- D. 0
Answer: B
Explanation:
Terraform automatically converts number and bool values to strings when needed.
NEW QUESTION 109
Which flag would be used within a Terraform configuration block to identify the specific version of a provider required?
- A. required-provider
- B. required_providers
- C. required_versions
- D. required-version
Answer: B
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 110
You want to use different AMI images for different regions and for the purpose you have defined following code block.
1. variable "images"
2. {
3. type = "map"
4.
5. default = {
6. us-east-1 = "image-1234"
7. us-west-2 = "image-4567"
8. us-west-1 = "image-4589"
9. }
10. }
What of the following approaches needs to be followed in order to select image-4589?
- A. var.images["us-west-1"]
- B. var.images[2]
- C. var.images[3]
- D. lookup(var.images["us-west-1"]
Answer: A
NEW QUESTION 111
You are using a terraform operation that writes state. Unfortunately automatic state unlocking has failed for that operation. Which of the below commands can be used to remove the already acquired lock on the state?
- A. None of the above
- B. terraform force-unlock
- C. terraform unlock
- D. terraform state unlock
Answer: B
Explanation:
Explanation
Command: force-unlock
Manually unlock the state for the defined configuration.
This will not modify your infrastructure. This command removes the lock on the state for the current configuration. The behavior of this lock is dependent on the backend being used. Local state files cannot be unlocked by another process.
https://www.terraform.io/docs/commands/force-unlock.html
https://www.terraform.io/docs/state/locking.html
Terraform has a force-unlock command to manually unlock the state if unlocking failed.
If you unlock the state when someone else is holding the lock it could cause multiple writers. Force unlock should only be used to unlock your own lock in the situation where automatic unlocking failed.
NEW QUESTION 112
What kind of resource dependency is stored in terraform.tfstate file?
- A. Both implicit and explicit dependencies are stored in state file.
- B. No dependency information is stored in state file.
- C. Only implicit dependencies are stored in state file.
- D. Only explicit dependencies are stored in state file.
Answer: A
Explanation:
Explanation
Terraform state captures all dependency information, both implicit and explicit. One purpose for state is to determine the proper order to destroy resources. When resources are created all of their dependency information is stored in the state. If you destroy a resource with dependencies, Terraform can still determine the correct destroy order for all other resources because the dependencies are stored in the state.
https://www.terraform.io/docs/state/purpose.html#metadata
NEW QUESTION 113
You are reviewing Terraform configurations for a big project in your company. You noticed that there are several identical sets of resources that appear in multiple configurations. What feature of Terraform would you recommend to use to reduce the amount of cloned configuration between the different configurations?
- A. Provisioners
- B. Packages
- C. Modules
- D. Backends
Answer: C
Explanation:
Modules are reusable configuration packages that Terraform can share through a variety of sources including Terraform Registries, GitHub, and Amazon S3 buckets.
A module is a container for multiple resources that are used together. Modules can be used to create lightweight abstractions, so that you can describe your infrastructure in terms of its architecture, rather than directly in terms of physical objects.
Modules are reusable configuration packages that Terraform can share through a variety of sources including Terraform Registries, GitHub, and Amazon S3 buckets.
https://www.terraform.io/docs/modules/index.html
NEW QUESTION 114
Which of the following best describes the default local backend?
- A. The local backend is the directory where resources deployed by Terraform have direct access to in order to update their current state.
- B. The local backend is where Terraform Enterprise stores logs to be processed by an log collector.
- C. The local backend is how Terraform connects to public cloud services, such as AWS, Azure, or GCP.
- D. The local backend stores state on the local filesystem, locks the state using system APIs, and performs operations locally.
Answer: D
Explanation:
Explanation
The local backend stores state on the local filesystem, locks that state using system APIs, and performs operations locally.
terraform {
backend "local" {
path = "relative/path/to/terraform.tfstate"
}
}
https://www.terraform.io/docs/backends/types/local.html
NEW QUESTION 115
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 Terraform to ignore a resource on the next apply
- D. When you want to force Terraform to destroy a resource on the next apply
Answer: B
Explanation:
The terraform taint command manually marks a Terraform-managed resource as tainted, forcing it to be destroyed and recreated on the next apply.
NEW QUESTION 116
Your company has a lot of workloads in AWS , and Azure that were respectively created using CloudFormation , and AzureRM Templates. However , now your CIO has decided to use Terraform for all new projects , and has asked you to check how to integrate the existing environment with terraform code. What should be your next plan of action?
- A. Use terraform import command to import each resource one by one .
- B. This is only possible in Terraform Enterprise , which has the TerraformConverter exe that can take any other template language like AzureRM and convert to Terraform code.
- C. Tell the CIO that this is not possible . Resources created in CloudFormation , and AzureRM templates cannot be tracked using terraform.
- D. Just write the terraform config file for the new resources , and run terraform apply , the state file will automatically be updated with the details of the new resources to be imported.
Answer: A
NEW QUESTION 117
Taint the resource "aws_instance" "baz" resource that lives in module bar which lives in module foo.
- A. terraform taint module.foo.module.bar.aws_instance.baz
- B. terraform taint module.foo.bar.aws_instance.baz
- C. terraform taint module.foo.module.bar.baz
- D. terraform taint foo.bar.aws_instance.baz
Answer: A
Explanation:
Check resource addressing
https://www.terraform.io/docs/internals/resource-addressing.html
NEW QUESTION 118
Which of the below terraform commands do not run terraform refresh implicitly before taking actual action of the command?
- A. terraform plan
- B. terraform init
- C. terraform import
- D. terraform apply
- E. terraform destroy
Answer: B,C
Explanation:
Explanation
https://www.terraform.io/docs/commands/refresh.html
NEW QUESTION 119
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 property to the module in Terraform's state file 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 key to the module configuration and specify a previous version.
Answer: B
Explanation:
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 120
Which of the following type of variable allows multiple values of several distinct types to be grouped together as a single value?
- A. Object
- B. Map
- C. List
- D. Tuple
Answer: A,D
Explanation:
Explanation
Structural type of variable allows multiple values of several distinct types to be grouped together as a single value. They require a schema as an argument, to specify which types are allowed for which elements.
https://www.terraform.io/docs/configuration/types.html
NEW QUESTION 121
Which of the following is the right substitute for static values that can make Terraform configuration file more dynamic and reusable?
- A. Input parameters
- B. Modules
- C. Output value
- D. Functions
Answer: A
Explanation:
Input variables serve as parameters for a Terraform module, allowing aspects of the module to be customized without altering the module's own source code, and allowing modules to be shared between different configurations.
NEW QUESTION 122
Where does the Terraform local backend store its state?
- A. In the terraform.tfstate file
- B. In the /tmp directory
- C. In the user's .terraformrc file
- D. In the terraform.tfvars file
Answer: A
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 123
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 taint
- C. terraform destroy
- D. terraform recreate
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.
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 124
Anyone can publish and share modules on the Terraform Public Module Registry, and meeting the requirements for publishing a module is extremely easy. Select from the following list all valid requirements. (select three)
- A. The registry uses tags to identify module versions.
- B. The module must be on GitHub and must be a public repo.
Explanation
https://www.terraform.io/docs/registry/modules/publish.html#requirements - C. Module repositories must use this three-part name format, terraform-- .
- D. Release tag names must be for the format x.y.z, and can optionally be prefixed with a v .
- E. The module must be PCI/HIPPA compliant.
Answer: A,B,D
NEW QUESTION 125
Which of these options is the most secure place to store secrets foe connecting to a Terraform remote backend?
- A. Defined in Environment variables
- B. Inside the backend block within the Terraform configuration
- C. None of above
- D. Defined in a connection configuration outside of Terraform
Answer: A
NEW QUESTION 126
The current implementation of Terraform import can only import resources into the state. It does not generate configuration.
- A. True
- B. False
Answer: A
Explanation:
The current implementation of Terraform import can only import resources into the state. It does not generate configuration. A future version of Terraform will also generate configuration.
Because of this, prior to running terraform import it is necessary to write manually a resource configuration block for the resource, to which the imported object will be mapped.
While this may seem tedious, it still gives Terraform users an avenue for importing existing resources.
https://www.terraform.io/docs/import/index.html#currently-state-only
NEW QUESTION 127
You cannot publish your own modules on the Terraform Registry.
- A. True
- B. False
Answer: B
Explanation:
Explanation
https://www.terraform.io/docs/registry/modules/publish.html
NEW QUESTION 128
......
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:
- Manage Terraform and supplier installation and versioning
- Provided with a situation: determine when to utilize terraform import to import existing infrastructure into your Terraform state
- Explain the advantages of state
- Provided with a situation: determine when to utilize terraform to edit code
- Describe advantages of Infrastructure as code patterns
- Explain what Infrastructure as code is
- Describe how Terraform pinpoints and retrieves providers
- Provided with a situation: determine when to utilize terraform state to view Terraform state
- Describe plugin-based architecture
- Provided with a situation: determine when to utilize terraform workspace to create workspaces
- Provided with a situation: determine when to allow verbose logging and what the outcome/value is
- Explain multi-cloud and provider-agnostic advantages
- Explain when to tilize and not to utilize provisioners and when to utilize local-exec or remote-exec.
- Demonstrate by using multiple providers
- Provided with a situation: determine when to utilize terraform taint to taint Terraform resources
Aruba Networks Certified: Mobility Associate-Professional Exam Certified Professional salary
The estimated average salary of HashiCorp Certified: Terraform Associate TA-002-P Professional Exam is listed below:
- England: 71,460 POUND
- Europe: 88,032 EURO
- India: 7,199,4 INR
- United States: 100,146 USD
These salaries are calculated at the time of writing according to the currency rates.
Updated PDF (New 2021) Actual HashiCorp TA-002-P Exam Questions: https://www.dumpsquestion.com/TA-002-P-exam-dumps-collection.html
Verified TA-002-P Exam Dumps PDF [2021] Access using DumpsQuestion: https://drive.google.com/open?id=1aq3E2jEACbPEvfUmE-aWrjZDkYOED5i2