HashiCorp TA-002-P Dumps - HashiCorp Certified: Terraform Associate PDF Sample Questions

discount banner
Exam Code:
Exam Name:
HashiCorp Certified: Terraform Associate
92 Questions
Last Update Date : 20 June, 2024
PDF + Test Engine
$60 $78
Test Engine Only Demo
$50 $65
PDF Only Demo
$35 $45.5

HashiCorp TA-002-P This Week Result


They can't be wrong


Score in Real Exam at Testing Centre


Questions came word by word from this dumps

Best HashiCorp TA-002-P Dumps - pass your exam In First Attempt

Our TA-002-P dumps are better than all other cheap TA-002-P study material.

Only best way to pass your HashiCorp TA-002-P is that if you will get reliable exam study materials. We ensure you that realexamdumps is one of the most authentic website for HashiCorp HashiCorp Infrastructure Automation Certification exam question answers. Pass your TA-002-P HashiCorp Certified: Terraform Associate with full confidence. You can get free HashiCorp Certified: Terraform Associate demo from realexamdumps. We ensure 100% your success in TA-002-P Exam with the help of HashiCorp Dumps. you will feel proud to become a part of realexamdumps family.

Our success rate from past 5 year very impressive. Our customers are able to build their carrier in IT field.


45000+ Exams


Desire Exam



and pass your exam...

Related Exam

Realexamdumps Providing most updated HashiCorp Infrastructure Automation Certification Question Answers. Here are a few exams:

Sample Questions

Realexamdumps Providing most updated HashiCorp Infrastructure Automation Certification Question Answers. Here are a few sample questions:

HashiCorp TA-002-P Sample Question 1

What does the command terraform fmt do?


A. Rewrite Terraform configuration files to a canonical format and style.
B. Deletes the existing configuration file.
C. Updates the font of the configuration file to the official font supported by HashiCorp.
D. Formats the state file in order to ensure the latest state of resources can be obtained.

Answer: A Explanation: Explanation: The terraform fmt command is used to rewrite Terraform configuration files to a canonical format and style. This command applies a subset of the Terraform language style conventions, along with other minor adjustments for readability.Other Terraform commands that generate Terraform configuration will produce configuration files that conform to the style imposed by terraform fmt, so using this style in your own files will ensure consistency.https://www.terraform.io/docs/commands/fmt.htmm

HashiCorp TA-002-P Sample Question 2

Select all features which are exclusive to Terraform Enterprise. (Select Three)


A. Sentinel
B. Cost Estimation
C. Audit Logs
D. Clustering

Answer: C, D, E Explanation: Explanation: Sentinel and Cost Estimation are also available in Terraform Cloudhttps://www.hashicorp.com/products/terraform/pricing/

HashiCorp TA-002-P Sample Question 3

Which one is the right way to import a local module names consul?


A. module "consul" { source = "consul"}
B. module "consul" { source = "./consul"}
C. module "consul" { source = "../consul"}
D. module "consul" { source = "module/consul"}

Answer: B, C Explanation: Explanation: A local path must begin with either ./ or ../ to indicate that a local path is intended, to distinguish from a module registry address.module "consul" {source = "./consul"}

HashiCorp TA-002-P Sample Question 4

Which of the below terraform commands do not run terraform refresh implicitly before taking actual action of the command?


A. terraform apply
B. terraform destroy
C. terraform init
D. terraform import
E. terraform plan

Answer: C, D Explanation: Explanation: https://www.terraform.io/docs/commands/refresh.htmm

HashiCorp TA-002-P Sample Question 5

Which of the following clouds does not have a provider maintained HashiCorp?


A. IBM Cloud
B. DigitalOcean
C. OpenStack

Answer: A Explanation: Explanation: IBM Cloud does not have a provider maintained by HashiCorp, although IBM Cloud does maintain their own Terraform provider.https://www.terraform.io/docs/providers/index.htmm

HashiCorp TA-002-P Sample Question 6

Consider the following Terraform 0.12 configuration snippet:

1. variable "vpc_cidrs" {

2. type = map

3. default = {

4. us-east-1 = ""

5. us-east-2 = ""

6. us-west-1 = ""

7. us-west-2 = ""

8. }

9. }


11. resource "aws_vpc" "shared" {

12. cidr_block = _____________

13. }

How would you define the cidr_block for us-east-1 in the aws_vpc resource using a variable?


