[2023年04月16日] 最新リアルTA-002-P試験問題集解答
あなたを簡単に合格させるTA-002-P試験問と正確なHashiCorp Certified: Terraform AssociatePDF問題
HashiCorp TA-002-P試験は、Terraformを使用して専門知識を示し、HashiCorp認定:Terraformアソシエイトとして認定を受けるための優れた機会です。この認定により、個人は自分のキャリアの見通しを向上させ、Terraformを使用してインフラストラクチャを管理するスキルを認められることができます。
質問 # 117
You have created a custom variable definition file my_vars.tfvars. How will you use it for provisioning infrastructure?
- A. terraform plan -var-file="my_vars.tfvar"
- B. terraform apply -var-state-file ="my_vars.tfvars"
- C. terraform apply -var-file="my_vars.tfvars"
- D. terraform apply var-file="my_vars.tfvars"
正解:C
解説:
Explanation
To set lots of variables, it is more convenient to specify their values in a variable definitions file (with a filename ending in either .tfvars or .tfvars.json) and then specify that file on the command line with -var-file:
terraform apply -var-file="my_vars.tfvars"
https://www.terraform.io/docs/configuration/variables.html#variable-definitions-tfvars-files
質問 # 118
Which task does terraform init not perform?
- A. Sources all providers present in the configuration and ensures they are downloaded and available locally
- B. Validates all required variables are present
- C. Sources any modules and copies the configuration locally
- D. Connects to the backend
正解:B
解説:
Reference: https://www.terraform.io/docs/cli/commands/init.html
質問 # 119
terraform validate validate validates that your infrastructure matches the Terraform state file.
- A. True
- B. False
正解:B
質問 # 120
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. Tell the CIO that this is not possible . Resources created in CloudFormation , and AzureRM templates cannot be tracked using terraform.
- 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. 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.
- D. Use terraform import command to import each resource one by one .
正解:D
質問 # 121
A provider configuration block is required in every Terraform configuration.
Example:
- A. True
- B. False
正解:A
解説:
Reference: https://github.com/hashicorp/terraform/issues/17928
質問 # 122
Select all features which are exclusive to Terraform Enterprise. (Select Three)
- A. SAML/SSO
- B. Cost Estimation
- C. Sentinel
- D. Clustering
- E. Audit Logs
正解:A、D、E
解説:
Explanation
Sentinel and Cost Estimation are also available in Terraform Cloud
https://www.hashicorp.com/products/terraform/pricing/
質問 # 123
Which of the following is an invalid variable name?
- A. count
- B. web
- C. var1
- D. instance_name
正解:A
解説:
https://www.terraform.io/intro/examples/count.html
質問 # 124
True or False? When using the Terraform provider for Vault, the tight integration between these HashiCorp tools provides the ability to mask secrets in the terraform plan and state files.
- A. True
- B. False
正解:B
解説:
Explanation
Currently, Terraform has no mechanism to redact or protect secrets that are returned via data sources, so secrets read via this provider will be persisted into the Terraform state, into any plan files, and in some cases in the console output produced while planning and applying. These artifacts must, therefore, all be protected accordingly.
質問 # 125
By default, provisioners that fail will also cause the Terraform apply itself to error. How can you change this default behavior within a provisioner?
- A. provisioner "local-exec" { on_failure = "continue" }
- B. provisioner "local-exec" { on_failure = continue }
- C. provisioner "local-exec" { on_failure = "next" }
- D. provisioner "local-exec" { when = "failure" terraform apply }
正解:A
解説:
https://www.terraform.io/docs/provisioners/index.html
質問 # 126
You have declared a variable called var.list which is a list of objects that all have an attribute id.
Which options will produce a list of the IDs? (Choose two.)
- A. { for o in var.list : o => o.id }
- B. [ var.list[*].id ]
- C. var.list[*].id
- D. [ for o in var.list : o.id ]
正解:C、D
解説:
Explanation
https://www.terraform.io/language/expressions/splat
A splat expression provides a more concise way to express a common operation that could otherwise be
performed with a for expression.
質問 # 127
Which of the following is not a benefit of adopting infrastructure as code?
- A. Interpolation
- B. Versioning
- C. Reusability of code
- D. Automation
正解:A
質問 # 128
Named workspaces are not a suitable isolation mechanism for strong separation between staging and production?
- A. True
- B. False
正解:A
解説:
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#when-to-use-multiple-workspaces
質問 # 129
What does the default "local" Terraform backend store?
- A. Terraform binary
- B. State file
- C. tfplan files
- D. Provider plugins
正解:B
解説:
The local backend stores state on the local filesystem, locks that state using system APIs, and performs operations locally.
質問 # 130
Which of the following Terraform commands will automatically refresh the state unless supplied with
additional flags or arguments? Choose TWO correct answers.
- A. terraform validate
- B. terraform output
- C. terraform plan
- D. terraform state
- E. terraform apply
正解:C、E
質問 # 131
Which one is the right way to import a local module names consul?
- A. module "consul" { source = "consul"}
- B. module "consul" { source = "./consul"}
- C. module "consul" { source = "module/consul"}
- D. module "consul" { source = "../consul"}
正解:B、D
解説:
Explanation
A local path must begin with either ./ or ../ to indicate that a local path is intended, to distinguish from a
module registry address.
module "consul" {
source = "./consul"
}
質問 # 132
Terraform can run on Windows or Linux, but it requires a Server version of the Windows operating system.
- A. True
- B. False
正解:B
解説:
Explanation
https://www.terraform.io/downloads
質問 # 133
You need to constrain the GitHub provider to version 2.1 or greater.
Which of the following should you put into the Terraform 0.12 configuration's provider block?
- A. version ~> 2.1
- B. version = ">= 2.1"
- C. version = "<= 2.1"
- D. version >= 2.1
正解:B
解説:
Explanation
version = ">= 1.2.0, < 2.0.0"
A version constraint is a string literal containing one or more conditions, which are separated by commas.
Each condition consists of an operator and a version number.
Version numbers should be a series of numbers separated by periods (like 1.2.0), optionally with a suffix to
indicate a beta release.
The following operators are valid:
= (or no operator): Allows only one exact version number. Cannot be combined with other conditions.
!=: Excludes an exact version number.
>, >=, <, <=: Comparisons against a specified version, allowing versions for which the comparison is true.
"Greater-than" requests newer versions, and "less-than" requests older versions.
~>: Allows only the rightmost version component to increment. For example, to allow new patch releases
within a specific minor release, use the full version number: ~> 1.0.4 will allow installation of 1.0.5 and 1.0.10
but not 1.1.0. This is usually called the pessimistic constraint operator.
https://www.terraform.io/language/expressions/version-constraints
質問 # 134
Which of the following statements about local modules is incorrect:
- A. Local modules are not cached by terraform init command
- B. Local modules support versions
- C. None of the above (all statements above are correct)
- D. Local modules are sourced from a directory on disk
- E. All of the above (all statements above are incorrect
正解:B
解説:
Explanation
Version constraints are supported only for modules installed from a module registry, such as the public
Terraform Registry or Terraform Cloud's private module registry. Other module sources can provide their own
versioning mechanisms within the source string itself, or might not support versions at all. In particular,
modules sourced from local file paths do not support version; since they're loaded from the same source
repository, they always share the same version as their caller.
https://www.terraform.io/language/modules/syntax
質問 # 135
All modules published on the official Terraform Module Registry have been verified by HashiCorp.
- A. True
- B. False
正解:A
質問 # 136
Which of the following is not a valid string function in Terraform?
- A. slice
- B. join
- C. split
- D. chomp
正解:D
質問 # 137
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
正解:A
解説:
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
質問 # 138
Your DevOps team is currently using the local backend for your Terraform configuration. You would like to
move to a remote backend to begin storing the state file in a central location.
Which of the following backends would not work?
- A. Git
- B. Artifactory
- C. Amazon S3
- D. Terraform Cloud
正解:A
解説:
Explanation
https://www.terraform.io/cdktf/concepts/remote-backends
https://docs.gitlab.com/ee/user/infrastructure/iac/terraform_state.html
質問 # 139
In terraform, most resource dependencies are handled automatically. Which of the following statements describes best how terraform resource dependencies are handled?
- A. Terraform analyses any expressions within a resource block to find references to other objects, and treats those references as implicit ordering requirements when creating, updating, or destroying resources.
Explanation
https://www.terraform.io/docs/configuration/resources.html - B. Resource dependencies are handled automatically by the depends_on meta_argument, which is set to true by default.
- C. Resource dependencies are identified and maintained in a file called resource.dependencies. Each terraform provider is required to maintain a list of all resource dependencies for the provider and it's included with the plugin during initialization when terraform init is executed. The file is located in the terraform.d folder.
- D. The terraform binary contains a built-in reference map of all defined Terraform resource dependencies. Updates to this dependency map are reflected in terraform versions. To ensure you are working with the latest resource dependency map you much be running the latest version of Terraform.
正解:A
質問 # 140
Hanah is writing a terraform configuration with nested modules, there are multiple places where she has to use
the same conditional expression but she wants to avoid repeating the same values or expressions multiple
times in the configuration,. What is a better approach to dealing with this?
- A. Functions
- B. Expressions
- C. Local Values
- D. Variables
正解:C
解説:
Explanation
https://www.terraform.io/docs/configuration/locals.html
質問 # 141
Which Terraform command will force a marked resource to be destroyed and recreated on the next apply?
- A. terraform destroy
- B. terraform taint
- C. terraform fmt
- D. terraform refresh
正解:B
解説:
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.
https://www.terraform.io/docs/commands/taint.html
質問 # 142
......
試験は、Terraformに関連するさまざまなトピックをカバーしており、Terraform構成ファイルのコアコンセプト、構文、および最良の書き方について説明します。また、モジュールの使用、状態管理、およびリモートバックエンドの使用もカバーしています。さらに、試験では、AWS、Azure、およびGoogle Cloud Platformなどのクラウドプラットフォーム上でインフラストラクチャを管理するためにTerraformを使用する知識も評価されます。
TA-002-P認証試験問題集の解答を提供しています:https://drive.google.com/open?id=192LkRgZwdoZigT3jKwQjNCFjQyFOXx9S
更新されたTA-002-P試験練習テスト問題:https://www.goshiken.com/HashiCorp/TA-002-P-mondaishu.html