HashiCorp certification · Exam Terraform-Associate-003

Terraform-Associate-003 Mock Exam Page 6

HashiCorp Certified: Terraform Associate (003) (HCTA0-003)

Free Terraform-Associate-003 mock exam questions 51–58, each with the answer and an explanation.

20 questions · 33 minutes · free, no sign-up

Free Terraform-Associate-003 questions

51–58 of 58 free
Question 51 Choose 1
Module version is required to reference a module on the Terraform Module Registry.
Show answerHide answer

Correct answer: B False

Explanation

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
Question 52 Choose 1
It is best practice to store secret data in the same version control repository as your Terraform configuration.
Show answerHide answer

Correct answer: B False

Explanation

Explanation: It is not a best practice to store secret data in the same version control repository as your Terraform configuration, as it could expose your sensitive information to unauthorized parties or compromise your security. You should use environment variables, vaults, or other mechanisms to store and provide secret data to Terraform.
Question 53 Choose 1
You can access state stored with the local backend by using terraform_remote_state data source.
Show answerHide answer

Correct answer: B False

Explanation

Explanation: You cannot access state stored with the local backend by using the terraform_remote_state data source. The terraform_remote_state data source is used to retrieve the root module output values from some other Terraform configuration using the latest state snapshot from the remote backend. It requires a backend that supports remote state storage, such as S3, Consul, AzureRM, or GCS. The local backend stores the state file locally on the filesystem, which terraform_remote_state cannot access.
Question 54 Choose 1
What Terraform command always causes a state file to be updated with changes that might have been made outside of Terraform?
Show answerHide answer

Correct answer: A Terraform plan –refresh-only

Explanation

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.
Question 55 Choose 1
Terraform configuration (including any module references) can contain only one Terraform provider type.
Show answerHide answer

Correct answer: B False

Explanation

Explanation: Terraform configuration (including any module references) can contain more than one Terraform provider type. Terraform providers are plugins that Terraform uses to interact with various cloud services and other APIs. A Terraform configuration can use multiple providers to manage resources across different platforms and services. For example, a configuration can use the AWS provider to create a virtual machine, the Cloudflare provider to manage DNS records, and the GitHub provider to create a repository. Terraform supports hundreds of providers for different use cases and scenarios. References = [Providers], [Provider Requirements], [Provider Configuration]
Question 56 Choose 2
Which of these ate secure options for storing secrets for connecting to a Terraform remote backend? Choose two correct answers.
Show answerHide answer

Correct answer: B, D Defined in Environment variablesDefined in a connection configuration outside of Terraform

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
Question 57 Choose 1
Outside of the required_providers block, Terraform configurations always refer to providers by their local names.
Show answerHide answer

Correct answer: B False

Explanation

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.
Question 58 Choose 2
Which of the following are advantages of using infrastructure as code (laC) instead of provisioning with a graphical user interface (GUI)? Choose two correct answers.
Show answerHide answer

Correct answer: B, E Lets you version, reuse, and share infrastructure configurationReduces risk of operator error

Explanation

Explanation: Infrastructure as code (IaC) is a way of managing and provisioning cloud infrastructure using programming techniques instead of manual processes1. IaC has many advantages over using a graphical user interface (GUI) for provisioning infrastructure, such as:
•Versioning: IaC allows you to store your infrastructure configuration in a version control system, such as Git, and track changes over time. This enables you to roll back to previous versions, compare differences, and collaborate with other developers2.
•Reusability: IaC allows you to create reusable modules and templates that can be applied to different environments, such as development, testing, and production. This reduces duplication, improves consistency, and speeds up deployment3.
•Sharing: IaC allows you to share your infrastructure configuration with other developers, teams, or organizations, and leverage existing code from open source repositories or registries. This fosters best practices, innovation, and standardization4.
•Risk reduction: IaC reduces the risk of human error, configuration drift, and security breaches that can occur when provisioning infrastructure manually or using a GUI. IaC also enables you to perform automated testing, validation, and compliance checks on your infrastructure before deploying it5.
References =
•1: What is Infrastructure as Code? Explained for Beginners - freeCodeCamp.org
•2: The benefits of Infrastructure as Code - Microsoft Community Hub
•3: Infrastructure as Code : Best Practices, Benefits & Examples - Spacelift
•4: 5 Benefits of Infrastructure as Code (IaC) for Modern Businesses in the Cloud
•5: The 7 Biggest Benefits of Infrastructure as Code - DuploCloud

That's the last free question

You've seen the free 30% (58 of 194 questions). Full access unlocks every question and full-length Terraform-Associate-003 mock exams (65 questions, 105 minutes), a different mock on every attempt.

Unlock full mock exam
Full mock exam

Sit the Terraform-Associate-003 exam before exam day

Full-length mocks with the same number of questions and the same time limit as the real Terraform-Associate-003 exam. Every attempt draws a new set of questions from the full bank, so you can keep going until you pass comfortably.

Get full Terraform-Associate-003 mock exam
  • 65questions per mock
  • 105 mintime limit
  • 194questions in the bank
  • Newmock on every attempt