100% Real Terraform-Associate-003 dumps - Brilliant Terraform-Associate-003 Exam Questions PDF
Terraform-Associate-003 Exam PDF [2025] Tests Free Updated Today with Correct 178 Questions
HashiCorp Terraform-Associate-003 Exam Syllabus Topics:
| Topic | Details |
|---|---|
| Topic 1 |
|
| Topic 2 |
|
| Topic 3 |
|
| Topic 4 |
|
| Topic 5 |
|
NEW QUESTION # 74
What Terraform command always causes a state file to be updated with changes that might have been made outside of Terraform?
- A. Terraform show -json
- B. Terraform apply -lock-false
- C. Terraform plan -refresh-only
- D. Terraform plan target-state
Answer: C
Explanation:
This is the command that always causes a state file to be updated with changes that might have been made outside of Terraform, as it will only refresh the state file with the current status of the real resources, without making any changes to them or creating a plan.
NEW QUESTION # 75
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. Submit a pull request and wait for an approved merge of the proposed changes
- B. Use the public cloud console to make the change after a database record has been approved
- C. Make the change via the public cloud API endpoint
- D. Make the change programmatically via the public cloud CLI
- E. Clone the repository containing your infrastructure code and then run the code
Answer: A
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 # 76
Which of the following methods, used to provision resources into a public cloud, demonstrates the concept of infrastructure as code?
- A. curl commands manually run from a terminal
- B. A series of commands you enter into a public cloud console
- C. A script that contains a series of public cloud CLI commands
- D. A sequence of REST requests you pass to a public cloud API endpoint Most Voted
Answer: C
Explanation:
The concept of infrastructure as code (IaC) is to define and manage infrastructure using code, rather than manual processes or GUI tools. A script that contains a series of public cloud CLI commands is an example of IaC, because it uses code to provision resources into a public cloud. The other options are not examples of IaC, because they involve manual or interactive actions, such as running curl commands, sending REST requests, or entering commands into a console. Reference = [Introduction to Infrastructure as Code with Terraform] and [Infrastructure as Code]
NEW QUESTION # 77
Select the command that doesn't cause Terraform to refresh its state.
- A. Terraform destroy
- B. Terraform plan
- C. Terraform state list
- D. Terraform apply
Answer: C
NEW QUESTION # 78
What is the provider for this resource?
- A. Test
- B. aws
- C. Main
- D. Vpc
Answer: B
Explanation:
In the given Terraform configuration snippet:
resource "aws_vpc" "main" {
name = "test"
}
The provider for the resource aws_vpc is aws. The provider is specified by the prefix of the resource type. In this case, aws_vpc indicates that the resource type vpc is provided by the aws provider.
Reference:
Terraform documentation on providers: Terraform Providers
NEW QUESTION # 79
Terraform variable names are saved in the state file.
- A. True
- B. False
Answer: B
Explanation:
Explanation
Terraform variable names are not saved in the state file, only their values are. The state file only stores the attributes of the resources and data sources that are managed by Terraform, not the variables that are used to configure them.
NEW QUESTION # 80
Which of the following does terraform apply change after you approve the execution plan? (Choose two.)
- A. State file
- B. Cloud infrastructure Most Voted
- C. The .terraform directory
- D. The execution plan
- E. Terraform code
Answer: A,B
Explanation:
The terraform apply command changes both the cloud infrastructure and the state file after you approve the execution plan. The command creates, updates, or destroys the infrastructure resources to match the configuration. It also updates the state file to reflect the new state of the infrastructure. The .terraform directory, the execution plan, and the Terraform code are not changed by the terraform apply command. Reference = Command: apply and Purpose of Terraform State
NEW QUESTION # 81
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:
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 # 82
When should you use the force-unlock command?
- A. You see a status message that you cannot acquire the lock
- B. Automatic unlocking failed
- C. You have a high priority change
- D. apply failed due to a state lock
Answer: B
Explanation:
You should use the force-unlock command when automatic unlocking failed. Terraform will lock your state for all operations that could write state, such as plan, apply, or destroy. This prevents others from acquiring the lock and potentially corrupting your state. State locking happens automatically on all operations that could write state and 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. Terraform has a force-unlock command to manually unlock the state if unlocking failed. Be very careful with this command. If you unlock the state when someone else is holding the lock it could cause multiplewriters. Force unlock should only be used to unlock your own lock in the situation where automatic unlocking failed. To protect you, the force-unlock command requires a unique lock ID. Terraform will output this lock ID if unlocking fails. This lock ID acts as a nonce, ensuring that locks and unlocks target the correct lock. The other situations are not valid reasons to use the force-unlock command. You should not use the force-unlock command if you have a high priority change, if apply failed due to a state lock, or if you see a status message that you cannot acquire the lock. These situations indicate that someone else is holding the lock and you should wait for them to finish their operation or contact them to resolve the issue. Using the force-unlock command in these cases could result in data loss or inconsistency. References = [State Locking], [Command: force-unlock]
NEW QUESTION # 83
You have a list of numbers that represents the number of free CPU cores on each virtual cluster:
What Terraform function could you use to select the largest number from the list?
- A. top(numcpus)
- B. max(numcpus)
- C. hight[numcpus]
- D. ceil (numcpus)
Answer: B
Explanation:
In Terraform, the max function can be used to select the largest number from a list of numbers. The max function takes multiple arguments and returns the highest one. For the list numcpus = [18, 3, 7, 11, 2], using max(numcpus...) will return 18, which is the largest number in the list.
Reference:
Terraform documentation on max function: Terraform Functions - max
NEW QUESTION # 84
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 workspaces
- B. Terraform local values
- C. Terraform data sources
- D. None of the above
- E. Terraform modules
Answer: A
Explanation:
Explanation
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. References = Workspaces and How to Use Terraform Workspaces
NEW QUESTION # 85
Which of the following is not a valid siring function in Terraform?
- A. join
- B. slice
- C. Split
- D. choaf
Answer: D
Explanation:
This is not a valid string function in Terraform. The other options are valid string functions that can manipulate strings in various ways2.
NEW QUESTION # 86
Which of these ate secure options for storing secrets for connecting to a Terraform remote backend? Choose two correct answers.
- A. A variable file
- B. Defined in a connection configuration outside of Terraform
- C. Defined in Environment variables
- D. Inside the backend block within the Terraform configuration
Answer: B,C
Explanation:
Explanation
Environment variables and connection configurations outside of Terraform are secure options for storing secrets for connecting to a Terraform remote backend. Environment variables can be used to set values for input variables that contain secrets, such as backend access keys or tokens. Terraform will read environment variables that start with TF_VAR_ and match the name of an input variable. For example, if you have an input variable called backend_token, you can set its value with the environment variable TF_VAR_backend_token1.
Connection configurations outside of Terraform are files or scripts that provide credentials or other information for Terraform to connect to a remote backend. For example, you can use a credentials file for the S3 backend2, or a shell script for the HTTP backend3. These files or scripts are not part of the Terraform configuration and can be stored securely in a separate location. The other options are not secure for storing secrets. A variable file is a file that contains values for input variables. Variable files are usually stored in the same directory as the Terraform configuration or in a version control system. This exposes the secrets to anyone who can access the files or the repository. You should not store secrets in variable files1. Inside the backend block within the Terraform configuration is where you specify the type and settings of the remote backend. The backend block is part of the Terraform configuration and is usually stored in a version control system. This exposes the secrets to anyone who can access the configuration or the repository. You should not store secrets in the backend block4. References = [Terraform Input Variables]1, [Backend Type: s3]2,
[Backend Type: http]3, [Backend Configuration]4
NEW QUESTION # 87
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. Define the attribute vmet_id as a variable in the networking modeule
- D. Change the reference value module.my,network,outputs,vnet_id
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 # 88
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.
Answer:
Explanation:
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]
NEW QUESTION # 89
How does Terraform determine dependencies between resources?
- A. Terraform automatically builds a resource graph based on resources provisioners, special meta-parameters, and the stale file (if present}
- B. Terraform requires resource dependencies to be defined as modules and sourced in order
- C. Terraform requires resources in a configuration to be listed m the order they will be created to determine dependencies
- D. Terraform requires all dependencies between resources to be specified using the depends_on parameter
Answer: A
Explanation:
Explanation
This is how Terraform determines dependencies between resources, by using the references between them in the configuration files and other factors that affect the order of operations.
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 the following ate advantages of using infrastructure as code (laC) instead of provisioning with a graphical user interface (GUI)? Choose two correct answers.
- A. Prevents manual modifications to your resources
- B. Lets you version, reuse, and share infrastructure configuration
- C. Secures your credentials
- D. Reduces risk of operator error
- E. Provisions the same resources at a lower cost
Answer: B,D
Explanation:
It lets you version, reuse, and share infrastructure configuration as code files, which can be stored in a source control system and integrated with your CI/CD pipeline.
It reduces risk of operator error by automating repetitive tasks and ensuring consistency across environments. IaC does not necessarily provision resources at a lower cost, secure your credentials, or prevent manual modifications to your resources - these depend on other factors such as your cloud provider, your security practices, and your access policies.
NEW QUESTION # 92
What value does the Terraform Cloud private registry provide over the public Terraform Module Registry?
- A. The ability to share modules with public Terraform users and members of Terraform Cloud Organizations
- B. The ability to restrict modules to members of Terraform Cloud or Enterprise organizations
- C. The ability to share modules publicly with any user of Terraform
- D. The ability to tag modules by version or release
Answer: B
Explanation:
Explanation
The Terraform Cloud private registry provides the ability to restrict modules to members of Terraform Cloud or Enterprise organizations. This allows you to share modules within your organization without exposing them to the public. The private registry also supports importing modules from your private VCS repositories. The public Terraform Module Registry, on the other hand, publishes modules from public Git repositories and makes them available to any user of Terraform. References = : Private Registry - Terraform Cloud : Terraform Registry - Provider Documentation
NEW QUESTION # 93
How could you reference an attribute from the vsphere_datacenter data source for use with the datacenter_id argument within the vsphere_folder resource in the following configuration?
- A. Data,dc,id
- B. Data.vsphere_datacenter,dc
- C. Vsphere_datacenter.dc.id
- D. Data.vsphere_datacenter.DC.id
Answer: D
Explanation:
The correct way to reference an attribute from the vsphere_datacenter data source for use with the datacenter_id argument within the vsphere_folder resource in the following configuration is data.vsphere_datacenter.dc.id. This follows the syntax for accessing data source attributes, which is data.TYPE.NAME.ATTRIBUTE. In this case, the data source type is vsphere_datacenter, the data source name is dc, and the attribute we want to access is id. The other options are incorrect because they either use the wrong syntax, the wrong punctuation, or the wrong case. Reference = [Data Source: vsphere_datacenter], [Data Source: vsphere_folder], [Expressions: Data Source Reference]
NEW QUESTION # 94
......
Verified & Correct Terraform-Associate-003 Practice Test Reliable Source Jan 04, 2025 Updated: https://www.braindumpquiz.com/Terraform-Associate-003-exam-material.html
HashiCorp Terraform-Associate-003 Exam Preparation Guide and PDF Download: https://drive.google.com/open?id=1M-XBUiz5pZG9h_71X0hd5IT45CB9rgqh