[May-2024] Check your preparation for HashiCorp Terraform-Associate-003 On-Demand Exam
Practice Exam Terraform-Associate-003 Realistic Dumps Verified Questions
HashiCorp Terraform-Associate-003 Exam Syllabus Topics:
| Topic | Details |
|---|---|
| Topic 1 |
|
| Topic 2 |
|
| Topic 3 |
|
| Topic 4 |
|
NEW QUESTION # 74
What is one disadvantage of using dynamic blocks in Terraform?
- A. They cannot be used to loop through a list of values
- B. Dynamic blocks can construct repeatable nested blocks
- C. Terraform will run more slowly
- D. They make configuration harder to read and understand
Answer: D
Explanation:
This is one disadvantage of using dynamic blocks in Terraform, as they can introduce complexity and reduce readability of the configuration. The other options are either advantages or incorrect statements.
NEW QUESTION # 75
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. Terraform Cloud
- B. Amazon S3
- C. Git
- D. Artifactory
Answer: C
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 # 76
Which command add existing resources into Terraform state?
- A. Terraform import
- B. Terraform init
- C. All of these
- D. Terraform plan
- E. Terraform refresh
Answer: A
Explanation:
Explanation
This is the command that can add existing resources into Terraform state, by matching them with the corresponding configuration blocks in your files.
NEW QUESTION # 77
Which are forbidden actions when the terraform state file is locked? Choose three correct answers.
- A. Terraform validate
- B. Terraform for
- C. Terraform destroy
- D. Terraform apply
- E. Terraform state list
- F. Terraform validate
Answer: A,C,D
Explanation:
Explanation
The terraform state file is locked when a Terraform operation that could write state is in progress. This prevents concurrent state operations that could corrupt the state. The forbidden actions when the state file is locked are those that could write state, such as terraform apply, terraform destroy, terraform refresh, terraform taint, terraform untaint, terraform import, and terraform state *. The terraform validate command is also forbidden, because it requires an initialized working directory with the state file. The allowed actions when the state file is locked are those that only read state, such as terraform plan, terraform show, terraform output, and terraform console. References = [State Locking] and [Command: validate]
NEW QUESTION # 78
Which of the following is not a valid siring function in Terraform?
- A. slice
- B. Split
- C. choaf
- D. join
Answer: C
Explanation:
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 # 79
You should run terraform fnt to rewrite all Terraform configurations within the current working directory to conform to Terraform-style conventions.
- A. False
- B. True
Answer: B
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 # 80
A Terraform provider is NOT responsible for:
- A. Exposing resources and data sources based on an APUI
- B. Provisioning infrastructure in multiple
- C. Understanding API interactions with some service
- D. Managing actions to take based on resources differences
Answer: B
Explanation:
This is not a responsibility of a Terraform provider, as it does not make sense grammatically or logically. A Terraform provider is responsible for exposing resources and data sources based on an API, managing actions to take based on resource differences, and understanding API interactions with some service.
NEW QUESTION # 81
Which of these ate secure options for storing secrets for connecting to a Terraform remote backend? Choose two correct answers.
- A. Defined in a connection configuration outside of Terraform
- B. Inside the backend block within the Terraform configuration
- C. Defined in Environment variables
- D. A variable file
Answer: A,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 # 82
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 modules
- B. None of the above
- C. Terraform data sources
- D. Terraform local values
- E. Terraform workspaces
Answer: E
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 # 83
You have never used Terraform before and would like to test it out using a shared team account for a cloud provider. The shared team account already contains 15 virtual machines (VM). You develop a Terraform configuration containing one VM. perform terraform apply, and see that your VM was created successfully.
What should you do to delete the newly-created VM with Terraform?
- A. Delete the VM using the cloud provider console and terraform apply to apply the changes to the Terraform state file.
- B. The Terraform state file only contains the one new VM. Execute terraform destroy.
- C. The Terraform state file contains all 16 VMs in the team account. Execute terraform destroy and select the newly-created VM.
- D. Delete the Terraform state file and execute terraform apply.
Answer: B
Explanation:
Explanation
This is the best way to delete the newly-created VM with Terraform, as it will only affect the resource that was created by your configuration and state file. The other options are either incorrect or inefficient.
NEW QUESTION # 84
You decide to move a Terraform state file to Amazon S3 from another location. You write the code below into a file called backend.tf.
Which command will migrate your current state file to the new S3 remote backend?
- A. terraform state
- B. terraform refresh
- C. terraform push
- D. terraform init
Answer: D
Explanation:
This command will initialize the new backend and prompt you to migrate the existing state file to the new location3. The other commands are not relevant for this task.
NEW QUESTION # 85
Which of the following is not a valid Terraform variable type?
- A. array
- B. string
- C. nap
- D. list
Answer: A
Explanation:
Explanation
This is not a valid Terraform variable type. The other options are valid variable types that can store different kinds of values2.
NEW QUESTION # 86
You ate making changes to existing Terraform code to add some new infrastructure. When is the best time to run terraform validate?
- A. After you run terraform apply so you can validate your infrastructure
- B. Before you run terraform apply so you can validate your provider credentials
- C. After you run terraform plan so you can validate that your state file is consistent with your infrastructure
- D. Before you run terraform plan so you can validate your code syntax
Answer: D
Explanation:
Explanation
This is the best time to run terraform validate, as it will check your code for syntax errors, typos, and missing arguments before you attempt to create a plan. The other options are either incorrect or unnecessary.
NEW QUESTION # 87
When should you write Terraform configuration files for existing infrastructure that you want to start managing with Terraform?
- A. After you run terraform import
- B. Terraform will generate the corresponding configuration files for you
- C. You can import infrastructure without corresponding Terraform code
- D. Before you run terraform Import
Answer: D
Explanation:
Explanation
You need to write Terraform configuration files for the existing infrastructure that you want to import into Terraform, otherwise Terraform will not know how to manage it. The configuration files should match the type and name of the resources that you want to import.
NEW QUESTION # 88
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.vsphere_datacenter.DC.id
- B. Data,dc,id
- C. Vsphere_datacenter.dc.id
- D. Data.vsphere_datacenter,dc
Answer: A
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 # 89
Which of the following is not a key principle of infrastructure as code?
- A. Idempotence
- B. Golden images
- C. Versioned infrastructure
- D. Self-describing infrastructure
Answer: B
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.
NEW QUESTION # 90
You have multiple team members collaborating on infrastructure as code (IaC) using Terraform, and want to apply formatting standards for readability.
How can you format Terraform HCL (HashiCorp Configuration Language) code according to standard Terraform style convention?
- A. Designate one person in each team to review and format everyone's code
- B. Write a shell script to transform Terraform files using tools such as AWK, Python, and sed
- C. Run the terraform fmt command during the code linting phase of your CI/CD process Most Voted
- D. Manually apply two spaces indentation and align equal sign "=" characters in every Terraform file (*.tf)
Answer: C
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. Running this command on your configuration files before committing them to source control can help ensure consistency of style between different Terraform codebases, and can also make diffs easier to read. You can also use the -check and -diff options to check if the files are formatted and display the formatting changes respectively2. Running the terraform fmt command during the code linting phase of your CI/CD process can help automate this process and enforce the formatting standards for your team. Reference = [Command: fmt]2
NEW QUESTION # 91
Which are examples of infrastructure as code? Choose two correct answers.
- A. Change management database records
- B. Doctor files
- C. Versioned configuration files
- D. Cloned virtual machine images
Answer: C
Explanation:
These are examples of infrastructure as code (IaC), which is a practice of managing and provisioning infrastructure through machine-readable definition files, rather than physical hardware configuration or interactive configuration tools.
NEW QUESTION # 92
What is the workflow for deploying new infrastructure with Terraform?
- A. Write Terraform configuration, run terraform plan to initialize the working directory or workspace, and terraform apply to create the infrastructure
- B. Write Terraform configuration, run terraform init to initialize the working directory or workspace, and run terraform apply
- C. Write Terraform configuration, run terraform apply to create infrastructure, use terraform validate to confirm Terraform deployed resources correctly
- D. Write Terraform configuration, run terraform show to view proposed changes, and terraform apply to create new infrastructure
Answer: B
Explanation:
Explanation
This is the workflow for deploying new infrastructure with Terraform, as it will create a plan and apply it to the target environment. The other options are either incorrect or incomplete.
NEW QUESTION # 93
How does Terraform determine dependencies between resources?
- A. Terraform requires resources in a configuration to be listed m the order they will be created to determine dependencies
- B. Terraform requires all dependencies between resources to be specified using the depends_on parameter
- C. Terraform automatically builds a resource graph based on resources provisioners, special meta-parameters, and the stale file (if present}
- D. Terraform requires resource dependencies to be defined as modules and sourced in order
Answer: C
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 # 94
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. Reduces risk of operator error
- D. Secures your credentials
- E. Provisions the same resources at a lower cost
Answer: B,C
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 # 95
......
Valid Terraform-Associate-003 Dumps for Helping Passing HashiCorp Exam: https://www.exam4labs.com/Terraform-Associate-003-practice-torrent.html
Download Free HashiCorp Terraform-Associate-003 Exam Questions & Answer: https://drive.google.com/open?id=1_mn2ru2t87cikB-7B_agfLVYmOqJhTkh