Terraform Associate: HashiCorp Certified Part 3
Question #: 61
Topic #: 1
A Terraform provider is not responsible for:
A. Understanding API interactions with some service
B. Provisioning infrastructure in multiple clouds
C. Exposing resources and data sources based on an API
D. Managing actions to take based on resource differences
Selected Answer: B
Question #: 62
Topic #: 1
Terraform provisioners can be added to any resource block.
A. True
B. False
Selected Answer: A
Question #: 63
Topic #: 1
What is terraform refresh intended to detect?
A. Terraform configuration code changes
B. Empty state files
C. State file drift
D. Corrupt state files
Selected Answer: C
Question #: 64
Topic #: 1
A Terraform local value can reference other Terraform local values.
A. True
B. False
Selected Answer: A
Question #: 65
Topic #: 1
Which of the following is not a valid Terraform collection type?
A. list
B. map
C. tree
D. set
Selected Answer: C
Question #: 66
Topic #: 1
When running the command terraform taint against a managed resource you want to force recreation upon, Terraform will immediately destroy and recreate the resource.
A. True
B. False
Selected Answer: B
Question #: 67
Topic #: 1
All standard backend types support state storage, locking, and remote operations like plan, apply and destroy.
A. True
B. False
Selected Answer: B
Question #: 68
Topic #: 1
How can terraform plan aid in the development process?
A. Validates your expectations against the execution plan without permanently modifying state
B. Initializes your working directory containing your Terraform configuration files
C. Formats your Terraform configuration files
D. Reconciles Terraform’s state against deployed resources and permanently modifies state using the current status of deployed resources
Selected Answer: A
Question #: 69
Topic #: 1
You would like to reuse the same Terraform configuration for your development and production environments with a different state file for each.
Which command would you use?
A. terraform import
B. terraform workspace
C. terraform state
D. terraform init
Selected Answer: B
Question #: 70
Topic #: 1
What is the name assigned by Terraform to reference this resource?
A. compute_instance
B. main
C. google
D. teat
Selected Answer: B
Question #: 71
Topic #: 1
You’re building a CI/CD (continuous integration/ continuous delivery) pipeline and need to inject sensitive variables into your Terraform run.
How can you do this safely?
A. Pass variables to Terraform with a ג€”var flag
B. Copy the sensitive variables into your Terraform code
C. Store the sensitive variables in a secure_vars.tf file
D. Store the sensitive variables as plain text in a source code repository
Selected Answer: A
Question #: 72
Topic #: 1
Your security team scanned some Terraform workspaces and found secrets stored in a plaintext in state files.
How can you protect sensitive data stored in Terraform state files?
A. Delete the state file every time you run Terraform
B. Store the state in an encrypted backend
C. Edit your state file to scrub out the sensitive data
D. Always store your secrets in a secrets.tfvars file.
Selected Answer: B
Question #: 73
Topic #: 1
In contrast to Terraform Open Source, when working with Terraform Enterprise and Cloud Workspaces, conceptually you could think about them as completely separate working directories.
A. True
B. False
Selected Answer: A
Question #: 74
Topic #: 1
You want to know from which paths Terraform is loading providers referenced in your Terraform configuration (*.tf files). You need to enable debug messages to find this out.
Which of the following would achieve this?
A. Set the environment variable TF_LOG=TRACE
B. Set verbose logging for each provider in your Terraform configuration
C. Set the environment variable TF_VAR_log=TRACE
D. Set the environment variable TF_LOG_PATH
Selected Answer: A
Question #: 75
Topic #: 1
How is terraform import run?
A. As a part of terraform init
B. As a part of terraform plan
C. As a part of terraform refresh
D. By an explicit call
E. All of the above
Selected Answer: D
Question #: 76
Topic #: 1
You have a simple Terraform configuration containing one virtual machine (VM) in a cloud provider. You run terraform apply and the VM is created successfully.
What will happen if you delete the VM using the cloud provider console, and run terraform apply again without changing any Terraform code?
A. Terraform will remove the VM from state file
B. Terraform will report an error
C. Terraform will not make any changes
D. Terraform will recreate the VM
Selected Answer: D
Question #: 77
Topic #: 1
Which of these options is the most secure place to store secrets foe connecting to a Terraform remote backend?
A. Defined in Environment variables
B. Inside the backend block within the Terraform configuration
C. Defined in a connection configuration outside of Terraform
D. None of above
Selected Answer: A
Question #: 78
Topic #: 1
Your DevOps team is currently using the local backend for your Terraform configuration. You would like to move to a remote backend to begin storing the state file in a central location.
Which of the following backends would not work?
A. Amazon S3
B. Artifactory
C. Git
D. Terraform Cloud
Selected Answer: B
Question #: 79
Topic #: 1
Which backend does the Terraform CLI use by default?
A. Terraform Cloud
B. Consul
C. Remote
D. Local
Selected Answer: D
Question #: 80
Topic #: 1
When you initialize Terraform, where does it cache modules from the public Terraform Module Registry?
A. On disk in the /tmp directory
B. In memory
C. On disk in the .terraform sub-directory
D. They are not cached
Selected Answer: C
Question #: 81
Topic #: 1
You write a new Terraform configuration and immediately run terraform apply in the CLI using the local backend.
Why will the apply fail?
A. Terraform needs you to format your code according to best practices first
B. Terraform needs to install the necessary plugins first
C. The Terraform CLI needs you to log into Terraform cloud first
D. Terraform requires you to manually run terraform plan first
Selected Answer: B
Question #: 82
Topic #: 1
What features stops multiple admins from changing the Terraform state at the same time?
A. Version control
B. Backend types
C. Provider constraints
D. State locking
Selected Answer: D
Question #: 83
Topic #: 1
A fellow developer on your team is asking for some help in refactoring their Terraform code. As part of their application’s architecture, they are going to tear down an existing deployment managed by Terraform and deploy new. However, there is a server resource named aws_instance.ubuntu[1] they would like to keep to perform some additional analysis.
What command should be used to tell Terraform to no longer manage the resource?
A. terraform apply rm aws_instance.ubuntu[1] B. terraform state rm aws_instance.ubuntu[1] C. terraform plan rm aws_instance.ubuntu[1] D. terraform delete aws_instance.ubuntu[1]
Selected Answer: B
Question #: 84
Topic #: 1
Terraform can only manage resource dependencies if you set them explicitly with the depends_on argument.
A. True
B. False
Selected Answer: B
Question #: 85
Topic #: 1
A terraform apply can not _________ infrastructure.
A. change
B. destroy
C. provision
D. import
Selected Answer: D
Question #: 86
Topic #: 1
You need to constrain the GitHub provider to version 2.1 or greater.
Which of the following should you put into the Terraform 0.12 configuration’s provider block?
A. version >= 2.1
B. version ~> 2.1
C. version = ג€<= 2.1ג€
D. version = ג€>= 2.1ג€
Selected Answer: D
Question #: 87
Topic #: 1
You just scaled your VM infrastructure and realized you set the count variable to the wrong value. You correct the value and save your change.
What do you do next to make your infrastructure match your configuration?
A. Run an apply and confirm the planned changes
B. Inspect your Terraform state because you want to change it
C. Reinitialize because your configuration has changed
D. Inspect all Terraform outputs to make sure they are correct
Selected Answer: A
Question #: 88
Topic #: 1
Terraform provisioners that require authentication can use the ______ block.
A. connection
B. credentials
C. secrets
D. ssh
Selected Answer: A
Question #: 89
Topic #: 1
Terraform validate reports syntax check errors from which of the following scenarios?
A. Code contains tabs indentation instead of spaces
B. There is missing value for a variable
C. The state files does not match the current infrastructure
D. None of the above
Selected Answer: B
Question #: 90
Topic #: 1
Which of the following is allowed as a Terraform variable name?
A. count
B. name
C. source
D. version
Selected Answer: B