Terraform Associate: HashiCorp Certified Part 1
Question #: 1
Topic #: 1
The terraform.tfstate file always matches your currently built infrastructure.
A. True
B. False
Selected Answer: B
Question #: 2
Topic #: 1
One remote backend configuration always maps to a single remote workspace.
A. True
B. False
Selected Answer: B
Question #: 3
Topic #: 1
How is the Terraform remote backend different than other state backends such as S3, Consul, etc.?
A. It can execute Terraform runs on dedicated infrastructure on premises or in Terraform Cloud
B. It doesn’t show the output of a terraform apply locally
C. It is only available to paying customers
D. All of the above
Selected Answer: A
Question #: 4
Topic #: 1
What is the workflow for deploying new infrastructure with Terraform?
A. terraform plan to import the current infrastructure to the state file, make code changes, and terraform apply to update the infrastructure.
B. Write a Terraform configuration, run terraform show to view proposed changes, and terraform apply to create new infrastructure.
C. terraform import to import the current infrastructure to the state file, make code changes, and terraform apply to update the infrastructure.
D. Write a Terraform configuration, run terraform init, run terraform plan to view planned infrastructure changes, and terraform apply to create new infrastructure.
Selected Answer: D
Question #: 5
Topic #: 1
A provider configuration block is required in every Terraform configuration.
Example:
A. True
B. False
Selected Answer: B
Question #: 6
Topic #: 1
A provider configuration block is required in every Terraform configuration.
Example:
A. True
B. False
Selected Answer: B
Question #: 7
Topic #: 1
You run a local-exec provisioner in a null resource called null_resource.run_script and realize that you need to rerun the script.
Which of the following commands would you use first?
A. terraform taint null_resource.run_script
B. terraform apply -target=null_resource.run_script
C. terraform validate null_resource.run_script
D. terraform plan -target=null_resource.run_script
Selected Answer: A
Question #: 8
Topic #: 1
You run a local-exec provisioner in a null resource called null_resource.run_script and realize that you need to rerun the script.
Which of the following commands would you use first?
A. terraform taint null_resource.run_script
B. terraform apply -target=null_resource.run_script
C. terraform validate null_resource.run_script
D. terraform plan -target=null_resource.run_script
Selected Answer: A
Question #: 9
Topic #: 1
Which provisioner invokes a process on the resource created by Terraform?
A. remote-exec
B. null-exec
C. local-exec
D. file
Selected Answer: A
Question #: 10
Topic #: 1
Which of the following is not true of Terraform providers?
A. Providers can be written by individuals
B. Providers can be maintained by a community of users
C. Some providers are maintained by HashiCorp
D. Major cloud vendors and non-cloud vendors can write, maintain, or collaborate on Terraform providers
E. None of the above
Selected Answer: E
Question #: 11
Topic #: 1
What command does Terraform require the first time you run it within a configuration directory?
A. terraform import
B. terraform init
C. terraform plan
D. terraform workspace
Selected Answer: B
Question #: 12
Topic #: 1
You have deployed a new webapp with a public IP address on a cloud provider. However, you did not create any outputs for your code.
What is the best method to quickly find the IP address of the resource you deployed?
A. Run terraform output ip_address to view the result
B. In a new folder, use the terraform_remote_state data source to load in the state file, then write an output for each resource that you find the state file
C. Run terraform state list to find the name of the resource, then terraform state show to find the attributes including public IP address
D. Run terraform destroy then terraform apply and look for the IP address in stdout
Selected Answer: C
Question #: 13
Topic #: 1
Which of the following is not a key principle of infrastructure as code?
A. Versioned infrastructure
B. Golden images
C. Idempotence
D. Self-describing infrastructure
Selected Answer: B
Question #: 14
Topic #: 1
Terraform variables and outputs that set the “description” argument will store that description in the state file.
A. True
B. False
Selected Answer: B
Question #: 15
Topic #: 1
What is the provider for this fictitious resource?
A. vpc
B. main
C. aws
D. test
Selected Answer: C
Question #: 16
Topic #: 1
If you manually destroy infrastructure, what is the best practice reflecting this change in Terraform?
A. Run terraform refresh
B. It will happen automatically
C. Manually update the state fire
D. Run terraform import
Selected Answer: A
Question #: 17
Topic #: 1
What is not processed when running a terraform refresh?
A. State file
B. Configuration file
C. Credentials
D. Cloud provider
Selected Answer: B
Question #: 18
Topic #: 1
What information does the public Terraform Module Registry automatically expose about published modules?
A. Required input variables
B. Optional inputs variables and default values
C. Outputs
D. All of the above
E. None of the above
Selected Answer: D
Question #: 19
Topic #: 1
If a module uses a local values, you can expose that value with a terraform output.
A. True
B. False
Selected Answer: A
Question #: 20
Topic #: 1
You should store secret data in the same version control repository as your Terraform configuration.
A. True
B. False
Selected Answer: B
Question #: 21
Topic #: 1
Which of the following is not a valid string function in Terraform?
A. split
B. join
C. slice
D. chomp
Selected Answer: C
Question #: 22
Topic #: 1
You have provisioned some virtual machines (VMs) on Google Cloud Platform (GCP) using the gcloud command line tool. However, you are standardizing with
Terraform and want to manage these VMs using Terraform instead.
What are the two things you must do to achieve this? (Choose two.)
A. Provision new VMs using Terraform with the same VM names
B. Use the terraform import command for the existing VMs
C. Write Terraform configuration for the existing VMs
D. Run the terraform import-gcp command
Selected Answer: BC
Question #: 23
Topic #: 1
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?
A. Implement a ticketing workflow that makes engineers submit a ticket before manually provisioning and configuring a resource
B. Implement a checklist that engineers can follow when configuring compute instances
C. Replace the compute instance type with a larger version to reduce the number of required deployments
D. Implement a provisioning pipeline that deploys infrastructure configurations committed to your version control system following code reviews
Selected Answer: D
Question #: 24
Topic #: 1
terraform init initializes a sample main.tf file in the current directory.
A. True
B. False
Selected Answer: A
Question #: 25
Topic #: 1
Which two steps are required to provision new infrastructure in the Terraform workflow? (Choose two.)
A. Destroy
B. Apply
C. Import
D. Init
E. Validate
Selected Answer: BD
Question #: 26
Topic #: 1
Why would you use the terraform taint command?
A. When you want to force Terraform to destroy a resource on the next apply
B. When you want to force Terraform to destroy and recreate a resource on the next apply
C. When you want Terraform to ignore a resource on the next apply
D. When you want Terraform to destroy all the infrastructure in your workspace
Selected Answer: B
Question #: 27
Topic #: 1
Terraform requires the Go runtime as a prerequisite for installation.
A. True
B. False
Selected Answer: B
Question #: 28
Topic #: 1
When should you use the force-unlock command?
A. You see a status message that you cannot acquire the lock
B. You have a high priority change
C. Automatic unlocking failed
D. You apply failed due to a state lock
Selected Answer: C
Question #: 29
Topic #: 1
Terraform can import modules from a number of sources `” which of the following is not a valid source?
A. FTP server
B. GitHub repository
C. Local path
D. Terraform Module Registry
Selected Answer: A
Question #: 30
Topic #: 1
Terraform can import modules from a number of sources `” which of the following is not a valid source?
A. FTP server
B. GitHub repository
C. Local path
D. Terraform Module Registry
Selected Answer: A