A. var.vpc_cidrs.0
B. vpc_cidrs[“us-east-1”]
C. var.vpc_cidrs[“us-east-1”]
D. var.vpc_cidrs[0]

Answer: D

HashiCorp TA-002-P Sample Question 7

Which of the below configuration file formats are supported by Terraform? (Select TWO)


A. Node
C. Go

Answer: B, E Explanation: Explanation: Terraform supports both HashiCorp Configuration Language (HCL) and JSON formats for configurations.https://www.terraform.io/docs/configuration/

HashiCorp TA-002-P Sample Question 8

What Terraform command can be used to inspect the current state file?


A. terraform inspect
B. terraform read
C. terraform show
D. terraform state

Answer: D

HashiCorp TA-002-P Sample Question 9

The terraform init command is always safe to run multiple times, to bring the working directory up to date with changes in the configuration. Though subsequent runs may give errors, this command will never delete your existing configuration or state.


A. False
B. True

Answer: B Explanation: Explanation: https://www.terraform.io/docs/commands/init.htmm

HashiCorp TA-002-P Sample Question 10

Terraform works well in Windows but a Windows server is required.


A. False
B. True

Answer: A Explanation: Explanation: You may see this QUESTION NO: in actual exam. Please remember : Terraform does not require GO language to be installed as a prerequisite and it does not require a Windows Server as well.

HashiCorp TA-002-P Sample Question 11

You have declared a variable name my_var in terraform configuration without a value associated with it.

variable my_var {}

After running terraform plan it will show an error as variable is not defined.


A. True
B. False

Answer: B Explanation: Explanation: Input variables are usually defined by stating a name, type and a default value. However, the type and default values are not strictly necessary. Terraform can deduct the type of the variable from the default or input value.Variables can be predetermined in a file or included in the command-line options. As such, the simplest variable is just a name while the type and value are selected based on the input.variable "variable_name" {}terraform apply -var variable_name="value"The input variables, like the one above, use a couple of different types: strings, lists, maps, and boolean. Here are some examples of how each type are defined and used.StringStrings mark a single value per structure and are commonly used to simplify and make complicated values more user-friendly. Below is an example of a string variable definition.variable "template" {type = stringdefault = "01000000-0000-4000-8000-000030080200"}A string variable can then be used in resource plans. Surrounded by double quotes, string variables are a simple substitution such as the example underneath.storage = var.templateListAnother type of Terraform variables lists. They work much like a numbered catalogue of values. Each value can be called by their corresponding index in the list. Here is an example of a list variable definition.variable "users" {type = listdefault = ["root", "user1", "user2"]}Lists can be used in the resource plans similarly to strings, but you’ll also need to denote the index of the value you are looking for.username = var.users[0]MapMaps are a collection of string keys and string values. These can be useful for selecting values based on predefined parameters such as the server configuration by the monthly price.variable "plans" {type = mapdefault = {"5USD" = "1xCPU-1GB""10USD" = "1xCPU-2GB""20USD" = "2xCPU-4GB"}}You can access the right value by using the matching key. For example, the variable below would set the plan to "1xCPU-1GB".plan = var.plans["5USD"]The values matching to their keys can also be used to look up information in other maps. For example, underneath is a shortlist of plans and their corresponding storage sizes.variable "storage_sizes" {type = mapdefault = {"1xCPU-1GB" = "25""1xCPU-2GB" = "50""2xCPU-4GB" = "80"}}These can then be used to find the right storage size based on the monthly price as defined in the previous example.size = lookup(var.storage_sizes, var.plans["5USD"])BooleanThe last of the available variable type is boolean. They give the option to employ simple true or false values. For example, you might wish to have a variable that decides when to generate the root user password on a new deployment.variable "set_password" {default = false}The above example boolean can be used similarly to a string variable by simply marking down the correct variable.create_password = var.set_passwordBy default, the value is set to false in this example. However, you can overwrite the variable at deployment by assigning a different value in a command-line variable.terraform apply -var set_password="true"

HashiCorp TA-002-P Sample Question 12

Which of the following Terraform files should be ignored by Git when committing code to a repo? (select Three)


A. Files named exactly terraform.tfvars or terraform.tfvars.json.
B. Any files with names ending in .auto.tfvars or .auto.tfvars.json.
C. input.tf
D. terraform.tfstate
E. output.tf

