HashiCorp Terraform-Associate-003練習テストPDF試験材料
Terraform-Associate-003解答Terraform-Associate-003無料サンプルには全てリアル試験合格させます
HashiCorp Terraform-Associate-003 認定試験の出題範囲:
| トピック | 出題範囲 |
|---|---|
| トピック 1 |
|
| トピック 2 |
|
| トピック 3 |
|
質問 # 34
You are working on some new application features and you want to spin up a copy of your production deployment to perform some quick tests. In order to avoid having to configure a new state backend, what open source Terraform feature would allow you create multiple states but still be associated with your current code?
- A. Terraform modules
- B. None of the above
- C. Terraform local values
- D. Terraform workspaces
- E. Terraform data sources
正解:D
解説:
Terraform workspaces allow you to create multiple states but still be associated with your current code. Workspaces are like "environments" (e.g. staging, production) for the same configuration. You can use workspaces to spin up a copy of your production deployment for testing purposes without having to configure a new state backend. Terraform data sources, local values, and modules are not features that allow you to create multiple states. Reference = Workspaces and How to Use Terraform Workspaces
質問 # 35
When using Terraform to deploy resources into Azure, which scenarios are true regarding state files? (Choose two.)
- A. Changing resources via the Azure Cloud Console does not update current state file
- B. When you change a resource via the Azure Cloud Console, Terraform records the changes in a new state file
- C. When you change a Terraform-managed resource via the Azure Cloud Console, Terraform updates the state file to reflect the change during the next plan or apply
- D. Changing resources via the Azure Cloud Console records the change in the current state file
正解:A、C
解説:
Terraform state is a representation of the infrastructure that Terraform manages. Terraform uses state to track the current status of the resources it creates and to plan future changes. However, Terraform state is not aware of any changes made to the resources outside of Terraform, such as through the Azure Cloud Console, the Azure CLI, or the Azure API. Therefore, changing resources via the Azure Cloud Console does not update the current state file, and it may cause inconsistencies or conflicts with Terraform's desired configuration. To avoid this, it is recommended to manage resources exclusively through Terraform or to use the terraform import command to bring existing resources under Terraform's control.
When you change a Terraform-managed resource via the Azure Cloud Console, Terraform does not immediately update the state file to reflect the change. However, the next time you run terraform plan or terraform apply, Terraform will compare the state file with the actual state of the resources in Azure and detect any drifts or differences. Terraform will then update the state file to match the current state of the resources and show you the proposed changes in the execution plan. Depending on the configuration and the change, Terraform may try to undo the change, modify the resource further, or recreate the resource entirely. To avoid unexpected or destructive changes, it is recommended to review the execution plan carefully before applying it or to use the terraform refresh command to update the state file without applying any changes.
References = Purpose of Terraform State, Terraform State, Managing State, Importing Infrastructure, [Command: plan], [Command: apply], [Command: refresh]
質問 # 36
You ate creating a Terraform configuration which needs to make use of multiple providers, one for AWS and one for Datadog. Which of the following provider blocks would allow you to do this?
- A.

- B.

- C.

- D.

