Terraform-Associate-003 Exam Dumps, Terraform-Associate-003 Practice Test Questions
PDF (New 2024) Actual HashiCorp Terraform-Associate-003 Exam Questions
NEW QUESTION # 31
When should you run terraform init?
- A. After you run terraform plan for the time in a new terraform project and before you run terraform apply
- B. Every time you run terraform apply
- C. Before you start coding a new Terraform project
- D. After you start coding a new terraform project and before you run terraform plan for the first time.
Answer: D
Explanation:
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
NEW QUESTION # 32
You have declared a variable called var.list which is a list of objects that all have an attribute id . Which options will produce a list of the IDs? Choose two correct answers.
- A. var.list[*].id
- B. [ var.list [ * ] , id ]
- C. [ for o in var.list : o.Id ]
- D. { for o in var.llst : o => o.id }
Answer: A,C
Explanation:
Explanation
These are two ways to produce a list of the IDs from a list of objects that have an attribute id, using either a for expression or a splat expression syntax.
NEW QUESTION # 33
Only the user that generated a plan may apply it.
- A. False
- B. True
Answer: A
Explanation:
Explanation
Any user with permission to apply a plan can apply it, not only the user that generated it. This allows for collaboration and delegation of tasks among team members.
NEW QUESTION # 34
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. Make the change programmatically via the public cloud CLI
- C. Clone the repository containing your infrastructure code and then run the code
- 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: 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 # 35
Which of the following module source paths does not specify a remote module?
- A. Source =''[email protected]:hasicrop/example.git''
- B. Source = ''hasicrop/consul/aws''
- C. Source = "module/consul''
- D. Source = ''githhub.comicrop/example''
Answer: C
Explanation:
Explanation
The module source path that does not specify a remote module is source = "module/consul". This specifies a local module, which is a module that is stored in a subdirectory of the current working directory. The other options are all examples of remote modules, which are modules that are stored outside of the current working directory and can be accessed by various protocols, such as Git, HTTP, or the Terraform Registry. Remote modules are useful for sharing and reusing code across different configurations and environments. References = [Module Sources], [Local Paths], [Terraform Registry], [Generic Git Repository],
[GitHub]
NEW QUESTION # 36
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. Generic git repository
- B. Subfolder within a workspace
- C. Public Terraform module registry
- D. Terraform Cloud private registry
Answer: D
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 # 37
Which two steps are required to provision new infrastructure in the Terraform workflow? Choose two correct answers.
- A. Import
- B. Init
- C. Plan
- D. apply
- E. Alidate
Answer: B,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 # 38
In Terraform HCL, an object type of object({name=string, age-number}) would match this value.
- A.

- B.

- C.

- D.

Answer: A
NEW QUESTION # 39
Which of the following commands would you use to access all of the attributes and details of a resource managed by Terraform?
- A. terraform state list
- B. terraform state list 'provider_type.name'
- C. terraform get 'provider_type.name'
- D. terraform state show 'provider_type.name'
Answer: D
Explanation:
Explanation
The terraform state show command allows you to access all of the attributes and details of a resource managed by Terraform. You can use the resource address (e.g. provider_type.name) as an argument to show the information about a specific resource. The terraform state list command only shows the list of resources in the state, not their attributes. The terraform get command downloads and installs modules needed for the configuration. It does not show any information about resources. References = [Command: state show] and
[Command: state list]
NEW QUESTION # 40
You are writing a child Terraform module that provisions an AWS instance. You want to reference the IP address returned by the child module in the root configuration. You name the instance resource "main'.
Which of these is the correct way to define the output value?
- A.

- B.

- C.

- D.

