Free HashiCorp Terraform-Associate-003 Exam Actual Questions

The questions for Terraform-Associate-003 were last updated On Dec 17, 2024

Question No. 1

What does this code do?

Show Answer Hide Answer
Correct Answer: A

This is what this code does, by using the pessimistic constraint operator (~>), which specifies an acceptable range of versions for a provider or module.


Question No. 2

When you include a module block in your configuration that references a module from the Terraform Registry, the "version" attribute is required.

Show Answer Hide Answer
Correct Answer: B

The 'version' attribute is optional when referencing a module from the Terraform Registry. If not specified, the latest version will be used, but it is often recommended to specify a version to ensure consistency across environments.

References:

Terraform Module Versioning


Question No. 3

A provider configuration block is required in every Terraform configuration.

Example:

Show Answer Hide Answer
Correct Answer: B

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


Question No. 4

As a developer, you want to ensure your plugins are up to date with the latest versions. Which Terraform command should you use?

Show Answer Hide Answer
Correct Answer: C

This command will upgrade the plugins to the latest acceptable version within the version constraints specified in the configuration. The other commands do not have an -upgrade option.


Question No. 5

Which command must you first run before performing further Terraform operations in a working directory?

Show Answer Hide Answer
Correct Answer: D

terraform init is the first command that should be run after writing a new Terraform configuration or cloning an existing one from version control. It initializes a working directory containing Terraform configuration files and downloads any required providers and modules. The other commands are used for different purposes, such as importing existing resources, switching between workspaces, generating execution plans, etc.