Deck 1: HashiCorp Certified: Terraform Associate

Full screen (f)
exit full mode
Question
Which of the following is the correct way to pass the value in the variable num_servers into a module with the input servers?

A) servers = num_servers
B) servers = variable.num_servers
C) servers = var(num_servers)
D) servers = var.num_servers
Use Space or
up arrow
down arrow
to flip the card.
Question
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
Question
Terraform requires the Go runtime as a prerequisite for installation.
Question
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
Question
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
Question
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
Question
Which of the following is available only in Terraform Enterprise or Cloud workspaces and not in Terraform CLI?

A) Secure variable storage
B) Support for multiple cloud providers
C) Dry runs with terraform plan
D) Using the workspace as a data source
Question
Which of the following is not a valid string function in Terraform?

A) split
B) join
C) slice
D) chomp
Question
Terraform variables and outputs that set the "description" argument will store that description in the state file.
Question
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) Your apply failed due to a state lock
Question
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
Question
If a module uses a local variable, you can expose that value with a terraform output.
Question
You have multiple team members collaborating on infrastructure as code (IaC) using Terraform, and want to apply formatting standards for readability. How can you format Terraform HCL (HashiCorp Configuration Language) code according to standard Terraform style convention?

A) Run the terraform fmt command during the code linting phase of your CI/CD process
B) Designate one person in each team to review and format everyone's code
C) Manually apply two spaces indentation and align equal sign "=" characters in every Terraform file (*.tf)
D) Write a shell script to transform Terraform files using tools such as AWK, Python, and sed Write a shell script to transform Terraform files using tools such as AWK, Python, and sed
Question
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
Question
One remote backend configuration always maps to a single remote workspace.
Question
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
Question
What does the default "local" Terraform backend store?

A) tfplan files
B) Terraform binary
C) Provider plugins
D) State file
Question
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
Question
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.)

A) Run terraform plan -destroy.
B) This is not possible. You can only show resources that will be created.
C) Run terraform state rm *.
D) Run terraform destroy and it will first output all the resources that will be deleted before prompting for approval.
Question
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
Question
Only the user that generated a plan may apply it.
Question
What command should you run to display all workspaces for the current configuration?

A) terraform workspace
B) terraform workspace show
C) terraform workspace list
D) terraform show workspace
Question
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? <strong>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?  </strong> A) aws_ami.ubuntu B) data.aws_ami.ubuntu C) data.aws_ami.ubuntu.id D) aws_ami.ubuntu.id <div style=padding-top: 35px>

A) aws_ami.ubuntu
B) data.aws_ami.ubuntu
C) data.aws_ami.ubuntu.id
D) aws_ami.ubuntu.id
Question
When does terraform apply reflect changes in the cloud environment?

A) Immediately
B) However long it takes the resource provider to fulfill the request
C) After updating the state file
D) Based on the value provided to the -refresh command line argument
E) None of the above
Question
What value does the Terraform Cloud/Terraform Enterprise private module registry provide over the public Terraform Module Registry?

A) The ability to share modules with public Terraform users and members of Terraform Enterprise Organizations
B) The ability to tag modules by version or release
C) The ability to restrict modules to members of Terraform Cloud or Enterprise organizations
D) The ability to share modules publicly with any user of Terraform
Question
Where does the Terraform local backend store its state?

A) In the /tmp directory
B) In the terraform.tfvars file
C) In the terraform.tfstate file
D) In the user's .terraformrc file
Question
What features does the hosted service Terraform Cloud provide? (Choose two.)

A) Automated infrastructure deployment visualization
B) Automatic backups
C) Remote state storage
D) A web-based user interface (UI)
Question
Setting the TF_LOG environment variable to DEBUG causes debug messages to be logged into syslog.
Question
What is the name assigned by Terraform to reference this resource? <strong>What is the name assigned by Terraform to reference this resource?  </strong> A) dev B) azurerm_resource_group C) azurerm D) test <div style=padding-top: 35px>

A) dev
B) azurerm_resource_group
C) azurerm
D) test
Question
When using a module block to reference a module stored on the public Terraform Module Registry such as: <strong>When using a module block to reference a module stored on the public Terraform Module Registry such as:   How do you specify version 1.0.0?</strong> A) Modules stored on the public Terraform Module Registry do not support versioning B) Append ?ref=v1.0.0 argument to the source path C) Add version = 1.0.0 attribute to module block D) Nothing - modules stored on the public Terraform Module Registry always default to version 1.0.0 <div style=padding-top: 35px> How do you specify version 1.0.0?

A) Modules stored on the public Terraform Module Registry do not support versioning
B) Append ?ref=v1.0.0 argument to the source path
C) Add version = "1.0.0" attribute to module block
D) Nothing - modules stored on the public Terraform Module Registry always default to version 1.0.0
Question
How would you reference the "name" value of the second instance of this fictitious resource? <strong>How would you reference the name value of the second instance of this fictitious resource?  </strong> A) element(aws_instance.web, 2) B) aws_instance.web[1].name C) aws_instance.web[1] D) aws_instance.web[2].name E) aws_instance.web.*.name <div style=padding-top: 35px>

A) element(aws_instance.web, 2)
B) aws_instance.web[1].name
C) aws_instance.web[1]
D) aws_instance.web[2].name
E) aws_instance.web.*.name
Question
What is one disadvantage of using dynamic blocks in Terraform?

A) They cannot be used to loop through a list of values
B) Dynamic blocks can construct repeatable nested blocks
C) They make configuration harder to read and understand
D) Terraform will run more slowly
Question
Which option can not be used to keep secrets out of Terraform configuration files?

