2022年最新のTA-002-P試験解答最新版JPNTest TA-002-PのPDF問題集をダウンロードせよ(384問題と解答)
無料2022年最新のHashiCorp Infrastructure Automation TA-002-P問題集を提供しております!JPNTest
質問 24
What are the benefits of using Infrastructure as Code? (select five)
- A. Infrastructure as Code is easily repeatable, allowing the user to reuse code to deploy similar, yet different resources
- B. Infrastructure as Code allows a user to turn a manual task into a simple, automated deployment (Correct)
- C. Infrastructure as Code provides configuration consistency and standardization among deployments
- D. Infrastructure as Code easily replaces development languages such as Go and .Net for application development
- E. Infrastructure as Code gives the user the ability to recreate an application's infrastructure for disaster recovery scenarios
- F. Infrastructure as Code is relatively simple to learn and write, regardless of a user's prior experience with developing code
正解: A,B,E,F
解説:
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.
質問 25
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. Resources will be created simultaneously
- D. aws_eip will be created first
aws_instance will be created second
正解: A
解説:
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
質問 26
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 init
- B. terraform state
- C. terraform push
- D. terraform refresh
正解: A
質問 27
When using providers that require the retrieval of data, such as the HashiCorp Vault provider, in what phase does Terraform actually retrieve the data required?
- A. terraform init
- B. terraform plan
- C. terraform apply
- D. terraform delete
正解: A
質問 28
Eric needs to make use of module within his terraform code. Should the module always be public and open-source to be able to be used?
- A. False
- B. True
正解: A
解説:
Explanation
Terraform module need not be public and open-source. Module can be placed in -
* Local paths
* Terraform Registry
* GitHub
* Bitbucket
* Generic Git, Mercurial repositories
* HTTP URLs
* S3 buckets
* GCS buckets
https://www.terraform.io/docs/modules/sources.html
質問 29
Terraform can run on Windows or Linux, but it requires a Server version of the Windows operating system.
- A. False
- B. True
正解: B
解説:
Reference: https://cloud.google.com/kubernetes-engine/docs/how-to/creating-a-cluster-windows
質問 30
Valarie has created a database instance in AWS and for ease of use is outputting the value of the database password with the following code. Valarie wants to hide the output value in the CLI after terraform apply that's why she has used sensitive parameter.
1. output "db_password" {
2. value = local.db_password
3. sensitive = true
4. }
Since sensitive is set to true, will the value associated with db password be available in plain-text in the state file for everyone to read?
- A. No
- B. Yes
正解: B
解説:
Outputs can be marked as containing sensitive material by setting the sensitive attribute to true, like this:
output "sensitive" {
sensitive = true
value = VALUE
}
When outputs are displayed on-screen following a terraform apply or terraform refresh, sensitive outputs are redacted, with <sensitive> displayed in place of their value.
Limitations of Sensitive Outputs
The values of sensitive outputs are still stored in the Terraform state, and available using the terraform output command, so cannot be relied on as a sole means of protecting values.
Sensitivity is not tracked internally, so if the output is interpolated in another module into a resource, the value will be displayed.
質問 31
Which Terraform command will check and report errors within modules, attribute names, and value types to make sure they are syntactically valid and internally consistent?
- A. terraform validate
- B. terraform fmt
- C. terraform format
- D. terraform show
正解: A
解説:
The terraform validate command validates the configuration files in a directory, referring only to the configuration and not accessing any remote services such as remote state, provider APIs, etc.
Validate runs checks that verify whether a configuration is syntactically valid and internally consistent, regardless of any provided variables or existing state. It is thus primarily useful for general verification of reusable modules, including the correctness of attribute names and value types.
It is safe to run this command automatically, for example as a post-save check in a text editor or as a test step for a re-usable module in a CI system.
質問 32
You have created 2 workspaces PROD and RQA.
You have switched to RQA and provisioned RQA infrastructure from this workspace. Where is your state file stored?
- A. terraform.tfstate.RQA
- B. terraform.tfstate.d
- C. terraform.tfstate
- D. terraform.d
正解: B
質問 33
Which of the following terraform subcommands could be used to remove the lock on the state for the current configuration?
- A. Removing the lock on a state file is not possible
- B. force-unlock
- C. state-unlock
Explanation
https://www.terraform.io/docs/commands/force-unlock.html - D. Unlock
正解: A
質問 34
Terraform must track metadata such as resource dependencies. Where is this data stored?
- A. workspace
- B. backend
- C. state file
- D. metadata store
正解: C
解説:
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.
https://www.terraform.io/docs/state/purpose.html#metadata
質問 35
What are the benefits of using Infrastructure as Code? (select five)
- A. Infrastructure as Code is easily repeatable, allowing the user to reuse code to deploy similar, yet different resources
- B. Infrastructure as Code allows a user to turn a manual task into a simple, automated deployment (Correct) 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. - C. Infrastructure as Code provides configuration consistency and standardization among deployments
- D. Infrastructure as Code easily replaces development languages such as Go and .Net for application development
- E. Infrastructure as Code gives the user the ability to recreate an application's infrastructure for disaster recovery scenarios
- F. Infrastructure as Code is relatively simple to learn and write, regardless of a user's prior experience with developing code
正解: A,B,E,F
質問 36
Which of the following actions are performed during a terraform init?
- A. Download the declared providers which are supported by HashiCorp
- B. Initializes the backend configuration
- C. Initializes downloaded and/or installed providers
- D. Provisions the declared resources in your configuration
正解: A,B,C
解説:
The terraform init command is used to initialize a working directory containing Terraform configuration files. This is the first command that should be run after writing a new Terraform configuration or cloning an existing one from version control. It is safe to run this command multiple times.
This 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.
terraform init command does -
* Copy a Source Module
* Backend Initialization
* Child Module Installation
* Plugin Installation
https://www.terraform.io/docs/commands/init.html
質問 37
Which task does terraform init not perform?
- A. Sources all providers present in the configuration and ensures they are downloaded and available locally
- B. Connects to the backend
- C. Sources any modules and copies the configuration locally
- D. Validates all required variables are present
正解: D
解説:
Reference: https://www.terraform.io/docs/cli/commands/init.html
質問 38
What Terraform command can be used to inspect the current state file?
- A. terraform state
- B. terraform read
- C. terraform show
- D. terraform inspect
正解: C
質問 39
Which of the following is an invalid variable name?
- A. var1
- B. instance_name
Explanation
https://www.terraform.io/intro/examples/count.html - C. web
- D. count
正解: D
質問 40
lookup retrieves the value of a single element from which of the below data type?
- A. map
- B. list
- C. set
- D. string
正解: A
解説:
Explanation
https://www.terraform.io/docs/configuration/functions/lookup.html
質問 41
Terraform-specific settings and behaviors are declared in which configuration block type?
- A. data
- B. terraform
- C. provider
- D. resource
正解: B
解説:
Explanation
The special terraform configuration block type is used to configure some behaviors of Terraform itself, such as requiring a minimum Terraform version to apply your configuration.
Example
terraform {
required_version = "> 0.12.0"
}
https://www.terraform.io/docs/configuration/terraform.html
質問 42
Multiple providers can be declared within a single Terraform configuration file.
- A. False
- B. True
正解: B
解説:
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"
}
The provider block without alias set is known as the default provider configuration. When alias is set, it creates an additional provider configuration. For providers that have no required configuration arguments, the implied empty configuration is considered to be the default provider configuration.
https://www.terraform.io/docs/configuration/providers.html
質問 43
You should store secret data in the same version control repository as your Terraform configuration.
- A. False
- B. True
正解: A
解説:
Reference: https://blog.gruntwork.io/a-comprehensive-guide-to-managing-secrets-in-your-terraform-code-
1d586955ace1
質問 44
Terraform requires the Go runtime as a prerequisite for installation.
- A. False
- B. True
正解: A
解説:
Reference: https://www.terraform.io/docs/extend/guides/v1-upgrade-guide.html
質問 45
Which task does teraform ini- not perform?
- A. Sources all providers present in the configuration and ensures they are downloaded and available locally
- B. Connects to the backend
- C. Sources any modules and copies the configuration locally
- D. Validates all required variables are present
正解: D
質問 46
Provisioners should only be used as a last resort.
- A. False
- B. True
正解: B
解説:
Provisioners are a Last Resort
Terraform includes the concept of provisioners as a measure of pragmatism, knowing that there will always be certain behaviors that can't be directly represented in Terraform's declarative model.
However, they also add a considerable amount of complexity and uncertainty to Terraform usage. Firstly, Terraform cannot model the actions of provisioners as part of a plan because they can in principle take any action. Secondly, successful use of provisioners requires coordinating many more details than Terraform usage usually requires: direct network access to your servers, issuing Terraform credentials to log in, making sure that all of the necessary external software is installed, etc.
The following sections describe some situations which can be solved with provisioners in principle, but where better solutions are also available. We do not recommend using provisioners for any of the use-cases described in the following sections.
Even if your specific use-case is not described in the following sections, we still recommend attempting to solve it using other techniques first, and use provisioners only if there is no other option.
https://www.terraform.io/docs/provisioners/index.html
質問 47
When should you use the force-unlock command?
- A. You have a high priority change
- B. Automatic unlocking failed
- C. Your apply failed due to a state lock
- D. You see a status message that you cannot acquire the lock
正解: B
解説:
Manually unlock the state for the defined configuration.
質問 48
......
TA-002-P試験解答問題集:https://www.jpntest.com/shiken/TA-002-P-mondaishu(384問題と解答)
無料2022年最新のHashiCorp Infrastructure Automation TA-002-P問題集を提供しております!JPNTest:https://drive.google.com/open?id=1nCNJ75NV6dSZMp5wYmqnsBS8Y02R_v_Z