TA-002-P Training & Certification Get Latest HashiCorp Infrastructure Automation Updated on Jan 04, 2022
Certification Training for TA-002-P Exam Dumps Test Engine
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:
- Exhibit use of variables and outputs
- Express secure secret injection best practice
- Utilize resource addressing and resource parameters to connect resources
- Advantages of Sentinel, registry, and workspaces Differentiate OSS and TFE workspaces
- Use Terraform built-in functions to write configuration
- Summarize characteristics of Terraform Cloud
- Learn the application of the collection and structural types
- Design and distinguish resource and data configuration
- Specify built-in dependency management
- Configure resource using a dynamic block
NEW QUESTION 185
What features does the hosted service Terraform Cloud provide? (Choose two.)
- A. A web-based user interface (UI)
- B. Remote state storage
- C. Automatic backups
- D. Automated infrastructure deployment visualization
Answer: B,C
Explanation:
Reference:
https://www.terraform.io/docs/enterprise/admin/automated-recovery.html https://www.terraform.io/docs/language/state/remote.html
NEW QUESTION 186
By default, a defined provisioner is a creation-time provisioner.
- A. False
- B. True
Answer: B
Explanation:
Explanation
https://www.terraform.io/docs/provisioners/index.html
NEW QUESTION 187
Which of the following is not an action performed by terraform init?
- A. Initialize a configured backend
- B. Create a sample main.tf file
- C. Load required provider plugins
- D. Retrieve the source code for all referenced modules
Answer: B
NEW QUESTION 188
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
Explanation:
Reference: https://www.terraform.io/docs/registry/modules/publish.html
NEW QUESTION 189
Terraform import command can import resources into modules as well directly into the root of your state.
- A. False
- B. True
Answer: B
Explanation:
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 190
You have declared a variable name my_var in terraform configuration without a value associated with it.
variable my_var {}
After running terraform plan it will show an error as variable is not defined.
- A. False
- B. True
Answer: A
Explanation:
Input variables are usually defined by stating a name, type and a default value. However, the type and default values are not strictly necessary. Terraform can deduct the type of the variable from the default or input value.
Variables can be predetermined in a file or included in the command-line options. As such, the simplest variable is just a name while the type and value are selected based on the input.
variable "variable_name" {}
terraform apply -var variable_name="value"
The input variables, like the one above, use a couple of different types: strings, lists, maps, and boolean. Here are some examples of how each type are defined and used.
String
Strings mark a single value per structure and are commonly used to simplify and make complicated values more user-friendly. Below is an example of a string variable definition.
variable "template" {
type = string
default = "01000000-0000-4000-8000-000030080200"
}
A string variable can then be used in resource plans. Surrounded by double quotes, string variables are a simple substitution such as the example underneath.
storage = var.template
List
Another type of Terraform variables lists. They work much like a numbered catalogue of values. Each value can be called by their corresponding index in the list. Here is an example of a list variable definition.
variable "users" {
type = list
default = ["root", "user1", "user2"]
}
Lists can be used in the resource plans similarly to strings, but you'll also need to denote the index of the value you are looking for.
username = var.users[0]
Map
Maps are a collection of string keys and string values. These can be useful for selecting values based on predefined parameters such as the server configuration by the monthly price.
variable "plans" {
type = map
default = {
"5USD" = "1xCPU-1GB"
"10USD" = "1xCPU-2GB"
"20USD" = "2xCPU-4GB"
}
}
You can access the right value by using the matching key. For example, the variable below would set the plan to "1xCPU-1GB".
plan = var.plans["5USD"]
The values matching to their keys can also be used to look up information in other maps. For example, underneath is a shortlist of plans and their corresponding storage sizes.
variable "storage_sizes" {
type = map
default = {
"1xCPU-1GB" = "25"
"1xCPU-2GB" = "50"
"2xCPU-4GB" = "80"
}
}
These can then be used to find the right storage size based on the monthly price as defined in the previous example.
size = lookup(var.storage_sizes, var.plans["5USD"])
Boolean
The last of the available variable type is boolean. They give the option to employ simple true or false values. For example, you might wish to have a variable that decides when to generate the root user password on a new deployment.
variable "set_password" {
default = false
}
The above example boolean can be used similarly to a string variable by simply marking down the correct variable.
create_password = var.set_password
By default, the value is set to false in this example. However, you can overwrite the variable at deployment by assigning a different value in a command-line variable.
terraform apply -var set_password="true"
NEW QUESTION 191
Which of the following type of variable allows multiple values of several distinct types to be grouped together as a single value?
- A. List
- B. Object
- C. Tuple
- D. Map
Answer: B,C
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 192
During a terraform plan, a resource is successfully created but eventually fails during provisioning. What happens to the resource?
- A. the terraform plan is rolled back and all provisioned resources are removed
- B. the resource is marked as tainted
- C. Terraform attempts to provision the resource up to three times before exiting with an error
- D. it is automatically deleted
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 193
How would you reference the "name" value of the second instance of this fictitious resource?
- A. aws_instance.web[1]
- B. aws_instance.web.*.name
- C. aws_instance.web[1].name
- D. aws_instance.web[2].name
- E. element(aws_instance.web, 2)
Answer: E
NEW QUESTION 194
Your manager has instructed you to start using terraform for the entire infra provisioning of the application stack. There are 4 environments - DEV , QA , UAT , and PROD. The application team has asked for complete segregation between these environments including the backend , state , and also configurations ,since there will be unique resources in different environments . What is the possible way to structure the terraform code to facilitate that.
- A. Completely separate the working directories , keep one for each environment . For each working directory , maintain a separate configuration file , variables file , and map to a different backend.
- B. Enable remote backend storage . Configure 4 different backend storages , one for each environment.
- C. Implement terraform workspaces , and map each environment with one workspace.
- D. Completely separate the working directories , keep one for each environment . For each working directory , maintain a separate configuration file , variables file , and map to the same backend.
Answer: A
Explanation:
Explanation
In particular, organizations commonly want to create a strong separation between multiple deployments of the same infrastructure serving different development stages (e.g. staging vs. production) or different internal teams. In this case, the backend used for each deployment often belongs to that deployment, with different credentials and access controls. Named workspaces are not a suitable isolation mechanism for this scenario.
https://www.terraform.io/docs/state/workspaces.html
NEW QUESTION 195
Which flag would be used within a Terraform configuration block to identify the specific version of a provider required?
- A. required_versions
- B. required-version
- C. required_providers
- D. required-provider
Answer: C
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 196
Which of the below terraform commands do not run terraform refresh implicitly before taking actual action of the command?
- A. terraform apply
- B. terraform import
- C. terraform plan
- D. terraform init
- E. terraform destroy
Answer: B,D
Explanation:
Explanation
https://www.terraform.io/docs/commands/refresh.html
NEW QUESTION 197
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 foo.bar.aws_instance.baz
- C. terraform taint module.foo.bar.aws_instance.baz
- D. terraform taint module.foo.module.bar.baz
Answer: A
Explanation:
Explanation
Check resource addressing
https://www.terraform.io/docs/internals/resource-addressing.html
NEW QUESTION 198
In regards to deploying resources in multi-cloud environments, what are some of the benefits of using Terraform rather than a provider's native tooling? (select three)
- A. Terraform can help businesses deploy applications on multiple clouds and on-premises infrastructure.
- B. Terraform is not cloud-agnostic and can be used to deploy resources across a single public cloud.
- C. Terraform simplifies management and orchestration, helping operators build large-scale, multi-cloud infrastructure.
- D. Terraform can manage cross-cloud dependencies.
Answer: A,C,D
Explanation:
Explanation
Terraform is cloud-agnostic and allows a single configuration to be used to manage multiple providers, and to even handle cross-cloud dependencies. This simplifies management and orchestration, helping operators build large-scale multi-cloud infrastructures.
https://www.terraform.io/intro/use-cases.html
NEW QUESTION 199
What is the default backend for Terraform?
- A. gcs
- B. etcd
- C. local
- D. consul
Answer: C
Explanation:
By default, Terraform uses the "local" backend, which is the normal behavior of Terraform you're used to.
https://www.terraform.io/docs/backends/index.html
NEW QUESTION 200
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. Backends
- B. Packages
- C. Provisioners
- D. Modules
Answer: D
Explanation:
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 201
Given the below resource configuration -
resource "aws_instance" "web" { # ... count = 4 }
What does the terraform resource address aws_instance.web refer to?
- A. It refers to the first web EC2 instance out of the 4 ,as by default , if no index is provided , the first / 0th index is used.
- B. The above will result in a syntax error , as it is not syntactically correct . Resources defined using count , can only be referenced using indexes.
- C. It refers to all 4 web instances , together , for further individual segregation , indexing is required , with a 0 based index.
- D. It refers to the last web EC2 instance , as by default , if no index is provided , the last / N-1 index is used.
Answer: C
Explanation:
A Resource Address is a string that references a specific resource in a larger infrastructure. An address is made up of two parts:
[module path][resource spec]
Module path:
A module path addresses a module within the tree of modules. It takes the form:
module.A.module.B.module.C...
Multiple modules in a path indicate nesting. If a module path is specified without a resource spec, the address applies to every resource within the module. If the module path is omitted, this addresses the root module.
Given a Terraform config that includes:
resource "aws_instance" "web" {
# ...
count = 4
}
An address like this:
aws_instance.web[3]
Refers to only the last instance in the config, and an address like this:
aws_instance.web
Refers to all four "web" instances.
https://www.terraform.io/docs/internals/resource-addressing.html
NEW QUESTION 202
If writing Terraform code that adheres to the Terraform style conventions, how would you properly indent each nesting level compared to the one above it?
- A. With four spaces
- B. With a tab
- C. With two spaces
- D. With three spaces
Answer: C
NEW QUESTION 203
Every region in AWS has a different AMI ID for Linux and these are keep on changing. What is the best approach to create the EC2 instances that can deal with different AMI IDs based on regions?
- A. Create different configuration file for different region.
- B. None of the above
- C. Use data source aws_ami.
- D. Create a map of region to ami id.
Answer: C
Explanation:
https://www.terraform.io/docs/configuration/data-sources.html
NEW QUESTION 204
If you manually destroy infrastructure, what is the best practice reflecting this change in Terraform?
- A. It will happen automatically
- B. Manually update the state fire
- C. Run terraform import
- D. Run terraform refresh
Answer: A
NEW QUESTION 205
What are some of the features of Terraform state? (select three)
- A. increased performance
- B. inspection of cloud resources
- C. mapping configuration to real-world resources
- D. determining the correct order to destroy resources
Answer: A,C
NEW QUESTION 206
The terraform init command is always safe to run multiple times, to bring the working directory up to date with changes in the configuration. Though subsequent runs may give errors, this command will never delete your existing configuration or state.
- A. False
- B. True
Answer: B
Explanation:
https://www.terraform.io/docs/commands/init.html
NEW QUESTION 207
A user has created a module called "my_test_module" and committed it to GitHub. Over time, several commits have been made with updates to the module, each tagged in GitHub with an incremental version number. Which of the following lines would be required in a module configuration block in terraform to select tagged version v1.0.4?
- A. source = "git::https://example.com/my_test_module.git&ref=v1.0.4"
- B. source = "git::https://example.com/my_test_module.git@tag=v1.0.4"
- C. source = "git::https://example.com/my_test_module.git?ref=v1.0.4"
Explanation
https://www.terraform.io/docs/modules/sources.html#selecting-a-revision - D. source = "git::https://example.com/my_test_module.git#tag=v1.0.4"
Answer: C
NEW QUESTION 208
The terraform init command is always safe to run multiple times, to bring the working directory up to date with changes in the configuration. Though subsequent runs may give errors, this command will never delete your existing configuration or state.
- A. False
- B. True
Answer: B
Explanation:
Explanation
https://www.terraform.io/docs/commands/init.html
NEW QUESTION 209
......
Step by Step Guide to Prepare for TA-002-P Exam: https://www.free4torrent.com/TA-002-P-braindumps-torrent.html
HashiCorp Infrastructure Automation TA-002-P Real Exam Questions and Answers FREE Updated: https://drive.google.com/open?id=1d9fx-8rGJ30Fj-1Xlhd5xXZRZVU-8_LT