Answer: A, B, D Explanation: Explanation: The .gitignore file should be configured to ignore Terraform files that either contain sensitive data or are not required to save.Terraform state (terraform.tfstate) can contain sensitive data, depending on the resources in use and your definition of "sensitive." The state contains resource IDs and all resource attributes. For resources such as databases, this may contain initial passwords.When using local state, state is stored in plain-text JSON files.The terraform.tfvars file may contain sensitive data, such as passwords or IP addresses of an environment that you may not want to share with others.

HashiCorp TA-002-P Sample Question 13

The Terraform language does not support user-defined functions, and so only the functions built in to the language are available for use.


A. False
B. True

Answer: B Explanation: Explanation: https://www.terraform.io/docs/configuration/functions.htmm

HashiCorp TA-002-P Sample Question 14

Which of the following represents a feature of Terraform Cloud that is NOT free to customers?


A. Roles and Team Management
B. WorkSpace Management
C. Private Module Registry
D. VCS Integration

Answer: A Explanation: Explanation: Role Based Access Controls (RBAC) for controlling permissions for who has access to what configurations within an organization and it is not free to customers.https://www.hashicorp.com/products/terraform/pricing/

HashiCorp TA-002-P Sample Question 15

The current implementation of Terraform import can only import resources into the state. It does not generate configuration.


A. False
B. True

Answer: B Explanation: Explanation: 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-onlz

HashiCorp TA-002-P Sample Question 16

What features stops multiple admins from changing the Terraform state at the same time?


A. Version control
B. Backend types
C. Provider constraints
D. State locking

Answer: E

HashiCorp TA-002-P Sample Question 17

Which of the following is not a valid string function in Terraform?


A. split
B. join
C. slice
D. chomp

