TA-002-P Practice Exam Tests Latest Updated on Sep-2021 [Q33-Q53]

Share

TA-002-P Practice Exam Tests Latest Updated on Sep-2021

Pass TA-002-P Exam in First Attempt Guaranteed Dumps!

NEW QUESTION 33
Which of the following is not a valid string function in Terraform?

  • A. slice
  • B. split
  • C. join
  • D. chomp

Answer: D

Explanation:
Reference: https://www.terraform.io/docs/language/functions/chomp.html

 

NEW QUESTION 34
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 all 4 web instances , together , for further individual segregation , indexing is required , with a 0 based index.
  • B. It refers to the last web EC2 instance , as by default , if no index is provided , the last / N-1 index is used.
  • C. 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.
  • D. The above will result in a syntax error , as it is not syntactically correct . Resources defined using count , can only be referenced using indexes.

Answer: A

Explanation:
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 35
Terraform will sync all resources in state by default for every plan and apply, hence for larger infrastructures this can slow down terraform plan and terraform apply commands?

  • A. True
  • B. False

Answer: A

Explanation:
For small infrastructures, Terraform can query your providers and sync the latest attributes from all your resources. This is the default behavior of Terraform: for every plan and apply, Terraform will sync all resources in your state.
For larger infrastructures, querying every resource is too slow. Many cloud providers do not provide APIs to query multiple resources at once, and the round trip time for each resource is hundreds of milliseconds. On top of this, cloud providers almost always have API rate limiting so Terraform can only request a certain number of resources in a period of time. Larger users of Terraform make heavy use of the -refresh=false flag as well as the -target flag in order to work around this. In these scenarios, the cached state is treated as the record of truth.
https://www.terraform.io/docs/state/purpose.html

 

NEW QUESTION 36
Refer below code where pessimistic constraint operator has been used to specify a version of a provider.
terraform { required_providers { aws = "~> 1.1.0" }}
Which of the following options are valid provider versions that satisfy the above constraint. (select two)

  • A. 1.2.9
  • B. 1.1.1
  • C. 1.2.0
  • D. 1.1.8

Answer: B,D

Explanation:
Pessimistic constraint operator, constraining both the oldest and newest version allowed. For example, ~> 0.9 is equivalent to >= 0.9, < 1.0, and ~> 0.8.4, is equivalent to >= 0.8.4, < 0.9

 

NEW QUESTION 37
What is the name assigned by Terraform to reference this resource?

  • A. azurerm
  • B. test
  • C. azurerm_resource_group
  • D. dev

Answer: B

 

NEW QUESTION 38
You have multiple team members collaborating on infrastructure as code (IaC) using Terraform, and want to apply formatting standards for readability.
How can you format Terraform HCL (HashiCorp Configuration Language) code according to standard Terraform style convention?

  • A. Run the terraform fmt command during the code linting phase of your CI/CD process
  • B. Manually apply two spaces indentation and align equal sign "=" characters in every Terraform file (*.tf)
  • C. Write a shell script to transform Terraform files using tools such as AWK, Python, and sed
  • D. Designate one person in each team to review and format everyone's code

Answer: B

Explanation:
* Indent two spaces for each nesting level.
* When multiple arguments with single-line values appear on consecutive lines at the same nesting level, align their equals signs.
Reference: https://www.terraform.io/docs/language/syntax/style.html

 

NEW QUESTION 39
terraform init initializes a sample main.tf file in the current directory.

  • A. False
  • B. True

Answer: A

 

NEW QUESTION 40
Which one of the following command will rewrite Terraform configuration files to a canonical format and style.

  • A. terraform graph
  • B. terraform graph -h
  • C. terraform init
  • D. terraform fmt

Answer: D

Explanation:
The terraform fmt command is used to rewrite Terraform configuration files to a canonical format and style. This command applies a subset of the Terrra Terraform language style conventions, along with other minor adjustments for readability.

 

NEW QUESTION 41
When writing Terraform code, HashiCorp recommends that you use how many spaces between each nesting level?

  • A. 0
  • B. 1
  • C. 2
  • D. 3

Answer: C

Explanation:
Explanation
The Terraform parser allows you some flexibility in how you lay out the elements in your configuration files, but the Terraform language also has some idiomatic style conventions which we recommend users always follow for consistency between files and modules written by different teams. Automatic source code formatting tools may apply these conventions automatically.
Indent two spaces for each nesting level.
When multiple arguments with single-line values appear on consecutive lines at the same nesting level, align their equals signs:
ami = "abc123"
instance_type = "t2.micro"
When both arguments and blocks appear together inside a block body, place all of the arguments together at the top and then place nested blocks below them. Use one blank line to separate the arguments from the blocks.
Use empty lines to separate logical groups of arguments within a block.
For blocks that contain both arguments and "meta-arguments" (as defined by the Terraform language semantics), list meta-arguments first and separate them from other arguments with one blank line. Place meta-argument blocks last and separate them from other blocks with one blank line.
resource "aws_instance" "example" {
count = 2 # meta-argument first
ami = "abc123"
instance_type = "t2.micro"
network_interface {
# ...
}
lifecycle { # meta-argument block last
create_before_destroy = true
}
}
Top-level blocks should always be separated from one another by one blank line. Nested blocks should also be separated by blank lines, except when grouping together related blocks of the same type (like multiple provisioner blocks in a resource).
Avoid separating multiple blocks of the same type with other blocks of a different type, unless the block types are defined by semantics to form a family. (For example: root_block_device, ebs_block_device and ephemeral_block_device on aws_instance form a family of block types describing AWS block devices, and can therefore be grouped together and mixed.)

 

