If you have not taken the quiz yet, here is a link to test your own knowledge.
1. What is the remote state in Terraform?
A centralized data store with the parameters of the desired configuration for Terraform runs. The parameters for the desired configuration are referred to as a state file in the context of Terraform.
Whereas an individual may use Terraform with the default local state (a local file with desired state configuration data), a group of professionals may want a single source of truth for their desired configurations. This need for consistency across an enterprise is where the remote state of Terraform is useful. A centralized data store that has Terraform data is the remote state. Supported tools for Terraform's remote state include "Terraform Cloud, HashiCorp Consul, Amazon S3, Alibaba Cloud OSS" and others (according to https://www.terraform.io/docs/state/remote.html).
2. What underlying tools support the Terraform Application Layer?
a. Java and C++
b. C++ and C
c. Ruby on Rails and Go
d. Groovy and Grails
e. Python, Apache Tomcat, and Maven
f. Flask and Python
g. Perl and Nginx
h. None of the above; technically no such layer exists
Answer: C. Ruby on Rails and Go.
This website https://www.terraform.io/docs/enterprise/system-overview/reliability-availability.html has this snippet:
Application Layer
- TFE Core - A Rails application at the center of Terraform Enterprise; consists of web frontends and background workers
- TFE Services - A set of Go services that provide various pieces of key functionality for Terraform Enterprise
3. Terraform Enterprise has which of the following two layers besides the Coordination Layer? Choose two.
a. Outer Layer
b. Application Layer
c. Middle Layer
d. Storage Layer
e. Web Layer
f. Messaging Layer
g. Inner Layer
h. Database Layer
Answer: B and D. The Application and Storage Layers.
Source: https://www.terraform.io/docs/enterprise/system-overview/reliability-availability.html
4. Which tools are underlying components of the Coordination Layer of Terraform Enterprise?
a. Angular
b. Redis
c. Docker
d. HBase
e. etcd
f. Flannel
g. Qpid
h. RabbitMQ
i. Apache Parquet
j. ActiveMQ
k. Kubernetes
l. React
m. MongoDB
n. ZeroMQ
Choose two.
Answer: B. and H. Redis and RabbitMQ. Source: https://www.terraform.io/docs/enterprise/system-overview/reliability-availability.html#components
5. PostgreSQL, Blob storage and HashiCorp Vault are components of which Terraform Enterprise layer?
a. Application Layer
b. Storage Layer
c. Coordination Layer
d. Database Layer
e. Outer Layer
f. Web Layer
g. Messaging Layer
h. Middle Layer
i. Inner Layer
Answer: B. Storage Layer. Source: https://www.terraform.io/docs/enterprise/system-overview/reliability-availability.html
6. Terraform Enterprise Core, Services and Terraform Workers (all three of these) comprise which of the following?
a. Application Layer
b. Outer Layer
c. Coordination Layer
d. Database Layer
e. Storage Layer
f. Web Layer
g. Messaging Layer
h. Middle Layer
i. Inner Layer
Answer: A. Application Layer. Source https://www.terraform.io/docs/enterprise/system-overview/reliability-availability.html
7. Which is the equivalent of a dry-run of Terraform?
a. Policy test
b. Plan
c. Fake
d. Taint
e. No state
Answer: B. Plan. Source https://www.terraform.io/docs/glossary.html#plan-noun-1-
8. Which of the following signifies the marking of a resource to be destroyed and eventually re-created in Terraform (as opposed to the incremental steps of an "apply")?
a. Rebuild
b. Plan
c. takedown-takeup
d. Taint
e. Exhilirate
Answer: D. Taint. "The terraform taint command manually marks a Terraform-managed resource as tainted, forcing it to be destroyed and recreated on the next apply." This quote was taken from https://www.terraform.io/docs/commands/taint.html
9. Where are Terraform state files stored by default?
a. The /tmp directory in Linux and the /%temp%/ directory in Windows
b. The root directory of the Terraform application installation
c. The local-remote state directory
d. The current working directory
Answer: D. Source: https://www.terraform.io/docs/state/purpose.html
For future reference, there is no local-remote state. If you want to read about the Remote State, which is recommended for a team of professionals using Terraform for a centralized configuration, see https://www.terraform.io/docs/state/remote.html.
10. What Terraform status word refers to a resource that should have been deleted but has not been deleted because of an erroneous run of "tf apply"?
The definition of the word is as follows: "This status tracks a resource that was marked for deletion, but still remains in the Terraform state and infrastructure due an error from a previous apply."
Which word is it?
a. Critical
b. Deceased
c. Degraded
d. Deposed
e. Emergency
f. Err
g. Nullified
h. Transfigured
i. Transposed
j. Tainted
Answer: D. Source: taken from https://www.terraform.io/docs/glossary.html#deposed
11. What is a workspace in Terraform? Choose two.
a. Any directory that you are in where you run a terraform command.
b. A repository in a code versioning system that stores Terraform files.
c. A cache in memory for the Terraform state.
d. A subsection of a backend. The place where persistent data is stored in the backend. (The backend is either a local location on the Terraform server or a remote, centralized location for Terraform files.)
e. A subsection of Terraform Cloud.
f. A way to have sandboxed environments (e.g., Dev, QA, and production).
Answer: D and F. Sources for D: Workspaces and Backends
The answer F is correct because if you want to have Dev, QA and production environments, Terraform workspaces help you accomplish that. The source is this medium.com article.
The following provides more elucidation on what a workspace is. Page 88 of Terraform: Up & Running, 2nd Edition by Yevgeniy Brikman (O'Reilly), Copyright 2019, 978-1-492-04690-5). A Terraform workspace is a feature to have separate state files and thus logical collections of infrastructure. The different workspaces are always named. If you do not name one, the workspace's name is called "default" (page 88 of Terraform: Up & Running, 2nd Edition by Yevgeniy Brikman (O'Reilly), Copyright 2019, 978-1-492-04690-5). There is a supported "terraform workspace" command (page 88 of Terraform: Up & Running, 2nd Edition by Yevgeniy Brikman (O'Reilly), Copyright 2019, 978-1-492-04690-5).
12. Which of the following can be providers for Terraform?
a. VMware vSphere
b. F5 BIG-IP
c. Bitbucket
d. Chef
e. All of the above
Answer: E. Source: https://www.terraform.io/docs/providers/index.html
13. What is a module in Terraform? Choose three.
a. A parser for the TF state file.
b. An atomic element of a desired state of configuration.
c. A group of resources.
d. The variable settings of a compiled file.
e. A .tf file that is invoked when another .tf file is being applied.
f. A binary file compiled from another .tf file.
g. A reusable .tf file that involves one or more variables.
h. Stand-alone group of Terraform resource configurations.
i. A set of Terraform configuration files in a folder.
Answer: C, H, and I.
For C, the source is https://www.terraform.io/docs/configuration/index.html
For H the sources are https://registry.terraform.io/browse/modules and
https://www.terraform.io/docs/configuration/modules.html
For I, the source is this https://www.terraform.io/language/files#directories-and-modules
14. Which command will give you the fastest way to an interactive command prompt for Terraform?
a. Run "terraform fmt"
b. Run "terraform console"
c. Run "terraform state"
d. Develop a solution yourself that is customized.
Answer: B. Source https://www.terraform.io/docs/commands/console.html
15. To consume the output of a "terraform graph" command you redirect the output to a flat file. What is the recommended tool to view create an .svg (Scalable Vector Graphics) file?
a. format
b. Gnome rasterizer
c. GraphViz
d. Kibana Transition
Answer: C. Source: https://www.terraform.io/docs/commands/graph.html
If you want to learn more about GraphViz, see this posting.
16. What are callbacks in Terraform?
a. Options to rollback the changes Terraform makes.
b. One or more URLs in a .tf file.
c. Links between Terraform resources.
d. Links between Terraform modules.
e. .tf files that are used once a state file has been applied.
Answer: B. Source: https://registry.terraform.io/providers/alexkappa/auth0/latest/docs/resources/client
17. What is user data?
a. A set of commands that run when an AWS EC-2 instance boots for the first time.
b. A set of commands that run when a new VM boots for the first time.
c. All of the above.
d. None of the above.
Answer: C. Source: What is User Data in AWS or Terraform?
18. What is the Terraform registry?
a. A website hosted on terraform.io that is also integrated with the Terraform product to provide a collection of Terraform modules.
b. An internal, private component of Terraform Enterprise edition that hosts .tf files for multiple people to use.
c. The list of initialized resource configurations on a given Terraform server.
d. A binary file compiled from another .tf file.
Answer: A. Sources https://registry.terraform.io/
19. What programming language was Terraform written in?
a. Java
b. C
c. Python
d. Go
e. Erlang
Answer: D. Source: https://github.com/hashicorp/terraform
20. How do you do a "terraform state rollback"?
a. Run "tf state rollback".
b. Run "tf rollback".
c. Run "terraform state rollback".
d. "tf backout" to remove the changes applied from the previous "tf apply" command.
e. "tf unapply nameof.tf" where nameof.tf is the Terraform file you want to rollback.
f. There is no supported way to do this.
Answer: F. Source: https://stackoverflow.com/questions/57821319/how-to-rollback-to-previous-state-in-terraform
21. Every Terraform configuration has a minimum of how many modules?
a. 0
b. 1
c. 2
d. 3
Answer: B. Source: https://www.terraform.io/docs/language/modules/syntax.html
22. What are the differences between Terratest and Terragrunt?
a. Terragrunt is a JavaScript task scheduler and Terratest is for testing Golang code
b. Terragrunt is proprietary and Terratest is open source
c. Terratest is for testing Terraform code, whereas Terragrunt helps you write Terraform code efficiently
d. There is no difference
Answer: C. Source: https://blog.gruntwork.io/introducing-commercial-support-for-terragrunt-and-terratest-a550f44fde56
23. What signifies a comment in .tf files?
a. The hash symbol "#"
b. Two forward slashes: "//"
c. A forward slash and asterisk closed by an asterisk and forward slash ("/" and "/").
d. All of the above.
e. None of the above.
Answer: D. Source: https://www.terraform.io/docs/language/syntax/configuration.html#comments
24. String directives and string interpolations use curly braces {}. What symbols precede the braces?
a. String directives use %. String interpolations use $
b. String directives use $. String interpolations use %
c. Both use %
d. Both use $
e. None of the above.
Answer: A. Source: Page 150 of Terraform: Up & Running, 2nd Edition by Yevgeniy Brikman (O'Reilly), Copyright 2019, 978-1-492-04690-5.
25. What is the difference in the functionality of a string directive and a string interpolation? Choose the best option.
a. String directives allow you to reference Terraform code within a string. String interpolations allow you to use control statements.
b. String interpolations allow you to reference Terraform code within a string. String directives allow you to use control statements.
c. String interpolations allow you to read input interactively and string directives convert variables into strings.
d. String directives allow you to read input interactively and string interpolations convert variables into strings.
e. None of the above.
Answer: B. Source: Page 150 of Terraform: Up & Running, 2nd Edition by Yevgeniy Brikman (O'Reilly), Copyright 2019, 978-1-492-04690-5.
"Hello, ${var.name}" is an example of a string interpolation (according to page 150 of Terraform Up & Running).
Here is an example of a string directive (taken from page 150 of Terraform Up & Running):
%{ for in }%{ endfor }
Answer "E" could be acceptable if it is a reference toward the syntax. We tend to think of syntax as differing from functionality.
26. What is the Terraform reserved word to find the length of an array (the number of items in an array)?
a. len
b. length
c. count
d. None of the above.
Answer: B. Source page 137 of Terraform: Up & Running, 2nd Edition by Yevgeniy Brikman (O'Reilly), Copyright 2019, 978-1-492-04690-5.
27. Terraform's for_each clause works on which of the following?
a. a set
b. a map
c. a list/array
d. A and B
e. B and C
f. A and C
g. None of the above.
Answer: D. Source: Page 141 of Terraform: Up & Running, 2nd Edition by Yevgeniy Brikman (O'Reilly), Copyright 2019, 978-1-492-04690-5.
28. How do you isolate tfstate files (for Dev, QA, and Prod environments with multiple people using Terraform)?
a. terraform namespaces
b. terraform workspaces
c. terraform modules
d. terraform providers
e. terraform provisioners
f. None of the above
Answer: B. You could use a file layout scheme to do this. But the correct answer is B. The source is page 88 of Terraform: Up & Running, 2nd Edition by Yevgeniy Brikman (O'Reilly), Copyright 2019, 978-1-492-04690-5.
29. If you have Terraform passwords as variables in a .tf file, what do you do to keep them from being visible in the log?
a. Use the --invisible flag when you run the relevant terraform command.
b. Use the --hide-vars flag when you run the relevant terraform command.
c. Use the "sensitive = true" stanza in the relevant .tf file.
d. Use the "nolog = true" stanza in the relevant .tf file.
e. Have the main.tf file be configured with the "variables_obfuscate = true" stanza
f. None of the above.
Answer: C. Source is Hashicorp's website.
30. What is an advantage of a provisioner over User Data? Choose two.
a. Provisioners are faster than User Data
b. Scripts in User Data cannot be more than 16 KB
c. Better support for configuration management tools such as Chef, Puppet, and SaltStack
d. There are inherent security advantages when you use provisioners
Answer: B and C. Source page 217 of Terraform: Up & Running, 2nd Edition by Yevgeniy Brikman (O'Reilly), Copyright 2019, 978-1-492-04690-5) explains why it is just B and C.
31. How do you undo a run of "terraform destroy"?
a. Run "terraform undo"
b. Run "terraform rollback"
c. Run "tf revert"
d. None of the above.
Answer: D. There is no such thing (according to page 73 of Terraform: Up & Running, 2nd Edition by Yevgeniy Brikman (O'Reilly), Copyright 2019, 978-1-492-04690-5).
32. What does the ~> syntax in Terraform signify?
a. The desired state of configuration
b. An optional goal for a Terraform module
c. The lowest (floating point / decimal) number inclusive of what it points to
d. The highest (floating point / decimal) number inclusive of what it points to
e. The exact version of what it points to
f. None of the above.
Answer: C. This version constraint syntax indicates that the next major version will not be supported; it pins the Terraform module/file to a specific cloud provider version. ~> 2.0 would mean that 2.0 or higher would work, but not 3.0 or higher. Source: Page 208 of Terraform: Up & Running, 2nd Edition by Yevgeniy Brikman (O'Reilly), Copyright 2019, 978-1-492-04690-5).
See also https://www.terraform.io/docs/language/expressions/version-constraints.html
33. Which of the following are steps in a resource lifecycle in Terraform?
a. Compile
b. ValidateResource
c. Destroy
d. Taint
e. All of the above
f. None of the above
Answer: B. Source: https://www.terraform.io/docs/internals/lifecycle.html
34. What is a null resource in Terraform?
a. A variable with no value
b. A resource the relevant cloud/Kubernetes credentials have no access to
c. A reserved word that acts as a dummy, stub value used in testing
d. None of the above.
Answer: C. Sources:
- https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource
- https://serverfault.com/questions/1005761/what-does-error-cycle-means-in-terraform
35. What are TFE Services?
Answer: "A set of Go services that provide various pieces of key functionality for Terraform Enterprise" This was taken from Terraform.io.
36. What are Terraform Workers?
Answer: "A fleet of isolated execution environments that perform Terraform Runs on behalf of Terraform Enterprise users." This was taken from Terraform.io.
37. What does "terraform import" do?
a. It allows you to use other .tf files in your run of terraform
b. It allows you to use libraries of other commands.
c. It allows you to manage infrastructure with Terraform that was not created by Terraform.
d. All of the above.
e. None of the above.
Answer: C. Source: https://www.terraform.io/cli/import
38. What does a map in Terraform do?
a. It is the only way to use a for_each clause.
b. It is a function that is no longer used in Terraform.
c. It is a data type like tag.
d. All of the above.
e. None of the above.
Answer: B. Source: https://www.terraform.io/language/functions/map
Option "A" isn't right because a set can allow you to use a for_each clause (according to page 141 of Terraform: Up & Running, 2nd Edition by Yevgeniy Brikman (O'Reilly), Copyright 2019, 978-1-492-04690-5.