
[2022年01月]更新のTA-002-P問題集PDFでTA-002-Pリアル試験問題解答
TA-002-P問題集で100%合格保証と最新のお試しサンプル
質問 68
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. Repositories
- B. Backends
- C. Workspaces
- D. Environment Variables
正解: C
解説:
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
質問 69
What is the default backend for Terraform?
- A. consul
- B. etcd
- C. local
- D. gcs
正解: C
解説:
By default, Terraform uses the "local" backend, which is the normal behavior of Terraform you're used to.
https://www.terraform.io/docs/backends/index.html
質問 70
If a module uses a local variable, you can expose that value with a terraform output.
- A. True
- B. False
正解: A
解説:
Output values are like function return values.
質問 71
Which two steps are required to provision new infrastructure in the Terraform workflow? (Choose two.)
- A. Destroy
- B. Init
- C. Import
- D. Apply
- E. Validate
正解: B,D
解説:
Reference: https://www.terraform.io/guides/core-workflow.html
質問 72
What is the result of the following terraform function call?
- A. goodbye
Explanation
https://www.terraform.io/docs/configuration/functions/lookup.html - B. what?
- C. hello
正解: B
質問 73
Which of the following state management command allow you to retrieve a list of resources that are part of the state file?
- A. terraform state list
- B. terraform state view
- C. terraform list
- D. terraform view
正解: A
解説:
The terraform state list command is used to list resources within a Terraform state.
Usage: terraform state list [options] [address...]
The command will list all resources in the state file matching the given addresses (if any). If no addresses are given, all resources are listed.
https://www.terraform.io/docs/commands/state/list.html
質問 74
Which of the below datatype is not supported by Terraform.
- A. Array
- B. List
- C. Object
- D. Map
正解: A
質問 75
Select all features which are exclusive to Terraform Enterprise. (Select Three)
- A. SAML/SSO
- B. Clustering
- C. Sentinel
- D. Audit Logs
- E. Cost Estimation
正解: A,B,D
解説:
Sentinel and Cost Estimation are also available in Terraform Cloud
https://www.hashicorp.com/products/terraform/pricing/
質問 76
Multiple configurations for the same provider can be used in a single configuration file.
- A. True
- B. False
正解: A
解説:
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#alias-multiple-provider-instances
質問 77
Refer to the following terraform variable definition
variable "track_tag" { type = list default = ["data_ec2","integration_ec2","digital_ec2"]} track_tag = { Name = element(var.track_tag,count.index)} If count.index is set to 2, which of the following values will be assigned to the name attribute of track_tag variable?
- A. data_ec2
- B. digital_ec2
- C. track_tag
- D. integration_ec2
正解: B
質問 78
Which of the below terraform commands do not run terraform refresh implicitly before taking actual action of the command?
- A. terraform plan
- B. terraform apply
- C. terraform init
- D. terraform destroy
- E. terraform import
正解: C,E
解説:
https://www.terraform.io/docs/commands/refresh.html
質問 79
You can migrate the Terraform backend but only if there are no resources currently being managed.
- A. True
- B. False
正解: B
解説:
Explanation
If you need to migrate to another backend, such as Terraform Cloud, so you can continue managing it. By migrating your Terraform state, you can hand off infrastructure without de-provisioning anything.
https://www.terraform.io/docs/cloud/migrate/index.html
質問 80
Terraform requires the Go runtime as a prerequisite for installation.
- A. True
- B. False
正解: B
解説:
Reference: https://www.terraform.io/docs/extend/guides/v1-upgrade-guide.html
質問 81
Mary has created a database instance in AWS and for ease of use is outputting the value of the database password with the following code:
1. output "db_password"
2. {
3. value = local.db_password
4. }
Mary wants to hide the output value in the CLI after terraform apply? What is the best way?
- A. Use cryptographic hash
- B. Use sensitive parameter
- C. Use secure parameter
- D. Encrypt the value using encrypt() function
正解: B
質問 82
When multiple engineers start deploying infrastructure using the same state file, what is a feature of remote state storage that is critical to ensure the state doesn't become corrupt?
- A. State Locking
- B. Encryption
- C. WorkSpaces
- D. Object Storage
正解: A
解説:
Explanation
If supported by your backend, Terraform will lock your state for all operations that could write state. This prevents others from acquiring the lock and potentially corrupting your state.
State locking happens automatically on all operations that could write state. You won't see any message that it is happening. If state locking fails, Terraform will not continue. You can disable state locking for most commands with the -lock flag but it is not recommended.
If acquiring the lock is taking longer than expected, Terraform will output a status message. If Terraform doesn't output a message, state locking is still occurring if your backend supports it.
Not all backends support locking. Please view the list of backend types for details on whether a backend supports locking or not.
https://www.terraform.io/docs/state/locking.html
質問 83
Which of the following is the correct way to pass the value in the variable num_servers into a module with the input servers?
- A. servers = variable.num_servers
- B. servers = var(num_servers)
- C. servers = num_servers
- D. servers = var.num_servers
正解: C
質問 84
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. Manually apply two spaces indentation and align equal sign "=" characters in every Terraform file (*.tf)
- B. Run the terraform fmt command during the code linting phase of your CI/CD process
- 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
正解: A
解説:
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
質問 85
The current implementation of Terraform import can only import resources into the state. It does not generate configuration.
- A. True
- B. False
正解: A
解説:
The current implementation of Terraform import can only import resources into the state. It does not generate configuration. A future version of Terraform will also generate configuration.
Because of this, prior to running terraform import it is necessary to write manually a resource configuration block for the resource, to which the imported object will be mapped.
While this may seem tedious, it still gives Terraform users an avenue for importing existing resources.
https://www.terraform.io/docs/import/index.html#currently-state-only
質問 86
State is a requirement for Terraform to function
- A. True
- B. False
正解: A
解説:
Explanation
State is a necessary requirement for Terraform to function. It is often asked if it is possible for Terraform to work without state, or for Terraform to not use state and just inspect cloud resources on every run.
Purpose of Terraform State
State is a necessary requirement for Terraform to function. It is often asked if it is possible for Terraform to work without state, or for Terraform to not use state and just inspect cloud resources on every run. This page will help explain why Terraform state is required.
As you'll see from the reasons below, state is required. And in the scenarios where Terraform may be able to get away without state, doing so would require shifting massive amounts of complexity from one place (state) to another place (the replacement concept).
1. Mapping to the Real World
Terraform requires some sort of database to map Terraform config to the real world. When you have a resource resource "aws_instance" "foo" in your configuration, Terraform uses this map to know that instance i- abcd1234 is represented by that resource.
For some providers like AWS, Terraform could theoretically use something like AWS tags. Early prototypes of Terraform actually had no state files and used this method. However, we quickly ran into problems. The first major issue was a simple one: not all resources support tags, and not all cloud providers support tags.
Therefore, for mapping configuration to resources in the real world, Terraform uses its own state structure.
2. Metadata
Alongside the mappings between resources and remote objects, Terraform must also track metadata such as resource dependencies.
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.
One way to avoid this would be for Terraform to know a required ordering between resource types. For example, Terraform could know that servers must be deleted before the subnets they are a part of. The complexity for this approach quickly explodes, however: in addition to Terraform having to understand the ordering semantics of every resource for every cloud, Terraform must also understand the ordering across providers.
Terraform also stores other metadata for similar reasons, such as a pointer to the provider configuration that was most recently used with the resource in situations where multiple aliased providers are present.
3. Performance
In addition to basic mapping, Terraform stores a cache of the attribute values for all resources in the state. This is the most optional feature of Terraform state and is done only as a performance improvement.
When running a terraform plan, Terraform must know the current state of resources in order to effectively determine the changes that it needs to make to reach your desired configuration.
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.
4. Syncing
In the default configuration, Terraform stores the state in a file in the current working directory where Terraform was run. This is okay for getting started, but 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.
Remote state is the recommended solution to this problem. With a fully-featured state backend, Terraform can use remote locking as a measure to avoid two or more different users accidentally running Terraform at the same time, and thus ensure that each Terraform run begins with the most recent updated state.
質問 87
When you initialize Terraform, where does it cache modules from the public Terraform Module Registry?
- A. In memory
- B. On disk in the /tmp directory
- C. They are not cached
- D. On disk in the .terraform sub-directory
正解: D
質問 88
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.0
- B. 1.1.8
- C. 1.1.1
- D. 1.2.9
正解: B,C
解説:
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
質問 89
Which two steps are required to provision new infrastructure in the Terraform workflow? (Choose two.)
- A. Destroy
- B. Init
- C. Import
- D. Apply
- E. Validate
正解: B,D
質問 90
If you enable TF_LOG = DEBUG, the log will be stored in syslog.log file in the currect directory.
- A. True
- B. False
正解: B
解説:
https://www.terraform.io/docs/internals/debugging.html
質問 91
The Terraform language does not support user-defined functions, and so only the functions built in to the language are available for use.
- A. True
- B. False
正解: A
解説:
https://www.terraform.io/docs/configuration/functions.html
質問 92
......
問題集でリアルHashiCorp TA-002-P試験問題 [更新されたのは2022年]:https://jp.fast2test.com/TA-002-P-premium-file.html