HashiCorp Terraform Associate Exam Practice Questions (P. 5)
- 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 #41
What features does the hosted service Terraform Cloud provide? (Choose two.)
- AAutomated infrastructure deployment visualization
- BAutomatic backups
- CRemote state storageMost Voted
- DA web-based user interface (UI)Most Voted
Correct Answer:
BC
Reference:
https://www.terraform.io/docs/enterprise/admin/automated-recovery.html https://www.terraform.io/docs/language/state/remote.html
BC
Reference:
https://www.terraform.io/docs/enterprise/admin/automated-recovery.html https://www.terraform.io/docs/language/state/remote.html

send
light_mode
delete
Question #42
Where does the Terraform local backend store its state?
- AIn the /tmp directory
- BIn the terraform file
- CIn the terraform.tfstate fileMost Voted
- DIn the user's terraform.state file
Correct Answer:
C
The local backend stores state on the local filesystem, locks that state using system APIs, and performs operations locally.
Reference:
https://www.terraform.io/docs/language/settings/backends/local.html
C
The local backend stores state on the local filesystem, locks that state using system APIs, and performs operations locally.
Reference:
https://www.terraform.io/docs/language/settings/backends/local.html
send
light_mode
delete
Question #43
Which option can not be used to keep secrets out of Terraform configuration files?
- AA Terraform provider
- BEnvironment variables
- CA -var flag
- Dsecure stringMost Voted
Correct Answer:
C
Reference:
https://secrethub.io/blog/secret-management-for-terraform/
C
Reference:
https://secrethub.io/blog/secret-management-for-terraform/
send
light_mode
delete
Question #44
What is one disadvantage of using dynamic blocks in Terraform?
- AThey cannot be used to loop through a list of values
- BDynamic blocks can construct repeatable nested blocks
- CThey make configuration harder to read and understandMost Voted
- DTerraform will run more slowly
Correct Answer:
A
Reference:
https://github.com/hashicorp/terraform/issues/19291
A
Reference:
https://github.com/hashicorp/terraform/issues/19291
send
light_mode
delete
Question #45
Only the user that generated a plan may apply it.
- ATrue
- BFalseMost Voted
Correct Answer:
B
B

Absolutely, B is spot on! A Terraform plan isn't locked to the user who created it. For practicality in team scenarios or automated systems, plans are often prepared and saved by one process or individual and then executed by another. This flexibility is crucial for collaborative projects or complex CI/CD pipelines where different stages might be handled by different entities or even systems. This method enhances workflow smoothness and integration in diverse environments. Remember, Terraform's infrastructure as code model is designed to support this kind of operational agility.
send
light_mode
delete
Question #46
Examine the following Terraform configuration, which uses the data source for an AWS AMI.
What value should you enter for the ami argument in the AWS instance resource?

What value should you enter for the ami argument in the AWS instance resource?

- Aaws_ami.ubuntu
- Bdata.aws_ami.ubuntu
- Cdata.aws_ami.ubuntu.idMost Voted
- Daws_ami.ubuntu.id
Correct Answer:
C
resource "aws_instance" "web" {
ami = data.aws_ami.ubuntu.id
Reference:
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/instance
C
resource "aws_instance" "web" {
ami = data.aws_ami.ubuntu.id
Reference:
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/instance
send
light_mode
delete
Question #47
FILL BLANK -
You need to specify a dependency manually.
What resource meta-parameter can you use to make sure Terraform respects the dependency?
Type your answer in the field provided. The text field is not case-sensitive and all variations of the correct answer are accepted.
You need to specify a dependency manually.
What resource meta-parameter can you use to make sure Terraform respects the dependency?
Type your answer in the field provided. The text field is not case-sensitive and all variations of the correct answer are accepted.
Correct Answer:
depends_on
depends_on

If you're looking to manually specify a dependency in Terraform, the 'depends_on' meta-argument is your go-to tool. This allows you to explicitly dictate that certain resources or modules must be processed prior to executing actions on the current resource or module in question. Essentially, it ensures related resources are tackled in the correct sequence, maintaining a smooth and error-free deployment.
send
light_mode
delete
Question #48
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?
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?
- AThe Terraform state file contains all 16 VMs in the team account. Execute terraform destroy and select the newly-created VM.
- BThe Terraform state file only contains the one new VM. Execute terraform destroy.Most Voted
- CDelete the Terraform state file and execute Terraform apply.
- DDelete the VM using the cloud provider console and terraform apply to apply the changes to the Terraform state file.
Correct Answer:
B
B

When using Terraform and you've set up just a single new VM within a configuration, executing `terraform destroy` will only affect resources Terraform managed in that configuration. Since the state file for this particular configuration includes only the new VM you've added and none of the pre-existing 15 VMs, this command ensures only the newly created VM is targeted and deleted. This method avoids unintended disruptions on other resources not managed in this specific Terraform setup. Remember, Terraform’s operations are scoped tightly to the resources its configuration file defines.
send
light_mode
delete
Question #49
What is the name assigned by Terraform to reference this resource?


send
light_mode
delete
Question #50
Setting the TF_LOG environment variable to DEBUG causes debug messages to be logged into syslog.
- ATrue
- BFalseMost Voted
Correct Answer:
A
Reference:
https://www.terraform.io/docs/internals/debugging.html
A
Reference:
https://www.terraform.io/docs/internals/debugging.html

send
light_mode
delete
All Pages