正解:D
解説:
Explanation
Option C is the correct way to configure multiple providers in a Terraform configuration. Each provider block must have a name attribute that specifies which provider it configures2. The other options are either missing the name attribute or using an invalid syntax.
質問 # 37
Select the command that doesn't cause Terraform to refresh its state.
- A. Terraform plan
- B. Terraform destroy
- C. Terraform apply
- D. Terraform state list
正解:D
質問 # 38
How would you reference the volume IDs associated with the ebs_block_device blocks in this configuration?
- A. aws_lnstance.example.ebs_block_device.[*].volume_id
- B. aws_lnstance.example.ebs_block_device.volume_ids
- C. aws_instance.example-ebs_block_device.*.volume_id
- D. aws_instance.example.ebs_block_device[sda2,sda3).volume_id
正解:C
解説:
This is the correct way to reference the volume IDs associated with the ebs_block_device blocks in this configuration, using the splat expression syntax. The other options are either invalid or incomplete.
質問 # 39
You want to use API tokens and other secrets within your team's Terraform workspaces. Where does HashiCorp recommend you store these sensitive values? (Pick the 3 correct responses)
- A. In HashiCorp Vault.
- B. In a plaintext document on a shared drive.
- C. In a terraform.tfvars file, securely managed and shared with your team.
- D. In a terraform.tfvars file, checked into your version control system.
- E. In an HCP Terraform/Terraform Cloud variable, with the sensitive option checked.
正解:A、C、E
解説:
Sensitive values such as API tokens should be stored in a secure way, either in Terraform Cloud variables marked as sensitive or in HashiCorp Vault. Storing secrets in version control systems or plaintext files is not recommended.
References:
Terraform Cloud Environment Variables
質問 # 40
What is the name of the default file where Terraform stores the state?
Type your answer in the field provided. The text field is not case-sensitive and all variations of the correct answer are accepted.
正解:
解説:
Terraform.tfstate
Explanation:
The name of the default file where Terraform stores the state is terraform.tfstate. This file contains a JSON representation of the current state of the infrastructure managed by Terraform. Terraform uses this file to track the metadata and attributes of the resources, and to plan and apply changes. By default, Terraform stores the state file locally in the same directory as the configuration files, but it can also be configured to store the state remotely in a backend.
References = [Terraform State], [State File Format]
質問 # 41
How does Terraform manage most dependencies between resources?
- A. Using the depends_on parameter
- B. The order that resources appear in Terraform configuration indicates dependencies
- C. By defining dependencies as modules and including them in a particular order
- D. Terraform will automatically manage most resource dependencies
正解:D
解説:
Explanation
This is how Terraform manages most dependencies between resources, by using the references between them in the configuration files. For example, if resource A depends on resource B, Terraform will create resource B first and then pass its attributes to resource A.
質問 # 42
Terraform providers are always installed from the Internet.
- A. False
- B. True
正解:A
解説:
Explanation
Terraform providers are not always installed from the Internet. There are other ways to install provider plugins, such as from a local mirror or cache, from a local filesystem directory, or from a network filesystem.
These methods can be useful for offline or air-gapped environments, or for customizing the installation process. You can configure the provider installation methods using the provider_installation block in the CLI configuration file.
質問 # 43
terraform validate reports syntax check errors for which of the following?
- A. There is a missing value for a variable
- B. Code contains tabs for indentation instead of spaces
- C. The state file does not match the current infrastructure
- D. None of the above
正解:D
解説:
Theterraform validatecommand is used to check for syntax errors and internal consistency within Terraform configurations, such as whether all required arguments are specified. It does not check for indentation styles, missing variable values (as variables might not be defined at validation time), or state file consistency with the current infrastructure. Therefore, none of the provided options are correct in the context of whatterraform validatereports.References= Terraform's official documentation details the purpose and function of the terraform validatecommand, specifying that it focuses on syntax and consistency checks within Terraform configurations themselves, not on external factors like the state file or infrastructure state. Direct references from the HashiCorp Terraform Associate (003) study materials to this specific detail were not found in the provided files.
質問 # 44
Which option cannot be used to keep secrets out of Terraform configuration files?
- A. Environment variables
- B. A Terraform provider
- C. secure string
- D. A -var flag
正解:C
解説:
A secure string is not a valid option to keep secrets out of Terraform configuration files. A secure string is a feature of AWS Systems Manager Parameter Store that allows you to store sensitive data encrypted with a KMS key. However, Terraform does not support secure strings natively and requires a custom data source to retrieve them. The other options are valid ways to keep secrets out of Terraform configuration files. A Terraform provider can expose secrets as data sources that can be referenced in the configuration. Environment variables can be used to set values for input variables that contain secrets. A -var flag can be used to pass values for input variables that contain secrets from the command line or a file.
References = [AWS Systems Manager Parameter Store], [Terraform AWS Provider Issue #55], [Terraform Providers], [Terraform Input Variables]
質問 # 45
Why does this backend configuration not follow best practices?
- A. You should not store credentials in Terraform configuration
- B. You should use the local enhanced storage backend whenever possible
- C. An alias meta-argument should be included in backend blocks whenever possible
- D. The backend configuration should contain multiple credentials so that more than one user can execute terraform plan and terraform apply
正解:A
解説:
This is a bad practice, as it exposes your credentials to anyone who can access your configuration files or state files. You should use environment variables, credential files, or other mechanisms to provide credentials to Terraform.
質問 # 46
Where can Terraform not load a provider from?
- A. Official HashCrop Distribution on releases.hashcrop.com
- B. Plugins directory
- C. Source code
- D. Provider plugin chance
正解:C
解説:
This is where Terraform cannot load a provider from, as it requires a compiled binary file that implements the provider protocol. You can load a provider from a plugins directory, a provider plugin cache, or the official HashiCorp distribution on releases.hashicorp.com.
質問 # 47
When should you run terraform init?
- A. Before you start coding a new Terraform project
- B. Every time you run terraform apply
- C. After you run terraform plan for the time in a new terraform project and before you run terraform apply
- D. After you start coding a new terraform project and before you run terraform plan for the first time.
正解:D
解説:
Explanation
You should run terraform init after you start coding a new Terraform project and before you run terraform plan for the first time. This command will initialize the working directory by downloading the required providers and modules, creating the initial state file, and performing other necessary tasks. References = :
Initialize a Terraform Project
質問 # 48
Module version is required to reference a module on the Terraform Module Registry.
- A. False
- B. True
正解:A
解説:
Explanation
Module version is optional to reference a module on the Terraform Module Registry. If you omit the version constraint, Terraform will automatically use the latest available version of the module
質問 # 49
Define the purpose of state in Terraform.
- A. State stores variables and lets you quickly reuse existing code
- B. State lets you enforce resource configurations that relate to compliance policies
- C. State maps real world resources to your configuration and keeps track of metadata
- D. State codifies the dependencies of related resources
正解:C
解説:
The purpose of state in Terraform is to keep track of the real-world resources managed by Terraform, mapping them to the configuration. The state file contains metadata about these resources, such as resource IDs and other important attributes, which Terraform uses to plan and manage infrastructure changes. The state enables Terraform to know what resources are managed by which configurations and helps in maintaining the desired state of the infrastructure.References= This role of state in Terraform is outlined in Terraform's official documentation,emphasizing its function in mapping configuration to real-world resources and storing vital metadata .
質問 # 50
What is the workflow for deploying new infrastructure with Terraform?
- A. Write Terraform configuration, run terraform apply to create infrastructure, use terraform validate to confirm Terraform deployed resources correctly
- B. Write Terraform configuration, run terraform show to view proposed changes, and terraform apply to create new infrastructure
- C. Write Terraform configuration, run terraform init to initialize the working directory or workspace, and run terraform apply
- D. Write Terraform configuration, run terraform plan to initialize the working directory or workspace, and terraform apply to create the infrastructure
正解:C
解説:
Explanation
This is the workflow for deploying new infrastructure with Terraform, as it will create a plan and apply it to the target environment. The other options are either incorrect or incomplete.
質問 # 51
Which are examples of infrastructure as code? Choose two correct answers.
- A. Doctor files
- B. Cloned virtual machine images
- C. Change management database records
- D. Versioned configuration files
正解:D
解説:
These are examples of infrastructure as code (IaC), which is a practice of managing and provisioning infrastructure through machine-readable definition files, rather than physical hardware configuration or interactive configuration tools.
質問 # 52
You have provisioned some virtual machines (VMs) on Google Cloud Platform (GCP) using the gcloud command line tool. However, you are standardizing with Terraform and want to manage these VMs using Terraform instead. What are the two things you must do to achieve this? Choose two correct answers.
- A. Provision new VMs using Terraform with the same VM names
- B. Run the terraform Import-gcp command
- C. Write Terraform configuration for the existing VMs
- D. Use the terraform import command for the existing VMs
正解:C、D
解説:
To import existing resources into Terraform, you need to do two things1:
Write a resource configuration block for each resource, matching the type and name used in your state file.
Run terraform import for each resource, specifying its address and ID. There is no such command as terraform Import-gcp, and provisioning new VMs with the same names will not import them into Terraform.
質問 # 53
You have used Terraform lo create an ephemeral development environment in the (loud and are now ready to destroy all the Infrastructure described by your Terraform configuration To be safe, you would like to first see all the infrastructure that Terraform will delete.
Which command should you use to show all of the resources that mil be deleted? Choose two correct answers.
- A. Run terraform destroy and it will first output all the resource that will be deleted before prompting for approval
- B. Run terraform plan .destory
- C. Run terraform state rm '
- D. Run terraform show :destroy
正解:A、B
解説:
To see all the resources that Terraform will delete, you can use either of these two commands:
terraform destroy will show the plan of destruction and ask for your confirmation before proceeding. You can cancel the command if you do not want to destroy the resources.
terraform plan -destroy will show the plan of destruction without asking for confirmation. You can use this command to review the changes before running terraform destroy.
References = : Destroy Infrastructure : Plan Command: Options
質問 # 54
The Terraform binary version and provider versions must match each other in a single configuration.
- A. False
- B. True
正解:A
解説:
The Terraform binary version and provider versions do not have to match each other in a single configuration.
Terraform allows you to specify provider version constraints in the configuration's terraform block, which can be different from the Terraform binary version1. Terraform will use the newest version of the provider that meets the configuration's version constraints2. You can also use the dependency lock file to ensure Terraform is using the correct provider version3. References =
*1: Providers - Configuration Language | Terraform | HashiCorp Developer
*2: Multiple provider versions with Terraform - Stack Overflow
*3: Lock and upgrade provider versions | Terraform - HashiCorp Developer
質問 # 55
How can terraform plan aid in the development process?
- A. Reconciles Terraform's state against deployed resources and permanently modifies state using the current status of deployed resources
- B. Formats your Terraform configuration files
- C. Validates your expectations against the execution plan without permanently modifying state
- D. Initializes your working directory containing your Terraform configuration files
正解:C
解説:
The terraform plan command is used to create an execution plan. It allows you to see what actions Terraform will take to reach the desired state defined in your configuration files. It evaluates the current state and configuration, showing a detailed outline of the resources that will be created, updated, or destroyed. This is a critical step in the development process as it helps you verify that the changes you are about to apply will perform as expected, without actually modifying any state or infrastructure.
References:
Terraform documentation on terraform plan: Terraform Plan
質問 # 56
......
Terraform-Associate-003[2025年04月] 最新リリース] 試験問題あなたを必ず合格させます:https://www.goshiken.com/HashiCorp/Terraform-Associate-003-mondaishu.html
HashiCorp Terraform-Associate-003試験の基礎問題と解答:https://drive.google.com/open?id=1kn2KJOGk-rWJqNI2lQz1TFh5TeHthJVw