[Mar 08, 2024] HashiCorp Terraform-Associate-003 Real Exam Questions and Answers FREE
Pass HashiCorp Terraform-Associate-003 Exam Info and Free Practice Test
NEW QUESTION # 81
You are using a networking module in your Terraform configuration with the name label my-network. In your main configuration you have the following code:
When you run terraform validate, you get the following error:
What must you do to successfully retrieve this value from your networking module?
- A. Define the attribute vnet_id as an output in the networking module
- B. Change the reference value to my-network,outputs,vmet_id
- C. Change the reference value module.my,network,outputs,vnet_id
- D. Define the attribute vmet_id as a variable in the networking modeule
Answer: A
Explanation:
Explanation
This is what you must do to successfully retrieve this value from your networking module, as it will expose the attribute as an output value that can be referenced by other modules or resources. The error message indicates that the networking module does not have an output value named vnet_id, which causes the reference to fail.
NEW QUESTION # 82
The_________determines how Terraform creates, updates, or delete resources.
- A. Terraform core
- B. Terraform provider
- C. Terraform provisioner
- D. Terraform configuration
Answer: B
Explanation:
Explanation
This is what determines how Terraform creates, updates, or deletes resources, as it is responsible for understanding API interactions with some service and exposing resources and data sources based on that API.
NEW QUESTION # 83
Which two steps are required to provision new infrastructure in the Terraform workflow? Choose two correct answers.
- A. Init
- B. Import
- C. Plan
- D. apply
- E. Alidate
Answer: A,D
Explanation:
Explanation
The two steps that are required to provision new infrastructure in the Terraform workflow are init and apply.
The terraform init command initializes a working directory containing Terraform configuration files. It downloads and installs the provider plugins that are needed for the configuration, and prepares the backend for storing the state. The terraform apply command applies the changes required to reach the desired state of the configuration, as described by the resource definitions in the configuration files. It shows a plan of the proposed changes and asks for confirmation before making any changes to the infrastructure. References =
[The Core Terraform Workflow], [Initialize a Terraform working directory with init], [Apply Terraform Configuration with apply]
NEW QUESTION # 84
A developer on your team is going lo leaf down an existing deployment managed by Terraform and deploy a new one. However, there is a server resource named aws instant.ubuntu[l] they would like to keep. What command should they use to tell Terraform to stop managing that specific resource?
- A. Terraform state rm:aws_instance.ubuntu[1]
- B. Terraform apply rm:aws_instance.ubuntu[1]
- C. Terraform destory rm:aws_instance.ubuntu[1]
- D. Terraform plan rm:aws_instance.ubuntu[1]
Answer: A
Explanation:
Explanation
To tell Terraform to stop managing a specific resource without destroying it, you can use the terraform state rm command. This command will remove the resource from the Terraform state, which means that Terraform will no longer track or update the corresponding remote object. However, the object will still exist in the remote system and you can later use terraform import to start managing it again in a different configuration or workspace. The syntax for this command is terraform state rm <address>, where <address> is the resource address that identifies the resource instance to remove. For example, terraform state rm aws_instance.ubuntu[1] will remove the second instance of the aws_instance resource named ubuntu from the state. References = : Command: state rm : Moving Resources
NEW QUESTION # 85
You must use different Terraform commands depending on the cloud provider you use.
- A. True
- B. False
Answer: B
Explanation:
Explanation
You do not need to use different Terraform commands depending on the cloud provider you use. Terraform commands are consistent across different providers, as they operate on the Terraform configuration files and state files, not on the provider APIs directly.
NEW QUESTION # 86
You modified your Terraform configuration and run Terraform plan to review the changes. Simultaneously, your teammate manually modified the infrastructure component you are working on. Since you already ran terraform plan locally, the execution plan for terraform apply will be the same.
- A. True
- B. False
Answer: B
Explanation:
Explanation
The execution plan for terraform apply will not be the same as the one you ran locally with terraform plan, if your teammate manually modified the infrastructure component you are working on. This is because Terraform will refresh the state file before applying any changes, and will detect any differences between the state and the real resources.
NEW QUESTION # 87
As a member of an operations team that uses infrastructure as code (lac) practices, you are tasked with making a change to an infrastructure stack running in a public cloud. Which pattern would follow laC best practices for making a change?
- A. Clone the repository containing your infrastructure code and then run the code
- B. Submit a pull request and wait for an approved merge of the proposed changes
- C. Make the change programmatically via the public cloud CLI
- D. Use the public cloud console to make the change after a database record has been approved
- E. Make the change via the public cloud API endpoint
Answer: B
Explanation:
Explanation
You do not need to use different Terraform commands depending on the cloud provider you use. Terraform commands are consistent across different providers, as they operate on the Terraform configuration files and state files, not on the provider APIs directly.
NEW QUESTION # 88
Terraform providers are always installed from the Internet.
- A. True
- B. False
Answer: B
Explanation:
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.
NEW QUESTION # 89
When does Sentinel enforce policy logic during a Terraform Cloud run?
- A. After the apply phase
- B. Before the apply phase
- C. During the plan phase
- D. Before the plan phase
Answer: B
Explanation:
Explanation
Sentinel policies are checked after the plan stage of a Terraform run, but before it can be confirmed or the terraform apply is executed3. This allows you to enforce rules on your infrastructure before it is created or modified.
NEW QUESTION # 90
What is the Terraform style convention for indenting a nesting level compared to the one above it?
- A. With four spaces
- B. With three spaces
- C. With two spaces
- D. With a tab
Answer: C
Explanation:
Explanation
This is the Terraform style convention for indenting a nesting level compared to the one above it. The other options are not consistent with the Terraform style guide.
NEW QUESTION # 91
Which of these ate features of Terraform Cloud? Choose two correct answers.
- A. Automatic backups
- B. A web-based user interface (Ul)
- C. Automated infrastructure deployment visualization
- D. Remote state storage
Answer: B,D
Explanation:
Explanation
These are features of Terraform Cloud, which is a hosted service that provides a web-based UI, remote state storage, remote operations, collaboration features, and more for managing your Terraform infrastructure.
NEW QUESTION # 92
Which method for sharing Terraform configurations fulfills the following criteria:
1. Keeps the configurations confidential within your organization
2. Support Terraform's semantic version constrains
3. Provides a browsable directory
- A. Terraform Cloud private registry
- B. Generic git repository
- C. Subfolder within a workspace
- D. Public Terraform module registry
Answer: A
Explanation:
Explanation
This is the method for sharing Terraform configurations that fulfills the following criteria:
Keeps the configurations confidential within your organization
Supports Terraform's semantic version constraints
Provides a browsable directory
The Terraform Cloud private registry is a feature of Terraform Cloud that allows you to host and manage your own modules within your organization, and use them in your Terraform configurations with versioning and access control.
NEW QUESTION # 93
You decide to move a Terraform state file to Amazon S3 from another location. You write the code below into a file called backend.tf.
Which command will migrate your current state file to the new S3 remote backend?
- A. terraform state
- B. terraform init
- C. terraform push
- D. terraform refresh
Answer: B
Explanation:
Explanation
This command will initialize the new backend and prompt you to migrate the existing state file to the new location3. The other commands are not relevant for this task.
NEW QUESTION # 94
What is the workflow for deploying new infrastructure with Terraform?
- A. Write Terraform configuration, run terraform show to view proposed changes, and terraform apply to create new infrastructure
- B. Write Terraform configuration, run terraform plan to initialize the working directory or workspace, and terraform apply to create the 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 apply to create infrastructure, use terraform validate to confirm Terraform deployed resources correctly
Answer: C
Explanation:
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.
NEW QUESTION # 95
You can configure Terraform to log to a file using the TF_LOG environment variable.
- A. False
- B. True
Answer: B
Explanation:
Explanation
You can configure Terraform to log to a file using the TF_LOG environment variable. This variable can be set to one of the log levels: TRACE, DEBUG, INFO, WARN or ERROR. You can also use the TF_LOG_PATH environment variable to specify a custom log file location. References = : Debugging Terraform
NEW QUESTION # 96
You have deployed a new webapp with a public IP address on a cloud provider. However, you did not create any outputs for your code. What is the best method to quickly find the IP address of the resource you deployed?
- A. Run terraform state list to find the name of the resource, then terraform state show to find the attributes including public IP address
- B. Run terraform output ip_address to view the result
- C. In a new folder, use the terraform_remote_state data source to load in the state file, then write an output for each resource that you find the state file
- D. Run terraform destroy then terraform apply and look for the IP address in stdout
Answer: A
Explanation:
Explanation
This is a quick way to inspect the state file and find the information you need without modifying anything5.
The other options are either incorrect or inefficient.
NEW QUESTION # 97
What information does the public Terraform Module Registry automatically expose about published modules?
- A. All of the above
- B. Required input variables
- C. None of the above
- D. Optional inputs variables and default values
- E. Outputs
Answer: A
Explanation:
Explanation
The public Terraform Module Registry automatically exposes all the information about published modules, including required input variables, optional input variables and default values, and outputs. This helps users to understand how to use and configure the modules.
NEW QUESTION # 98
......
Latest Terraform-Associate-003 Exam Dumps HashiCorp Exam: https://actualtests.dumpsquestion.com/Terraform-Associate-003-exam-dumps-collection.html