HashiCorp Terraform-Associate-003 Practice Test Pdf Exam Material [Q51-Q70]

Share

HashiCorp Terraform-Associate-003 Practice Test Pdf Exam Material

Terraform-Associate-003 Answers Terraform-Associate-003 Free Demo Are Based On The Real Exam

NEW QUESTION # 51
You can reference a resource created with for_each using a Splat ( *) expression.

  • A. True
  • B. False

Answer: B

Explanation:
Explanation
You cannot reference a resource created with for_each using a splat (*) expression, as it will not work with resources that have non-numeric keys. You need to use a for expression instead to iterate over the resource instances.


NEW QUESTION # 52
Select the command that doesn't cause Terraform to refresh its state.

  • A. Terraform destroy
  • B. Terraform apply
  • C. Terraform plan
  • D. Terraform state list

Answer: D

Explanation:
This is the command that does not cause Terraform to refresh its state, as it only lists the resources that are currently managed by Terraform in the state file. The other commands will refresh the state file before performing their operations, unless you use the -refresh=false flag.


NEW QUESTION # 53
What value does the Terraform Cloud private registry provide over the public Terraform Module Registry?

  • A. The ability to restrict modules to members of Terraform Cloud or Enterprise organizations
  • B. The ability to share modules with public Terraform users and members of Terraform Cloud Organizations
  • C. The ability to share modules publicly with any user of Terraform
  • D. The ability to tag modules by version or release

Answer: A

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. Reference = : Private Registry - Terraform Cloud : Terraform Registry - Provider Documentation


NEW QUESTION # 54
Which of the following should you put into the required_providers block?

  • A. version = ">= 3.1"
  • B. version ~> 3.1
  • C. version >= 3.1

Answer: A

Explanation:
The required_providers block is used to specify the provider versions that the configuration can work with.
The version argument accepts a version constraint string, which must be enclosed in double quotes. The version constraint string can use operators such as >=, ~>, =, etc. to specify the minimum, maximum, or exact version of the provider. For example, version = ">= 3.1" means that the configuration can work with any provider version that is 3.1 or higher. References = [Provider Requirements] and [Version Constraints]


NEW QUESTION # 55
Which of these are features of HCP Terraform/Terraform Cloud? Pick the 2 correct responses below.

  • A. Remote state storage.
  • B. Automated infrastructure deployment visualization.
  • C. A web-based user interface (UI).
  • D. Automatic backups of configuration and state.

Answer: A,B

Explanation:
Automated Visualization: HCP Terraform provides visualization tools that map infrastructure configurations, helping users manage complex architectures.
Remote State Storage: Terraform Cloud offers remote state management, essential for teams working collaboratively on shared infrastructure, ensuring consistency and avoiding state conflicts.
For more information, consult Terraform Cloud and HCP Terraform features in the official documentation.


NEW QUESTION # 56
You cannot install third party plugins using terraform init.

  • A. True
  • B. False

Answer: B

Explanation:
You can install third party plugins using terraform init, as long as you specify the plugin directory in your configuration or as a command-line argument. You can also use the terraform providers mirror command to create a local mirror of providers from any source.


NEW QUESTION # 57
Which of these ate secure options for storing secrets for connecting to a Terraform remote backend? Choose two correct answers.

  • A. Defined in Environment variables
  • B. A variable file
  • C. Inside the backend block within the Terraform configuration
  • D. Defined in a connection configuration outside of Terraform

Answer: A,D

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 # 58
Which of the following is not a key principle of infrastructure as code?

  • A. Versioned infrastructure
  • B. Self-describing infrastructure
  • C. Golden images
  • D. Idempotence

Answer: C

Explanation:
Explanation
The key principle of infrastructure as code that is not listed among the options is golden images. Golden images are pre-configured, ready-to-use virtual machine images that contain a specific set of software and configuration. They are often used to create multiple identical instances of the same environment, such as for testing or production. However, golden images are not a principle of infrastructure as code, but rather a technique that can be used with or without infrastructure as code. The other options are all key principles of infrastructure as code, as explained below:
Self-describing infrastructure: This means that the infrastructure is defined in code that describes its desired state, rather than in scripts that describe the steps to create it. This makes the infrastructure easier to understand, maintain, and reproduce.
Idempotence: This means that applying the same infrastructure code multiple times will always result in the same state, regardless of the initial state. This makes the infrastructure consistent and predictable, and avoids errors or conflicts caused by repeated actions.
Versioned infrastructure: This means that the infrastructure code is stored in a version control system, such as Git, that tracks the changes and history of the code. This makes the infrastructure code reusable, auditable, and collaborative, and enables practices such as branching, merging, and rollback. References
= [Introduction to Infrastructure as Code with Terraform], [Infrastructure as Code in a Private or Public Cloud]


