2023 The Most Effective TA-002-P with 450 Questions Answers
Try Free and Start Using Realistic Verified TA-002-P Dumps Instantly.
NEW QUESTION 263
Why should secrets not be hard coded into Terraform code? Choose two correct answers
- A. The Terraform code is copied to the target resources to be applied locally and could expose secrets if a
target resource is compromised. - B. All passwords should be rotated on a quarterly basis.
- C. Terraform code is typically stored in version control, as well as copied to the systems from h it's run.
Any of those may not have robust security mechanisms. - D. It makes the code less reusable.
Answer: A,C
NEW QUESTION 264
Why might a user opt to include the following snippet in their configuration file?
- A. Terraform 0.12 introduced substantial changes to the syntax used to write Terraform configuration
- B. The user wants to ensure that the application being deployed is a minimum version of 0.12
- C. this ensures that all Terraform providers are above a certain version to match the application being deployed
- D. versions before Terraform 0.12 were not approved by HashiCorp to be used in production
Answer: A
NEW QUESTION 265
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. aws_instance will be created first
aws_eip will be created second - 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. Resources will be created simultaneously
Answer: A
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 266
Why should secrets not be hard coded into Terraform code? Choose two correct answers
- A. It makes the code less reusable.
- B. All passwords should be rotated on a quarterly basis.
- C. The Terraform code is copied to the target resources to be applied locally and could expose secrets if a target resource is compromised.
- D. Terraform code is typically stored in version control, as well as copied to the systems from h it's run. Any of those may not have robust security mechanisms.
Answer: A,D
NEW QUESTION 267
What is the name assigned by Terraform to reference this resource?
- A. test
- B. google
- C. main
- D. compute_instance
Answer: C
NEW QUESTION 268
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. Local Values
- B. Expressions
- C. Functions
- D. Variables
Answer: A
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 269
A user creates three workspaces from the command line - prod, dev, and test. Which of the following commands will the user run to switch to the dev workspace?
- A. terraform workspace dev
- B. terraform workspace select dev
- C. terraform workspace switch dev
- D. terraform workspace -switch dev
Answer: B
Explanation:
Explanation
The terraform workspace select command is used to choose a different workspace to use for further operations. https://www.terraform.io/docs/commands/workspace/select.html
NEW QUESTION 270
You should store secret data in the same version control repository as your Terraform configuration.
- A. True
- B. False
Answer: B
NEW QUESTION 271
Which of the below features of Terraform can be used for managing small differences between different environments which can act more like completely separate working directories.
- A. Environment Variables
- B. Workspaces
- C. Backends
- D. Repositories
Answer: B
Explanation:
workspaces allow conveniently switching between multiple instances of a single configuration within its single backend. They are convenient in a number of situations, but cannot solve all problems.
A common use for multiple workspaces is to create a parallel, distinct copy of a set of infrastructure in order to test a set of changes before modifying the main production infrastructure. For example, a developer working on a complex set of infrastructure changes might create a new temporary workspace in order to freely experiment with changes without affecting the default workspace.
Non-default workspaces are often related to feature branches in version control. The default workspace might correspond to the "master" or "trunk" branch, which describes the intended state of production infrastructure. When a feature branch is created to develop a change, the developer of that feature might create a corresponding workspace and deploy into it a temporary "copy" of the main infrastructure so that changes can be tested without affecting the production infrastructure. Once the change is merged and deployed to the default workspace, the test infrastructure can be destroyed and the temporary workspace deleted.
https://www.terraform.io/docs/state/workspaces.html
https://www.terraform.io/docs/state/workspaces.html#when-to-use-multiple-workspaces
NEW QUESTION 272
What is the name assigned by Terraform to reference this resource?
- A. azurerm_resource_group
- B. azurerm
- C. dev
- D. test
Answer: D
NEW QUESTION 273
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 274
You have multiple developers working on a terraform project (using terraform OSS), and have saved the terraform state in a remote S3 bucket . However ,team is intermittently experiencing inconsistencies in the provisioned infrastructure / failure in the code . You have traced this problem to simultaneous/concurrent runs of terraform apply command for 2/more developers . What can you do to fix this problem?
- A. Stop using remote state , and store the developer tfstate in their own machine . Once a day , all developers should sit together and merge the state files manually , to avoid any inconsistencies.
- B. Structure your team in such a way that only one individual will run terraform apply , everyone will just make changes and share with him. Then there will be no chance of any inconsistencies.
- C. Use terraform workspaces feature, this will fix this problem by default , as every developer will have their own state file , and terraform will merge them on server side on its own.
- D. Enable terraform state locking for the S3 backend using DynamoDB table. This prevents others from acquiring the lock and potentially corrupting your state.
Answer: D
Explanation:
S3 backend support state locking using DynamoDB.
https://www.terraform.io/docs/state/locking.html
NEW QUESTION 275
Which of the following Terraform commands will automatically refresh the state unless supplied with additional flags or arguments? Choose TWO correct answers.
- A. terraform state
- B. terraform validate
- C. terraform output
- D. terraform plan
- E. terraform apply
Answer: D,E
NEW QUESTION 276
Select the operating systems which are supported for a clustered Terraform Enterprise: (select four)
- A. Amazon Linux
- B. Red Hat
- C. Unix
- D. Ubuntu
- E. CentOS
Answer: A,B,D,E
Explanation:
Explanation
https://www.terraform.io/docs/enterprise/before-installing/index.html#operating-systemrequirements
NEW QUESTION 277
Provider dependencies are created in several different ways. Select the valid provider dependencies from the following list: (select three)
- A. Explicit use of a provider block in configuration, optionally including a version constraint.
- B. Existence of any provider plugins found locally in the working directory.
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 - C. Use of any resource belonging to a particular provider in a resource or data block in configuration.
- D. Existence of any resource instance belonging to a particular provider in the current state.
Answer: A,C,D
NEW QUESTION 278
You wanted to destroy some of the dependent resources from real infrastructure. You choose to delete those resources from your configuration file and run terraform plan and then apply. Which of the following way your resources would be destroyed?
- A. The resource will be destructed in random order as you have already deleted them from configuration.
- B. Those would be destroyed in the order in which they were written in the configuration file previously before you have deleted them from configuration file.
- C. Terraform can still determine the correct order for destruction from the state even when you delete one or more items from the configuration.
- D. You can not destroy resources by deleting them from configuration file and running plan and apply.
Answer: C
Explanation:
Terraform typically uses the configuration to determine dependency order. However, when you delete a resource from a Terraform configuration, Terraform must know how to delete that resource. Terraform can see that a mapping exists for a resource not in your configuration and plan to destroy. However, since the configuration no longer exists, the order cannot be determined from the configuration alone.
To ensure correct operation, Terraform retains a copy of the most recent set of dependencies within the state. Now Terraform can still determine the correct order for destruction from the state when you delete one or more items from the configuration.
NEW QUESTION 279
Terraform Cloud is more powerful when you integrate it with your version control system (VCS) provider. Select all the supported VCS providers from the answers below. (select four)
- A. GitHub
- B. Bitbucket Cloud
- C. Azure DevOps Server
- D. CVS Version Control
- E. GitHub Enterprise
Answer: A,B,C,E
Explanation:
Explanation
Terraform Cloud supports the following VCS providers:
- https://www.terraform.io/docs/cloud/vcs/github.html
- https://www.terraform.io/docs/cloud/vcs/github.html
- https://www.terraform.io/docs/cloud/vcs/github-enterprise.html
- https://www.terraform.io/docs/cloud/vcs/gitlab-com.html
- https://www.terraform.io/docs/cloud/vcs/gitlab-eece.html
- https://www.terraform.io/docs/cloud/vcs/bitbucket-cloud.html
- https://www.terraform.io/docs/cloud/vcs/bitbucket-server.html
- https://www.terraform.io/docs/cloud/vcs/azure-devops-server.html
- https://www.terraform.io/docs/cloud/vcs/azure-devops-services.html
https://www.terraform.io/docs/cloud/vcs/index.html#supported-vcs-providers
NEW QUESTION 280
Which of the following is not a valid Terraform string function?
- A. tostring
- B. format
- C. join
- D. replace
Answer: A
Explanation:
Explanation
https://www.terraform.io/docs/configuration/functions/tostring.html
NEW QUESTION 281
True or False? Each Terraform workspace uses its own state file to manage the infrastructure associated with that particular workspace.
- A. True
Explanation
The persistent data stored in the backend belongs to a workspace. Initially, the backend has only one workspace, called "default", and thus there is only one Terraform state associated with that configuration. - B. False
Answer: A
NEW QUESTION 282
......
Download Free Latest Exam TA-002-P Certified Sample Questions: https://www.itcertmagic.com/HashiCorp/real-TA-002-P-exam-prep-dumps.html
TA-002-P Actual Questions - Instant Download 450 Questions: https://drive.google.com/open?id=129q59rY7v0A3PxmdwPVXaiVb7WvFQ6ip