HashiCorp Terraform Associate Exam Practice Questions (P. 3)
- Full Access (358 questions)
- Six months of Premium Access
- Access to one million comments
- Seamless ChatGPT Integration
- Ability to download PDF files
- Anki Flashcard files for revision
- No Captcha & No AdSense
- Advanced Exam Configuration
Question #21
You have recently started a new job at a retailer as an engineer. As part of this new role, you have been tasked with evaluating multiple outages that occurred during peak shopping time during the holiday season. Your investigation found that the team is manually deploying new compute instances and configuring each compute instance manually. This has led to inconsistent configuration between each compute instance.
How would you solve this using infrastructure as code?
How would you solve this using infrastructure as code?
- AImplement a ticketing workflow that makes engineers submit a ticket before manually provisioning and configuring a resource
- BImplement a checklist that engineers can follow when configuring compute instances
- CReplace the compute instance type with a larger version to reduce the number of required deployments
- DImplement a provisioning pipeline that deploys infrastructure configurations committed to your version control system following code reviewsMost Voted
Correct Answer:
A
A

Implementing a provisioning pipeline, as described in option D, is the most effective method to solve the inconsistency issue in configuring compute instances. This approach allows for automated, uniform configuration management across all instances through the use of infrastructure as code principles. Using a version control system to manage infrastructure code ensures that any deployments are consistent, reproducible, and can be easily rolled back if issues occur. Moreover, adding code reviews introduces an extra layer of validation, enhancing the reliability and stability of the deployed infrastructure.
send
light_mode
delete
Question #22
terraform init initializes a sample main.tf file in the current directory.
- ATrue
- BFalseMost Voted
Correct Answer:
A
A

The correct understanding here revolves around the function of the 'terraform init' command. It does not create nor initialize a sample main.tf file but rather prepares the working directory for use by initializing the backend, installing required provider plugins, and setting up the necessary environment to manage the infrastructure. The existence of a main.tf file or any .tf files is a prerequisite, and if absent, leads to warnings about the lack of configuration files, not their automatic creation.
send
light_mode
delete
Question #23
Which two steps are required to provision new infrastructure in the Terraform workflow? (Choose two.)
- ADestroy
- BApplyMost Voted
- CImport
- DInitMost Voted
- EValidate
Correct Answer:
BD
Reference:
https://www.terraform.io/guides/core-workflow.html
BD
Reference:
https://www.terraform.io/guides/core-workflow.html
send
light_mode
delete
Question #24
Why would you use the terraform taint command?
- AWhen you want to force Terraform to destroy a resource on the next apply
- BWhen you want to force Terraform to destroy and recreate a resource on the next applyMost Voted
- CWhen you want Terraform to ignore a resource on the next apply
- DWhen you want Terraform to destroy all the infrastructure in your workspace
Correct Answer:
B
The terraform taint command manually marks a Terraform-managed resource as tainted, forcing it to be destroyed and recreated on the next apply.
Reference:
https://www.terraform.io/docs/cli/commands/taint.html
B
The terraform taint command manually marks a Terraform-managed resource as tainted, forcing it to be destroyed and recreated on the next apply.
Reference:
https://www.terraform.io/docs/cli/commands/taint.html
send
light_mode
delete
Question #25
Terraform requires the Go runtime as a prerequisite for installation.
- ATrue
- BFalseMost Voted
Correct Answer:
B
Reference:
https://www.terraform.io/docs/extend/guides/v1-upgrade-guide.html
B
Reference:
https://www.terraform.io/docs/extend/guides/v1-upgrade-guide.html

send
light_mode
delete
Question #26
When should you use the force-unlock command?
- AYou see a status message that you cannot acquire the lock
- BYou have a high priority change
- CAutomatic unlocking failedMost Voted
- DYou apply failed due to a state lock
Correct Answer:
C
Manually unlock the state for the defined configuration.
Reference:
https://www.terraform.io/docs/cli/commands/force-unlock.html
C
Manually unlock the state for the defined configuration.
Reference:
https://www.terraform.io/docs/cli/commands/force-unlock.html
send
light_mode
delete
Question #27
Terraform can import modules from a number of sources `" which of the following is not a valid source?
- AFTP serverMost Voted
- BGitHub repository
- CLocal path
- DTerraform Module Registry
Correct Answer:
A
A

Terraform supports a range of sources for importing modules, including local paths, Git repositories, and official module registries. However, there's no support for importing modules directly from FTP servers. This limitation is important to keep in mind when planning module management and sourcing in your Terraform configurations.
send
light_mode
delete
Question #28
Which of the following is available only in Terraform Enterprise or Cloud workspaces and not in Terraform CLI?
- ASecure variable storageMost Voted
- BSupport for multiple cloud providers
- CDry runs with terraform plan
- DUsing the workspace as a data source
Correct Answer:
A
A

Absolutely right, secure variable storage is the unique feature of Terraform Enterprise and Terraform Cloud that isn't found in the Terraform CLI. This feature provides essential security for sensitive data by encrypting and protecting variables like passwords and API keys. It's a game-changer because it avoids the risk of exposing such critical information in plain text, ensuring that your infrastructure remains secure and compliant.
send
light_mode
delete
Question #29
terraform validate validates the syntax of Terraform files.
- ATrueMost Voted
- BFalse
Correct Answer:
A
The terraform validate command validates the syntax and arguments of the Terraform configuration files.
Reference:
https://www.terraform.io/docs/cli/code/index.html
A
The terraform validate command validates the syntax and arguments of the Terraform configuration files.
Reference:
https://www.terraform.io/docs/cli/code/index.html
send
light_mode
delete
Question #30
You have 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 will be deleted by Terraform.
Which command should you use to show all of the resources that will be deleted? (Choose two.)
Terraform configuration. To be safe, you would like to first see all the infrastructure that will be deleted by Terraform.
Which command should you use to show all of the resources that will be deleted? (Choose two.)
- ARun terraform plan -destroy.Most Voted
- BThis is not possible. You can only show resources that will be created.
- CRun terraform state rm *.
- DRun terraform destroy and it will first output all the resources that will be deleted before prompting for approval.Most Voted
Correct Answer:
CD
Reference:
https://www.terraform.io/docs/cli/commands/state/rm.html
CD
Reference:
https://www.terraform.io/docs/cli/commands/state/rm.html

send
light_mode
delete
All Pages