NEW QUESTION # 59
You can develop a custom provider to manage its resources using Terraform.

  • A. True
  • B. False

Answer: A

Explanation:
You can develop a custom provider to manage its resources using Terraform, as Terraform is an extensible tool that allows you to write your own plugins in Go language. You can also publish your custom provider to the Terraform Registry or use it privately.


NEW QUESTION # 60
You have to initialize a Terraform backend before it can be configured.

  • A. True
  • B. False

Answer: B

Explanation:
You can configure a backend in your Terraform code before initializing it. Initializing a backend will store the state file remotely and enable features like locking and workspaces.
References = [Terraform Backends]


NEW QUESTION # 61
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 an HCP Terraform/Terraform Cloud variable, with the sensitive option checked.
  • C. In a plaintext document on a shared drive.
  • D. In a terraform.tfvars file, checked into your version control system.
  • E. In a terraform.tfvars file, securely managed and shared with your team.

Answer: A,B,E

Explanation:
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.
Reference:
Terraform Cloud Environment Variables


NEW QUESTION # 62
Which of these are features of HCP Terraform/Terraform Cloud? (Pick the 2 correct responses)

  • A. A web-based user interface (UI).
  • B. Remote state storage.
  • C. Automatic backups of configuration and state.
  • D. Automated infrastructure deployment visualization.

Answer: A,B

Explanation:
Terraform Cloud provides features like remote state storage and a web-based user interface for managing your Terraform runs. While it offers robust infrastructure as code capabilities, automatic backups of configuration and state are not directly provided by Terraform Cloud; instead, the state is stored remotely and secured.
References:
Terraform Cloud Features


NEW QUESTION # 63
How would you output returned values from a child module in the Terraform CLI output?

  • A. Declare the output in the child module
  • B. Declare the output in both the root and child module
  • C. None of the above
  • D. Declare the output in the root configuration

Answer: B

Explanation:
To output returned values from a child module in the Terraform CLI output, you need to declare the output in both the child module and the root module. The child module output will return the value to the root module, and the root module output will display the value in the CLI.
References = [Terraform Outputs]


NEW QUESTION # 64
You used Terraform to create an ephemeral development environment in the cloud 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 the resources that will be deleted? (Pick the 2 correct responses)

  • A. Run terraform destroy. This will output all the resources that will be deleted before prompting for approval.
  • B. Run terraform show -destroy.
  • C. Run terraform state rm *.

Answer: A,B

Explanation:
Running terraform destroy will show all resources that will be deleted before prompting for approval. You can also run terraform plan -destroy to simulate the destruction without actually applying it, which is useful for reviewing the planned changes.
Reference:
Terraform Destroy


NEW QUESTION # 65
Variables declared within a module are accessible outside of the module.

  • A. True
  • B. False

Answer: B

Explanation:
Variables declared within a module are only accessible within that module, unless they are explicitly exposed as output values1.


NEW QUESTION # 66
Terraform configuration can only call modules from the public registry.

  • A. True
  • B. False

Answer: B

Explanation:
Terraform can call modules from various sources including the public Terraform Registry, private registries, local file paths, or version control systems like GitHub.
Reference:
Terraform Modules


NEW QUESTION # 67
What Terraform command always causes a state file to be updated with changes that might have been made outside of Terraform?

  • A. Terraform plan -refresh-only
  • B. Terraform show -json
  • C. Terraform plan target-state
  • D. Terraform apply -lock-false

Answer: A

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 # 68
How would you reference the "name'' value of the second instance of this resource?

  • A. aws_instance.web(2),name
  • B. element(aws_instance.web, 2)
  • C. aws_instance-web(1)
  • D. Aws_instance,web,* , name
  • E. aws_instance_web(1),name

Answer: E

Explanation:
In Terraform, when you use the count meta-argument, you can reference individual instances using an index. The indexing starts at 0, so to reference the "name" value of the second instance, you would use aws_instance.web[1].name. This syntax allows you to access the properties of specific instances in a list generated by the count argument.
References:
Terraform documentation on count and accessing resource instances: Terraform Count


NEW QUESTION # 69
Which of the following commands would you use to access all of the attributes and details of a resource managed by Terraform?

  • A. terraform get 'provider_type.name'
  • B. terraform state list 'provider_type.name'
  • C. terraform state show 'provider_type.name'
  • D. terraform state list

Answer: C

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 # 70
......

Terraform-Associate-003 [Apr-2025] Newly Released] Exam Questions For You To Pass: https://dumpstorrent.actualpdf.com/Terraform-Associate-003-real-questions.html