Answer: A
NEW QUESTION # 41
What is the Terraform style convention for indenting a nesting level compared to the one above it?
- A. With a tab
- B. With three spaces
- C. With two spaces
- D. With four spaces
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 # 42
You want to know from which paths Terraform is loading providers referenced in your Terraform configuration (* files). You need to enable additional logging messages to find this out. Which of the following would achieve this?
- A. Set verbose for each provider in your Terraform configuration
- B. Set the environment variable TF_LOG_TRACE
- C. Set the environment variable TF_LOG_PATH
- D. Set the environment variable TF_log_TRACE
Answer: B
Explanation:
Explanation
This will enable additional logging messages to find out from which paths Terraform is loading providers referenced in your Terraform configuration files, as it will set the log level to TRACE, which is the most verbose and detailed level.
NEW QUESTION # 43
You add a new resource to an existing Terraform configuration, but do not update the version constraint in the configuration. The existing and new resources use the same provider. The working contains a .terraform.lock, hc1 file.
How will Terraform choose which version of the provider to use?
- A. Terraform will use the latest version of the provider available at the time you provision your new resource
- B. Terraform will use the latest version of the provider for the new resource and the version recorded in the lock file to manage existing resources
- C. Terraform will check your state file to determine the provider version to use
- D. Terraform will use the version recorded in your lock file
Answer: D
Explanation:
Explanation
This is how Terraform chooses which version of the provider to use, when you add a new resource to an existing Terraform configuration, but do not update the version constraint in the configuration. The lock file records the exact version of each provider that was installed in your working directory, and ensures that Terraform will always use the same provider versions until you run terraform init -upgrade to update them.
NEW QUESTION # 44
You much initialize your working directory before running terraform validate.
- A. True
- B. False
Answer: A
Explanation:
Explanation
You must initialize your working directory before running terraform validate, as it will ensure that all the required plugins and modules are installed and configured properly. If you skip this step, you may encounter errors or inconsistencies when validating your configuration files.
NEW QUESTION # 45
Terraform variable names are saved in the state file.
- A. False
- B. True
Answer: A
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 # 46
HashiCorp Configuration Language (HCL) supports user-denned functions.
- A. False
- B. True
Answer: A
Explanation:
Explanation
HashiCorp Configuration Language (HCL) does not support user-defined functions. You can only use the built-in functions that are provided by the language. The built-in functions allow you to perform various operations and transformations on values within expressions. The general syntax for function calls is a function name followed by comma-separated arguments in parentheses, such as max(5, 12, 9). You can find the documentation for all of the available built-in functions in the Terraform Registry or the Packer Documentation, depending on which tool you are using. References = : Functions - Configuration Language | Terraform : Functions - Configuration Language | Packer
NEW QUESTION # 47
What feature stops multiple users from operating on the Terraform state at the same time?
- A. State locking
- B. Provider constraints
- C. Remote backends
- D. Version control
Answer: A
Explanation:
Explanation
State locking prevents other users from modifying the state file while a Terraform operation is in progress. This prevents conflicts and data loss1.
NEW QUESTION # 48
The public Terraform Module Registry is free to use.
- A. True
- B. False
Answer: A
Explanation:
Explanation
The public Terraform Module Registry is free to use, as it is a public service that hosts thousands of self-contained packages called modules that are used to provision infrastructure. You can browse, use, and publish modules to the registry without any cost.
NEW QUESTION # 49
You're building a CI/CD (continuous integration/continuous delivery) pipeline and need to inject sensitive variables into your Terraform run. How can you do this safely?
- A. Copy the sensitive variables into your Terraform code
- B. Pass variables to Terraform with a -var flag
- C. Store the sensitive variables in a secure_varS.tf file
- D. Store the sensitive variables as plain text in a source code repository
Answer: B
Explanation:
Explanation
This is a secure way to inject sensitive variables into your Terraform run, as they will not be stored in any file or source code repository. You can also use environment variables or variable files with encryption to pass sensitive variables to Terraform.
NEW QUESTION # 50
Your DevOps team is currently using the local backend for your Terraform configuration. You would like to move to a remote backend to store the state file in a central location. Which of the following backends would not work?
- A. Amazon S3
- B. Artifactory
- C. Git
- D. Terraform Cloud
Answer: C
Explanation:
Explanation
This is not a valid backend for Terraform, as it does not support locking or versioning of state files4. The other options are valid backends that can store state files in a central location.
NEW QUESTION # 51
What does state looking accomplish?
- A. Copies the state file from memory to disk
- B. Blocks Terraform commands from modifying, the state file
- C. Encrypts any credentials stored within the state file
- D. Prevent accidental Prevent accident deletion of the state file
Answer: B
Explanation:
Explanation
This is what state locking accomplishes, by preventing other users from modifying the state file while a Terraform operation is in progress. This prevents conflicts and data loss.
NEW QUESTION # 52
When does Sentinel enforce policy logic during a Terraform Cloud run?
- A. During the plan phase
- B. After the apply phase
- C. Before the plan phase
- D. Before the apply phase
Answer: D
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 # 53
How would you reference the volume IDs associated with the ebs_block_device blocks in this configuration?
- A. aws_instance.example.ebs_block_device[sda2,sda3).volume_id
- B. aws_instance.example-ebs_block_device.*.volume_id
- C. aws_lnstance.example.ebs_block_device.[*].volume_id
- D. aws_lnstance.example.ebs_block_device.volume_ids
Answer: B
Explanation:
Explanation
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.
NEW QUESTION # 54
How can a ticket-based system slow down infrastructure provisioning and limit the ability to scale? Choose two correct answers.
- A. Users can access catalog of approved resources from drop down list in a request form
- B. Ticket based systems generate a full audit trail of the request and fulfillment process
- C. End-users have to request infrastructure changes
- D. The more resources your organization needs, the more tickets your infrastructure team has to process
Answer: C
Explanation:
Explanation
These are some of the ways that a ticket-based system can slow down infrastructure provisioning and limit the ability to scale, as they introduce delays, bottlenecks, and manual interventions in the process of creating and modifying infrastructure.
NEW QUESTION # 55
What does this code do?
- A. Requires any version of the AWS provider > = 3.0 major release. like 4.1
- B. Requires any version of the AWS provider > = 3.0 and <4.0
- C. Requires any version of the AWS provider >= 3.0
- D. Requires any version of the AWS provider > 3.0
Answer: B
Explanation:
Explanation
This is what this code does, by using the pessimistic constraint operator (~>), which specifies an acceptable range of versions for a provider or module.
NEW QUESTION # 56
......
Updated Feb-2024 Pass Terraform-Associate-003 Exam - Real Practice Test Questions: https://surepass.free4dump.com/Terraform-Associate-003-real-dump.html