NEW QUESTION 42
In the following code snippet, the block type is identified by which string?

  • A. "db"
  • B. "aws_instance"
  • C. resource
  • D. instance_type

Answer: C

 

NEW QUESTION 43
Which of the following value will be accepted for my_var?
1. variable "my_var"
2. {
3. type = string
4. }

  • A. Both A and B
  • B. 0
  • C. "15"
  • D. None of the above

Answer: A

Explanation:
The Terraform language will automatically convert number and bool values to string values when needed, and vice-versa as long as the string contains a valid representation of a number or boolean value.
Example
* true converts to "true", and vice-versa
* false converts to "false", and vice-versa
* 15 converts to "15", and vice-versa
Where possible, Terraform automatically converts values from one type to another in order to produce the expected type. If this isn't possible, Terraform will produce a type mismatch error and you must update the configuration with a more suitable expression.
https://www.terraform.io/docs/configuration/expressions.html#type-conversion

 

NEW QUESTION 44
You have created an AWS EC2 instance of type t2.micro through your terraform configuration file ec2.tf . Now you want to change the instance type from t2.micro to t2.medium. Accordingly you have changed your configuration file and and ran terraform plan. After running terraform plan you check the output and saw one instance will be updated from t2.micro --> t2.medium. After this you went to grab a coffee without running terraform apply and meanwhile a member of your team changed the instance type of that EC2 instance to t2.medium from aws console. After coming to your desk you run terraform apply. What will happen?

  • A. The instance type will be changed to t2.micro and again will be changed to t2.medium
  • B. No resource will be updated and you will see the message : Apply Complete ! Resources : 0 added, 0 changed, 0 destroyed.
  • C. terraform apply will through an error.
  • D. 1 resource will be updated and you will see the message : Apply Complete ! Resources : 0 added, 1 changed, 0 destroyed.

Answer: B

 

NEW QUESTION 45
Which of the following clouds does not have a provider maintained HashiCorp?

  • A. DigitalOcean
  • B. OpenStack
  • C. AWS
  • D. IBM Cloud

Answer: D

Explanation:
Explanation
IBM Cloud does not have a provider maintained by HashiCorp, although IBM Cloud does maintain their own Terraform provider.
https://www.terraform.io/docs/providers/index.html

 

NEW QUESTION 46
When using Terraform in a team it is important for everyone to be working with the same state so that operations will be applied to the same remote objects. Which of the below option is a recommended solution for this?

  • A. Workspace
  • B. Use the cached state and treat this as the record of truth.
  • C. Remote State
  • D. Module

Answer: C

Explanation:
https://www.terraform.io/docs/state/remote.html

 

NEW QUESTION 47
When configuring a remote backend in Terraform, it might be a good idea to purposely omit some of the required arguments to ensure secrets and other important data aren't inadvertently shared with others. What are the ways the remaining configuration can be added to Terraform so it can initialize and communicate with the backend? (select three)

  • A. use the -backend-config=PATH to specify a separate config file
  • B. command-line key/value pairs
  • C. directly querying HashiCorp Vault for the secrets
  • D. interactively on the command line

Answer: A,B,D

Explanation:
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:
https://www.terraform.io/docs/backends/init.html#backend-initialization

 

NEW QUESTION 48
HashiCorp offers multiple versions of Terraform, including Terraform open-source, Terraform Cloud, and Terraform Enterprise. Which of the following Terraform features are only available in the Enterprise edition?
(select four)

  • A. Private Module Registry
  • B. Audit Logs
  • C. Clustering
  • D. SAML/SSO
  • E. Private Network Connectivity
  • F. Sentinel

Answer: B,D,E

Explanation:
Explanation
While there are a ton of features that are available to open source users, many features that are part of the Enterprise offering are geared towards larger teams and enterprise functionality. To see what specific features are part of Terraform Cloud and Terraform Enterprise, check out this link.
https://www.hashicorp.com/products/terraform/pricing/

 

NEW QUESTION 49
terraform init initializes a sample main.tf file in the current directory.

  • A. False
  • B. True

Answer: A

Explanation:
Reference: https://www.terraform.io/docs/cli/commands/init.html

 

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

  • A. A web-based user interface (UI)
  • B. Automated infrastructure deployment visualization
  • 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 51
What is the best and easiest way for Terraform to read and write secrets from HashiCorp Vault?

  • A. integration with a tool like Jenkins
  • B. API access using the AppRole auth method
  • C. Vault provider
  • D. CLI access from the same machine running Terraform

Answer: C

 

NEW QUESTION 52
Which of the following Terraform commands will automatically refresh the state unless supplied with additional flags or arguments? Choose TWO correct answers.

  • A. terraform plan
  • B. terraform state
  • C. terraform output
  • D. terraform validate
  • E. terraform apply

Answer: A,E

 

NEW QUESTION 53
......

HashiCorp Infrastructure Automation  Free Certification Exam Material from 2Pass4sure with 324 Questions: https://www.2pass4sure.com/HashiCorp-Infrastructure-Automation/TA-002-P-actual-exam-braindumps.html

TA-002-P Dumps Full Questions - Exam Study Guide: https://drive.google.com/open?id=1oLGkY4Btg4cJn1_in0wJSfGN_4g9RqP6