Terraform Quiz

Test your knowledge of Terraform. (Updated on 1/7/22.)

1. What is the remote state in Terraform?
_____________________________________________________

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

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

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.

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
j. None of the above

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
j. None of the above

7. Which is the equivalent of a dry-run of Terraform?

a. Policy test
b. Plan
c. Fake
d. Taint
e. No state

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 Flag
b. Plan Mark
c. takedown-takeup
d. Taint
e. Degrade
f. Start-over
g. Redo shade

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

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

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).

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

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.

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.

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

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.

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.

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.

19. What programming language was Terraform written in?

a. Java
b. C
c. Python
d. Go
e. Erlang

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.

21. Every Terraform configuration has a minimum of how many modules?

a. 0
b. 1
c. 2
d. 3

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

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.

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.

25. What is the difference in the functionality of a string directive and a string interpolation (not counting the syntax)?

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.

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.

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.

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

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.

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

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.

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.

33. What is Terraform workspace?

a. Something that Jenkins may use when it is configured to perform builds in Docker. When Jenkins processes Terraform jobs in such a way, the workspace is called Terraform workspace.
b. A sandboxed environment in the provider Terraform is configured for.
c. The environment in context for Terraform (such as Dev, QA or production).
d. None of the above.

34. 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

35. 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.

36. What are TFE Services?
_____________________________

37. What are Terraform Workers?
_____________________________

38. 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.

39. 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.

Find the answers here.

Leave a comment

Your email address will not be published. Required fields are marked *