A) A Terraform provider
B) Environment variables
C) A -var flag
D) secure string
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/33
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 1: HashiCorp Certified: Terraform Associate
1
Which of the following is the correct way to pass the value in the variable num_servers into a module with the input servers?

A) servers = num_servers
B) servers = variable.num_servers
C) servers = var(num_servers)
D) servers = var.num_servers
A
2
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
B
3
Terraform requires the Go runtime as a prerequisite for installation.
False
4
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
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
5
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
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
6
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
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
7
Which of the following is available only in Terraform Enterprise or Cloud workspaces and not in Terraform CLI?

A) Secure variable storage
B) Support for multiple cloud providers
C) Dry runs with terraform plan
D) Using the workspace as a data source
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
8
Which of the following is not a valid string function in Terraform?

A) split
B) join
C) slice
D) chomp
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
9
Terraform variables and outputs that set the "description" argument will store that description in the state file.
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
10
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) Your apply failed due to a state lock
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
11
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
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
12
If a module uses a local variable, you can expose that value with a terraform output.
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
13
You have multiple team members collaborating on infrastructure as code (IaC) using Terraform, and want to apply formatting standards for readability. How can you format Terraform HCL (HashiCorp Configuration Language) code according to standard Terraform style convention?

A) Run the terraform fmt command during the code linting phase of your CI/CD process
B) Designate one person in each team to review and format everyone's code
C) Manually apply two spaces indentation and align equal sign "=" characters in every Terraform file (*.tf)
D) Write a shell script to transform Terraform files using tools such as AWK, Python, and sed Write a shell script to transform Terraform files using tools such as AWK, Python, and sed
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
14
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
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
15
One remote backend configuration always maps to a single remote workspace.
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
16
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
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
17
What does the default "local" Terraform backend store?

A) tfplan files
B) Terraform binary
C) Provider plugins
D) State file
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
18
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
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
19
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.)

A) Run terraform plan -destroy.
B) This is not possible. You can only show resources that will be created.
C) Run terraform state rm *.
D) Run terraform destroy and it will first output all the resources that will be deleted before prompting for approval.
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
20
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
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
21
Only the user that generated a plan may apply it.
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
22
What command should you run to display all workspaces for the current configuration?

A) terraform workspace
B) terraform workspace show
C) terraform workspace list
D) terraform show workspace
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
23
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? <strong>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?  </strong> A) aws_ami.ubuntu B) data.aws_ami.ubuntu C) data.aws_ami.ubuntu.id D) aws_ami.ubuntu.id

A) aws_ami.ubuntu
B) data.aws_ami.ubuntu
C) data.aws_ami.ubuntu.id
D) aws_ami.ubuntu.id
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
24
When does terraform apply reflect changes in the cloud environment?

A) Immediately
B) However long it takes the resource provider to fulfill the request
C) After updating the state file
D) Based on the value provided to the -refresh command line argument
E) None of the above
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
25
What value does the Terraform Cloud/Terraform Enterprise private module registry provide over the public Terraform Module Registry?

A) The ability to share modules with public Terraform users and members of Terraform Enterprise Organizations
B) The ability to tag modules by version or release
C) The ability to restrict modules to members of Terraform Cloud or Enterprise organizations
D) The ability to share modules publicly with any user of Terraform
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
26
Where does the Terraform local backend store its state?

A) In the /tmp directory
B) In the terraform.tfvars file
C) In the terraform.tfstate file
D) In the user's .terraformrc file
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
27
What features does the hosted service Terraform Cloud provide? (Choose two.)

A) Automated infrastructure deployment visualization
B) Automatic backups
C) Remote state storage
D) A web-based user interface (UI)
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
28
Setting the TF_LOG environment variable to DEBUG causes debug messages to be logged into syslog.
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
29
What is the name assigned by Terraform to reference this resource? <strong>What is the name assigned by Terraform to reference this resource?  </strong> A) dev B) azurerm_resource_group C) azurerm D) test

A) dev
B) azurerm_resource_group
C) azurerm
D) test
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
30
When using a module block to reference a module stored on the public Terraform Module Registry such as: <strong>When using a module block to reference a module stored on the public Terraform Module Registry such as:   How do you specify version 1.0.0?</strong> A) Modules stored on the public Terraform Module Registry do not support versioning B) Append ?ref=v1.0.0 argument to the source path C) Add version = 1.0.0 attribute to module block D) Nothing - modules stored on the public Terraform Module Registry always default to version 1.0.0 How do you specify version 1.0.0?

A) Modules stored on the public Terraform Module Registry do not support versioning
B) Append ?ref=v1.0.0 argument to the source path
C) Add version = "1.0.0" attribute to module block
D) Nothing - modules stored on the public Terraform Module Registry always default to version 1.0.0
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
31
How would you reference the "name" value of the second instance of this fictitious resource? <strong>How would you reference the name value of the second instance of this fictitious resource?  </strong> A) element(aws_instance.web, 2) B) aws_instance.web[1].name C) aws_instance.web[1] D) aws_instance.web[2].name E) aws_instance.web.*.name

A) element(aws_instance.web, 2)
B) aws_instance.web[1].name
C) aws_instance.web[1]
D) aws_instance.web[2].name
E) aws_instance.web.*.name
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
32
What is one disadvantage of using dynamic blocks in Terraform?

A) They cannot be used to loop through a list of values
B) Dynamic blocks can construct repeatable nested blocks
C) They make configuration harder to read and understand
D) Terraform will run more slowly
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
33
Which option can not be used to keep secrets out of Terraform configuration files?

A) A Terraform provider
B) Environment variables
C) A -var flag
D) secure string
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 33 flashcards in this deck.