Terraform Associate Certified Official Practice Test Terraform-Associate-003 - Jan-2025
Ace HashiCorp Terraform-Associate-003 Certification with Actual Questions Jan 12, 2025 Updated
NEW QUESTION # 59
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 # 60
Outside of the required_providers block, Terraform configurations always refer to providers by their local names.
- A. True
- B. False
Answer: B
Explanation:
Outside of the required_providers block, Terraform configurations can refer to providers by either their local names or their source addresses. The local name is a short name that can be used throughout the configuration, while the source address is a global identifier for the provider in the format registry.terraform.io/namespace/type. For example, you can use either aws or registry.terraform.io/hashicorp/aws to refer to the AWS provider.
NEW QUESTION # 61
Terraform configuration can only import modules from the public registry.
- A. True
- B. False
Answer: B
Explanation:
Terraform configuration can import modules from various sources, not only from the public registry. Modules can be sourced from local file paths, Git repositories, HTTP URLs, Mercurial repositories, S3 buckets, and GCS buckets. Terraform supports a number of common conventions and syntaxes for specifying module sources, as documented in the [Module Sources] page. References = [Module Sources]
NEW QUESTION # 62
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 'provider_type.name'
- B. terraform get 'provider_type.name'
- C. terraform state list
- 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 # 63
A provider configuration block is required in every Terraform configuration.
Example:
- A. True
- B. False
Answer: B
Explanation:
Explanation
A provider configuration block is not required in every Terraform configuration. A provider configuration block can be omitted if its contents would otherwise be empty. Terraform assumes an empty default configuration for any provider that is not explicitly configured. However, some providers may require some configuration arguments (such as endpoint URLs or cloud regions) before they can be used. A provider's documentation should list which configuration arguments it expects. For providers distributed on the Terraform Registry, versioned documentation is available on each provider's page, via the "Documentation" link in the provider's header1. References = [Provider Configuration]1
NEW QUESTION # 64
Multiple team members are collaborating on infrastructure using Terraform and want to format the* Terraform code following standard Terraform-style convention.
How should they ensure the code satisfies conventions?
- A. Replace all tabs with spaces
- B. Use terraform fmt
- C. Run terraform validate prior to executing terraform plan or terraform apply
- D. Terraform automatically formats configuration on terraform apply
Answer: B
Explanation:
The terraform fmt command is used to format Terraform configuration files to a canonical format and style. This ensures that all team members are using a consistent style, making the code easier to read and maintain. It automatically applies Terraform's standard formatting conventions to your configuration files, helping maintain consistency across the team's codebase.
Reference:
Terraform documentation on terraform fmt: Terraform Fmt
NEW QUESTION # 65
Module version is required to reference a module on the Terraform Module Registry.
- A. True
- B. False
Answer: B
Explanation:
Module version is optional to reference a module on the Terraform Module Registry. If you omit the version constraint, Terraform will automatically use the latest available version of the module
NEW QUESTION # 66
You should run terraform fnt to rewrite all Terraform configurations within the current working directory to conform to Terraform-style conventions.
- A. True
- B. False
Answer: A
Explanation:
You should run terraform fmt to rewrite all Terraform configurations within the current working directory to conform to Terraform-style conventions. This command applies a subset of the Terraform language style conventions, along with other minor adjustments for readability. It is recommended to use this command to ensure consistency of style across different Terraform codebases. The command is optional, opinionated, and has no customization options, but it can help you and your team understand the code more quickly and easily. Reference = : Command: fmt : Using Terraform fmt Command to Format Your Terraform Code
NEW QUESTION # 67
What is the Terraform style convention for indenting a nesting level compared to the one above it?
- A. With a tab
- B. With four spaces
- C. With three spaces
- D. With two spaces
Answer: D
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 # 68
Terraform configuration can only import modules from the public registry.
- A. True
- B. False
Answer: B
Explanation:
Explanation
Terraform configuration can import modules from various sources, not only from the public registry. Modules can be sourced from local file paths, Git repositories, HTTP URLs, Mercurial repositories, S3 buckets, and GCS buckets. Terraform supports a number of common conventions and syntaxes for specifying module sources, as documented in the [Module Sources] page. References = [Module Sources]
NEW QUESTION # 69
Which provider authentication method prevents credentials from being stored in the state file?
- A. Setting credentials as Terraform variables
- B. Specifying the login credentials in the provider block
- C. Using environment variables
- D. None of the above
Answer: D
Explanation:
None of the above methods prevent credentials from being stored in the state file. Terraform stores the provider configuration in the state file, which may include sensitive information such as credentials. This is a potential security risk and should be avoided if possible. To prevent credentials from being stored in the state file, you can use one of the following methods:
* Use environment variables to pass credentials to the provider. This way, the credentials are not part of the provider configuration and are not stored in the state file. However, this method may not work for some providers that require credentials to be set in the provider block.
* Use dynamic credentials to authenticate with your cloud provider. This way, Terraform Cloud or Enterprise will request temporary credentials from your cloud provider for each run and use them to provision your resources. The credentials are not stored in the statefile and are revoked after the run is completed. This method is supported for AWS, Google Cloud Platform, Azure, and Vault. References =
1: [Sensitive Values in State] : Authenticate providers with dynamic credentials
NEW QUESTION # 70
While attempting to deploy resources into your cloud provider using Terraform, you begin to see some odd behavior and experience slow responses. In order to troubleshoot you decide to turn on Terraform debugging.
Which environment variables must be configured to make Terraform's logging more verbose?
- A. TF_LOG
- B. TF_LOG_PAIH
- C. TF_VAR_log_level
- D. TF_VAR_log_path
Answer: A
Explanation:
To make Terraform's logging more verbose for troubleshooting purposes, you must configure theTF_LOG environment variable. This variable controls the level of logging and can be set to TRACE, DEBUG, INFO, WARN, or ERROR, with TRACE providing the most verbose output.References= Detailed debugging instructions and the use of environment variables likeTF_LOGfor increasing verbosity are part of Terraform's standard debugging practices
NEW QUESTION # 71
When should you run terraform init?
- A. Every time you run terraform apply
- B. After you start coding a new terraform project and before you run terraform plan for the first time.
- C. Before you start coding a new Terraform project
- D. After you run terraform plan for the time in a new terraform project and before you run terraform apply
Answer: B
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 # 72
You've used Terraform to deploy a virtual machine and a database. You want to replace this virtual machine instance with an identical one without affecting the database. What is the best way to achieve this using Terraform?
- A. Use the terraform apply command targeting the VM resources only
- B. Use the terraform state rm command to remove the VM from state file
- C. Delete the Terraform VM resources from your Terraform code then run terraform plan and terraform apply
- D. Use the terraform taint command targeting the VMs then run terraform plan and terraform apply
Answer: D
Explanation:
Explanation
The terraform taint command marks a resource as tainted, which means it will be destroyed and recreated on the next apply. This way, you can replace the VM instance without affecting the database or other resources. References = [Terraform Taint]
NEW QUESTION # 73
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 # 74
A module can always refer to all variables declared in its parent module.
- A. True
- B. False
Answer: B
Explanation:
Explanation
A module cannot always refer to all variables declared in its parent module, as it needs to explicitly declare input variables and assign values to them from the parent module's arguments. A module cannot access the parent module's variables directly, unless they are passed as input arguments.
NEW QUESTION # 75
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. Change the reference value to my-network,outputs,vmet_id
- B. Define the attribute vmet_id as a variable in the networking modeule
- C. Change the reference value module.my,network,outputs,vnet_id
- D. Define the attribute vnet_id as an output in the networking module
Answer: D
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 # 76
......
Try Free and Start Using Realistic Verified Terraform-Associate-003 Dumps Instantly.: https://www.pass4cram.com/Terraform-Associate-003_free-download.html
2025 The Most Effective Terraform-Associate-003 with 178 Questions Answers: https://drive.google.com/open?id=1c6w0qy5JAKlAZMassDfa227mj8EVz5D6