2024 Realistic Verified TA-002-P exam dumps Q&As - TA-002-P Free Update
Use Real TA-002-P Dumps - 100% Free TA-002-P Exam Dumps
NEW QUESTION # 40
True or False: A list(...) contain a number of values of the same type while an object(...) can contain a number of values of different types.
- A. False
- B. True
Answer: B
Explanation:
Collection Types
A collection type allows multiple values of one other type to be grouped together as a single value. The type of value within a collection is called its element type. All collection types must have an element type, which is provided as the argument to their constructor.
For example, the type list(string) means "list of strings", which is a different type than list(number), a list of numbers. All elements of a collection must always be of the same type.
The three kinds of collection type in the Terraform language are:
* list(...): a sequence of values identified by consecutive whole numbers starting with zero.
The keyword list is a shorthand for list(any), which accepts any element type as long as every element is the same type. This is for compatibility with older configurations; for new code, we recommend using the full form.
* map(...): a collection of values where each is identified by a string label.
The keyword map is a shorthand for map(any), which accepts any element type as long as every element is the same type. This is for compatibility with older configurations; for new code, we recommend using the full form.
* set(...): a collection of unique values that do not have any secondary identifiers or ordering.
https://www.terraform.io/docs/configuration/types.html
Structural Types
A structural type allows multiple values of several distinct types to be grouped together as a single value. Structural types require a schema as an argument, to specify which types are allowed for which elements.
The two kinds of structural type in the Terraform language are:
* object(...): a collection of named attributes that each have their own type.
The schema for object types is { <KEY> = <TYPE>, <KEY> = <TYPE>, ... } - a pair of curly braces containing a comma-separated series of <KEY> = <TYPE> pairs. Values that match the object type must contain all of the specified keys, and the value for each key must match its specified type. (Values with additional keys can still match an object type, but the extra attributes are discarded during type conversion.)
* tuple(...): a sequence of elements identified by consecutive whole numbers starting with zero, where each element has its own type.
The schema for tuple types is [<TYPE>, <TYPE>, ...] - a pair of square brackets containing a comma-separated series of types. Values that match the tuple type must have exactly the same number of elements (no more and no fewer), and the value in each position must match the specified type for that position.
For example: an object type of object({ name=string, age=number }) would match a value like the following:
{
name = "John"
age = 52
}
Also, an object type of object({ id=string, cidr_block=string }) would match the object produced by a reference to an aws_vpc resource, like aws_vpc.example_vpc; although the resource has additional attributes, they would be discarded during type conversion.
Finally, a tuple type of tuple([string, number, bool]) would match a value like the following:
["a", 15, true]
https://www.terraform.io/docs/configuration/types.html
NEW QUESTION # 41
Which of the following is the right substitute for static values that can make Terraform configuration file more dynamic and reusable?
- A. Functions
- B. Input parameters
- C. Output value
- D. Modules
Answer: B
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 # 42
Your team has started using terraform OSS in a big way , and now wants to deploy multi region deployments
(DR) in aws using the same terraform files . You want to deploy the same infra (VPC,EC2 ...) in both
us-east-1 ,and us-west-2 using the same script , and then peer the VPCs across both the regions to enable DR
traffic. But , when you run your script , all resources are getting created in only the default provider region.
What should you do? Your provider setting is as below -
# The default provider configuration provider "aws" { region = "us-east-1" }
- A. Use provider alias functionality , and add another provider for us-west region . While creating the
resources using the tf script , reference the appropriate provider (using the alias). - B. No way to enable this via a single script . Write 2 different scripts with different default providers in the
2 scripts , one for us-east , another for us-west. - C. Manually create the DR region , once the Primary has been created , since you are using terraform OSS ,
and multi region deployment is only available in Terraform Enterprise. - D. Create a list of regions , and then use a for-each to iterate over the regions , and create the same
resources ,one after the one , over the loop.
Answer: A
Explanation:
Explanation
You can optionally define multiple configurations for the same provider, and select which one to use on a
per-resource or per-module basis. The primary reason for this is to support multiple regions for a cloud
platform; other examples include targeting multiple Docker hosts, multiple Consul hosts, etc.
To include multiple configurations for a given provider, include multiple provider blocks with the same
provider name, but set the alias meta-argument to an alias name to use for each additional configuration. For
example:
# The default provider configuration
provider "aws" {
region = "us-east-1"
}
# Additional provider configuration for west coast region
provider "aws" {
alias = "west"
region = "us-west-2"
}
https://www.terraform.io/docs/configuration/providers.html
NEW QUESTION # 43
What feature stops multiple users from operating on the Terraform state at the same time?
- A. Provider constraints
- B. Version control
- C. State locking
- D. Remote backends
Answer: C
Explanation:
State locking prevents other users from modifying the state file while a Terraform operation is in progress. This prevents conflicts and data loss1.
NEW QUESTION # 44
You do not need to specify every required argument in the backend configuration. Omitting certain arguments may be desirable to avoid storing secrets, such as access keys, within the main configuration. When some or all of the arguments are omitted, we call this a _____________.
- A. First Time Configuration
- B. Changing Configuration
- C. Default Configuration
- D. Partial Configuration
- E. Incomplete Configuration
Answer: D
Explanation:
You do not need to specify every required argument in the backend configuration. Omitting certain arguments may be desirable to avoid storing secrets, such as access keys, within the main configuration. When some or all of the arguments are omitted, we call this a partial configuration.
With a partial configuration, the remaining configuration arguments must be provided as part of the initialization process. There are several ways to supply the remaining arguments:
* Interactively: Terraform will interactively ask you for the required values, unless interactive input is disabled. Terraform will not prompt for optional values.
* File: A configuration file may be specified via the init command line. To specify a file, use the -backend-config=PATH option when running terraform init. If the file contains secrets it may be kept in a secure data store, such as Vault, in which case it must be downloaded to the local disk before running Terraform.
* Command-line key/value pairs: Key/value pairs can be specified via the init command line. Note that many shells retain command-line flags in a history file, so this isn't recommended for secrets. To specify a single key/value pair, use the -backend-config="KEY=VALUE" option when running terraform init.
https://www.terraform.io/docs/backends/config.html#partial-configuration
NEW QUESTION # 45
Which of the following is the safest way to inject sensitive values into a Terraform Cloud workspace?
- A. Set a value for the variable in the UI and check the "Sensitive" check box
- B. Set the variable value on the command line with the -var flag
- C. Edit the state file directly just before running terraform apply
- D. Write the value to a file and specify the file with the -var-file flag
Answer: A
Explanation:
Explanation
-var and -var-file overwrite workspace-specific and variable set variables that have the same key. From the
workspace, variable can be added and checked off as being sensitive. Reference:
https://www.terraform.io/cloud-docs/workspaces/variables/managing-variables#loading-variables-from-files
https://www.terraform.io/cloud-docs/workspaces/variables
NEW QUESTION # 46
You need to specify a dependency manually.
What resource meta-parameter can you use to make sure Terraform respects the dependency?
Type your answer in the field provided. The text field is not case-sensitive and all variations of the correct answer are accepted.
Answer:
Explanation:
thelocalfiledatasource
NEW QUESTION # 47
You have decided to create a new Terraform workspace to deploy a development environment. What is different about this workspace?
- A. It has its own state file
- B. It pulls in a different terraform.tvars file
- C. It uses a different branch of code
It uses a different backend
Answer: A
NEW QUESTION # 48
Which of the following is not an advantage of using infrastructure as code operations?
- A. Public cloud console configuration workflows
- B. API driven workflows
- C. Modify a count parameter to scale resources
- D. Self-service infrastructure deployment
- E. Troubleshoot via a Linux diff command
Answer: E
Explanation:
Explanation
terraform is used to deploy the infrastructure, not to troubleshoot it
NEW QUESTION # 49
You decide to move a Terraform state file to Amazon S3 from another location. You write the code below into
a file called\
You immediately run terraform apply but don't see any changes. Your state file didn't move. Which command
will migrate your current state file to the new S3 remote backend?
- A. terraform state
- B. terraform refresh
- C. terraform init
- D. terraform push
Answer: C
NEW QUESTION # 50
A provider configuration block is required in every Terraform configuration.
Example:
- A. False
- B. True
Answer: B
Explanation:
Reference: https://github.com/hashicorp/terraform/issues/17928
NEW QUESTION # 51
What are some benefits of using Sentinel with Terraform Cloud/Terra form Cloud? Choose three correct answers.
- A. You can check out and check in cloud access keys
- B. You can enforce a list of approved AWS AMIs
- C. Sentinel Policies can be written in HashiCorp Configuration Language (HCL)
- D. You can restrict specific resource configurations, such as disallowing the use of CIDR=0.0.0.0/0.
- E. Policy-as-code can enforce security best practices
Answer: B,D,E
Explanation:
These are some of the benefits of using Sentinel with Terraform Cloud/Terraform Enterprise, as they allow you to implement logic-based policies that can access and evaluate the Terraform plan, state, and configuration. The other options are not true, as Sentinel does not manage cloud access keys, and Sentinel policies are written in Sentinel language, not HCL.
NEW QUESTION # 52
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 # 53
What are the benefits of using Infrastructure as Code? (select five)
- A. Infrastructure as Code gives the user the ability to recreate an application's infrastructure for disaster recovery scenarios
- B. Infrastructure as Code is relatively simple to learn and write, regardless of a user's prior experience with developing code
- C. Infrastructure as Code provides configuration consistency and standardization among deployments
- D. Infrastructure as Code allows a user to turn a manual task into a simple, automated deployment (Correct)
- E. Infrastructure as Code easily replaces development languages such as Go and .Net for application development
- F. Infrastructure as Code is easily repeatable, allowing the user to reuse code to deploy similar, yet different resources
Answer: A,B,D,F
Explanation:
If you are new to infrastructure as code as a concept, it is the process of managing infrastructure in a file or files rather than manually configuring resources in a user interface.
A resource in this instance is any piece of infrastructure in a given environment, such as a virtual machine, security group, network interface, etc. At a high level, Terraform allows operators to use HCL to author files containing definitions of their desired resources on almost any provider (AWS, GCP, GitHub, Docker, etc) and automates the creation of those resources at the time of application.
NEW QUESTION # 54
In Terraform Enterprise, a workspace can be mapped to how many VCS repos?
- A. 0
- B. 1
- C. 2
- D. 3
Answer: C
Explanation:
A workspace can only be configured to a single VCS repo, however, multiple workspaces can use the same repo.
https://www.terraform.io/docs/cloud/workspaces/vcs.html
NEW QUESTION # 55
You need to specify a dependency manually. What resource meta-parameter can you use lo make sure Terraform respects thee dependency?
Type your answer in the field provided. The text field is not case-sensitive and all variations of the correct answer are accepted.
Answer:
Explanation:
dependson
NEW QUESTION # 56
Which of the following are string functions? Select three
- A. join
- B. format
- C. Chomp
- D. tostring
- E. tonumber
Answer: A,B,C
Explanation:
Explanation
tonumber and tostring are Type Conversion function
https://www.terraform.io/docs/configuration/functions.html
NEW QUESTION # 57
Select the operating systems which are supported for a clustered Terraform Enterprise: (select four)
- A. CentOS
- B. Amazon Linux
- C. Red Hat
- D. Unix
- E. Ubuntu
Answer: A,B,C,E
Explanation:
https://www.terraform.io/docs/enterprise/before-installing/index.html#operating-systemrequirements
NEW QUESTION # 58
The Terraform language does not support user-defined functions, and so only the functions built in to the language are available for use.
- A. False
- B. True
Answer: B
Explanation:
https://www.terraform.io/docs/configuration/functions.html
NEW QUESTION # 59
John is writing a module and within the module, there are multiple places where he has to use the same
conditional expression but he wants to avoid repeating the same values or expressions multiple times in a
configuration,. What is a better approach to dealing with this?
- A. Functions
- B. Expressions
- C. Variables
- D. Local Values
Answer: D
Explanation:
Explanation
A local value assigns a name to an expression, allowing it to be used multiple times within a module without
repeating it.
https://www.terraform.io/docs/configuration/locals.html
NEW QUESTION # 60
You have been given requirements to create a security group for a new application. Since your organization
standardizes on Terraform, you want to add this new security group with the fewest number of lines of code.
What feature could you use to iterate over a list of required tcp ports to add to the new security group?
- A. dynamic block
- B. dynamic backend
- C. terraform import
- D. splat expression
Answer: A
Explanation:
Explanation
A dynamic block acts much like a for expression, but produces nested blocks instead of a complex typed
value. It iterates over a given complex value and generates a nested block for each element of that complex
value.
https://www.terraform.io/docs/configuration/expressions.html#dynamic-blocks
NEW QUESTION # 61
Provider dependencies are created in several different ways. Select the valid provider dependencies from the following list: (select three)
- A. Existence of any resource instance belonging to a particular provider in the current state.
- B. Explicit use of a provider block in configuration, optionally including a version constraint.
- C. Existence of any provider plugins found locally in the working directory.
- D. Use of any resource belonging to a particular provider in a resource or data block in configuration.
Answer: A,B,D
Explanation:
Explanation
The existence of a provider plugin found locally in the working directory does not itself create a provider dependency. The plugin can exist without any reference to it in the terraform configuration.
https://www.terraform.io/docs/commands/providers.html
NEW QUESTION # 62
Terraform providers are always installed from the Internet.
- A. True
- B. False
Answer: B
Explanation:
Explanation
Terraform configurations must declare which providers they require, so that Terraform can install and use
them.
Reference: https://www.terraform.io/docs/language/providers/configuration.html
NEW QUESTION # 63
If you delete a remote backend from the configuration, will you need to rebuild your state files locally?
- A. True
- B. False
Answer: B
Explanation:
Explanation
You can change your backend configuration at any time. You can change both the configuration itself as well
as the type of backend (for example from "consul" to "s3").
Terraform will automatically detect any changes in your configuration and request a reinitialization. As part of
the reinitialization process, Terraform will ask if you'd like to migrate your existing state to the new
configuration. This allows you to easily switch from one backend to another.
https://www.terraform.io/docs/backends/config.html#changing-configuration
NEW QUESTION # 64
......
Pass TA-002-P exam Updated 94 Questions: https://www.2pass4sure.com/HashiCorp-Infrastructure-Automation/TA-002-P-actual-exam-braindumps.html
TA-002-P Exam Dumps, Test Engine Practice Test Questions: https://drive.google.com/open?id=1Jveh0tSzyD25c-hmxpn1mE0aglSurOvG