Answer: C Explanation: Reference: [Reference: https://www.terraform.io/docs/language/functions/chomp.html, ]

HashiCorp TA-002-P Sample Question 18

Which of the following best describes a Terraform provider?


A. A plugin that Terraform uses to translate the API interactions with the service or provider.
B. Serves as a parameter for a Terraform module that allows a module to be customized.
C. Describes an infrastructure object, such as a virtual network, compute instance, or other components.
D. A container for multiple resources that are used together.

Answer: A Explanation: Explanation: A provider is responsible for understanding API interactions and exposing resources. Providers generally are an IaaS (e.g. Alibaba Cloud, AWS, GCP, Microsoft Azure, OpenStack), PaaS (e.g. Heroku), or SaaS services (e.g. Terraform Cloud, DNSimple, Cloudflare).https://www.terraform.io/docs/providers/index.htmm

HashiCorp TA-002-P Sample Question 19

What is the purpose of using the local-exec provisioner? (Select Two)


A. To invoke a local executable.
B. Executes a command on the resource to invoke an update to the Terraform state.
C. To execute one or more commands on the machine running Terraform.
D. Ensures that the resource is only executed in the local infrastructure where Terraform is deployed.

Answer: A, C Explanation: Explanation: The local-exec provisioner invokes a local executable after a resource is created. This invokes a process on the machine running Terraform, not on the resource.Note that even though the resource will be fully created when the provisioner is run, there is no guarantee that it will be in an operable state - for example system services such as sshd may not be started yet on compute resources.Example usageresource "aws_instance" "web" {# ...provisioner "local-exec" {command = "echo ${aws_instance.web.private_ip} >> private_ips.txt"}}Note: Provisioners should only be used as a last resort. For most common situations there are better alternatives.https://www.terraform.io/docs/provisioners/local-exec.htmm

HashiCorp TA-002-P Sample Question 20

Terraform providers are always installed from the Internet.


A. True
B. False

Answer: B Explanation: Explanation: Terraform configurations must declare which providers they require, so that Terraform can install and use them.Reference: [Reference: https://www.terraform.io/docs/language/providers/configuration.html, ]

HashiCorp TA-002-P Sample Question 21

Terraform can import modules from a number of sources – which of the following is not a valid source?


A. FTP server
B. GitHub repository
C. Local path
D. Terraform Module Registry

Answer: B

HashiCorp TA-002-P Sample Question 22

Which task does terraform init not perform?


A. Sources all providers present in the configuration and ensures they are downloaded and available locally
B. Connects to the backend
C. Sources any modules and copies the configuration locally
D. Validates all required variables are present

Answer: D Explanation: Reference: [Reference: https://www.terraform.io/docs/cli/commands/init.html, ]

HashiCorp TA-002-P Sample Question 23

Which provisioner invokes a process on the resource created by Terraform?


A. remote-exec
B. null-exec
C. local-exec
D. file

Answer: A Explanation: Explanation: The remote-exec provisioner invokes a script on a remote resource after it is created. Reference: https://www.terraform.io/docs/language/resources/provisioners/remote-exec.htmm

HashiCorp TA-002-P Sample Question 24

Which backend does the Terraform CLI use by default?


A. Terraform Cloud
B. Consul
C. Remote
D. Local

Answer: E

HashiCorp TA-002-P Sample Question 25

Terraform validate reports syntax check errors from which of the following scenarios?


A. Code contains tabs indentation instead of spaces
B. There is missing value for a variable
C. The state files does not match the current infrastructure
D. None of the above

Answer: C

HashiCorp TA-002-P Sample Question 26

What does the default "local" Terraform backend store?


A. tfplan files
B. Terraform binary
C. Provider plugins
D. State file

Answer: D Explanation: Explanation: The local backend stores state on the local filesystem, locks that state using system APIs, and performs operations locally.Reference: [Reference: https://www.terraform.io/docs/language/settings/backends/local.html, ]

HashiCorp TA-002-P Sample Question 27

Taint the resource "aws_instance" "baz" resource that lives in module bar which lives in module foo.


A. terraform taint module.foo.module.bar.baz
B. terraform taint module.foo.bar.aws_instance.baz
C. terraform taint module.foo.module.bar.aws_instance.baz
D. terraform taint foo.bar.aws_instance.baz

Answer: C Explanation: Explanation: Check resource addressinghttps://www.terraform.io/docs/internals/resource-addressing.htmm

HashiCorp TA-002-P Sample Question 28

You cannot publish your own modules on the Terraform Registry.


A. False
B. True

Answer: A Explanation: Explanation: https://www.terraform.io/docs/registry/modules/publish.htmm

HashiCorp TA-002-P Sample Question 29

Dawn has created the below child module. Without changing the module, can she override the instance_type from t2.micro to t2.large form her code while calling this module?

1. resource "aws_instance" "myec2"

2. {

3. ami = "ami-082b5a644766e0e6f"

4. instance_type = "t2.micro

5. }


B. No

Answer: B Explanation: Explanation: As the instance_type is hard-coded in source module, you will not be able to change its value from destination module. Instead of hard-coding you should use variable with default values.

HashiCorp TA-002-P Sample Question 30

The Terraform CLI will print output values from a child module after running terraform apply.


A. True
B. False

Answer: B

HashiCorp TA-002-P Sample Question 31

Terraform and Terraform providers must use the same major version number in a single configuration.


A. True
B. False

Answer: C

HashiCorp TA-002-P Sample Question 32

When using Terraform to deploy resources into Azure, which scenarios are true regarding state files? (Choose two.)


A. When a change is made to the resources via the Azure Cloud Console, the changes are recorded in a new state file
B. When a change is made to the resources via the Azure Cloud Console, Terraform will update the state file to reflect them during the next plan or apply
C. When a change is made to the resources via the Azure Cloud Console, the current state file will not be updated
D. When a change is made to the resources via the Azure Cloud Console, the changes are recorded in the current state file

Answer: C

HashiCorp TA-002-P Sample Question 33

When should you use the force-unlock command?


A. You see a status message that you cannot acquire the lock
B. You have a high priority change
C. Automatic unlocking failed
D. Your apply failed due to a state lock

Answer: C Explanation: Explanation: Manually unlock the state for the defined configuration.Reference: [Reference: https://www.terraform.io/docs/cli/commands/force-unlock.html, ]

HashiCorp TA-002-P Sample Question 34

You just scaled your VM infrastructure and realized you set the count variable to the wrong value. You correct the value and save your change.

What do you do next to make your infrastructure match your configuration?


A. Run an apply and confirm the planned changes
B. Inspect your Terraform state because you want to change it
C. Reinitialize because your configuration has changed
D. Inspect all Terraform outputs to make sure they are correct

Answer: B

HashiCorp TA-002-P Sample Question 35

Which of the below command will upgrade the provider version to the latest acceptable one?


A. terraform plan upgrade
B. terraform provider -upgrade
C. terraform init -upgrade
D. terraform init -update

Answer: C Explanation: Explanation: To upgrade to the latest acceptable version of each provider, run terraform init -upgrade. This command also upgrades to the latest versions of all Terraform modules.https://www.terraform.io/docs/configuration/providers.htmm

HashiCorp TA-002-P Sample Question 36

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. Which of the below option is a recommended solution for this?


A. Remote State
B. Module
C. Use the cached state and treat this as the record of truth.
D. Workspace

Answer: A Explanation: Explanation: https://www.terraform.io/docs/state/remote.htmm

HashiCorp TA-002-P Sample Question 37

The terraform state command can be used to ____


A. Update current state
B. Refresh existing state file
C. Print the current state file in console
D. It is not a valid command

Answer: A Explanation: Explanation: The terraform state command is used for advanced state management. Rather than modify the state directly, the terraform state commands can be used in many cases instead.https://www.terraform.io/docs/commands/state/index.htmm

HashiCorp TA-002-P Sample Question 38

Which of the following value will be accepted for var1?

variable "var1" {

type = string



A. None of the above
B. Both A and B
C. "5"
D. 5

Answer: B Explanation: Explanation: Terraform automatically converts number and bool values to strings when needed.

HashiCorp TA-002-P Sample Question 39

You have been given requirements to create a security group for a new application. Since your organization standardizes on Terraform, you want to add this new security group with the fewest number of lines of code. What feature could you use to iterate over a list of required tcp ports to add to the new security group?


A. dynamic backend
B. splat expression
C. terraform import
D. dynamic block

Answer: D Explanation: Explanation: A dynamic block acts much like a for expression, but produces nested blocks instead of a complex typed value. It iterates over a given complex value and generates a nested block for each element of that complex value.https://www.terraform.io/docs/configuration/expressions.html#dynamic-blockt

HashiCorp TA-002-P Sample Question 40

Terraform Cloud always encrypts state at rest and protects it with TLS in transit. Terraform Cloud also knows the identity of the user requesting state and maintains a history of state changes.


A. False
B. True

Answer: B Explanation: Explanation: Terraform Cloud always encrypts state at rest and protects it with TLS in transit. Terraform Cloud also knows the identity of the user requesting state and maintains a history of state changes. This can be used to control access and track activity. Terraform Enterprise also supports detailed audit logging.https://www.terraform.io/docs/state/sensitive-data.html#recommendationt

HashiCorp TA-002-P Sample Question 41

Multiple providers can be declared within a single Terraform configuration file.


A. True
B. False

Answer: A Explanation: 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 configurationprovider "aws" {region = "us-east-1"}# Additional provider configuration for west coast regionprovider "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.htmm

HashiCorp TA-002-P Sample Question 42

Command terraform refresh will update state file?


A. False
B. True

Answer: B Explanation: Explanation: The terraform refresh command is used to reconcile the state Terraform knows about (via its state file) with the real-world infrastructure. This can be used to detect any drift from the last-known state, and to update the state file.This does not modify infrastructure, but does modify the state file. If the state is changed, this may cause changes to occur during the next plan or apply.https://www.terraform.io/docs/commands/refresh.htmm

HashiCorp TA-002-P Sample Question 43

Which of the below options is a valid interpolation syntax for retrieving a data source?


A. ${google_storage_bucket.backend}
B. ${azurerm_resource_group.test.data}
C. ${aws_instance.web.id.data}
D. ${data.google_dns_keys.foo_dns_keys.key_signing_keys[0].ds_record}

Answer: D Explanation: Explanation: Data source attributes are interpolated with the general syntax data.TYPE.NAME.ATTRIBUTE. The interpolation for a resource is the same but without the data. prefix (TYPE.NAME.ATTRIBUTE).https://www.terraform.io/docs/configuration-0-11/interpolation.html#attributes-of-a-data-sourcf

HashiCorp TA-002-P Sample Question 44

Which of the below datatype is not supported by Terraform.


A. Array
B. List
C. Object
D. Map

Answer: B

HashiCorp TA-002-P Sample Question 45

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. Workspaces
C. Environment Variables
D. Backends

Answer: B Explanation: 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-workspacet

HashiCorp TA-002-P Sample Question 46

True or False: Workspaces provide identical functionality in the open-source, Terraform Cloud, and Enterprise versions of Terraform.


A. True
B. False

Answer: B Explanation: Explanation: Explanationhttps://www.terraform.io/docs/cloud/workspaces/index.html https://www.terraform.io/docs/state/workspaces.htmm

and so much more...