and Conceptual Actual Frequently Tested
Exam Questions With Reviewed 100% Correct
Detailed Answers
Guaranteed Pass!!Current Update!!
1. Desired state - ANSWER local terraform manifest (all *.tf files)
2. Current state - ANSWER real resources present in your cloud
3. File function - ANSWER file(path)
Only read the contents of a file at the given path and return them as a string.
file("${path}")
4. Statefile(terraform.tfstate) - ANSWER to map real-world resources to your
configuration(keep track of meta data)
5. Where to store the Statefile - ANSWER locally - remotly(s3)
6. Terraform Argument - ANSWER input : required - optional
,7. Terraform attributes reference - ANSWER You can use them in the output
8. Terraform.tfvars - ANSWER If the file name terraform.tfvars, Terraform will
auto load the variables present in this file by overriding the default values in
variables.tf
9. note(.tfvars) - ANSWER If we plan to use different names for .tfvars, then
we need to explicitly provide the argument -var-file during the terraform plan
or apply
exp: web.tfvars
terraform apply -var-file ="web.tfvars"
10. .auto.tfvars - ANSWER with the extension .auto.tfvars, the variable inside
these files will be auto-loaded during terraform plan or apply
11. list(<TYPE>) - ANSWER ordered sequence, all elements must be the same
type.
Example: list(string) → ["a", "b", "c"]
you can access by index ([0], [1], ...).
mylist = ["apple", "banana", "cherry"]
# Access
mylist[0] # "apple"
mylist[1] # "banana"
,12. tuple([<TYPE>, <TYPE>, ...]) - ANSWER ordered sequence, elements can be
of different types, each position has a fixed type.
Example: tuple([string, number, bool]) → ["hello", 42, true]
variable "mytuple" {
type = tuple([string, number, bool])
default = ["server1", 4, true]
}
output "first" {
value = var.mytuple[0] # "server1"
}
13. set(<TYPE>) - ANSWER unordered collection, all elements must be the
same type, no duplicates allowed.
Example: set(string) → ["a", "b", "c"] (order doesn't matter, "a", "b", "c" = "c", "b",
"a")
Use set when uniqueness is important, and order doesn't matter.
You don't normally access values by index (like [0], [1]) → because there's no
guarantee what's at position 0.
Instead, you usually loop over the values or check if something exists.
14.map(<TYPE>) - ANSWER key-value pairs, all values must be the same type.
map = flexible keys, same value type.
Example: map(string) {
name = "Hanen",
, city = "Berlin" }
variable "tags" {
type = map(string)
}
tags = {
env = "dev"
owner = "hanen"
team = "cloud"
}
Key/value pairs → access by key, not index.
mymap = {
name = "Hanen"
city = "Berlin"
role = "DevOps"
}
# Access
mymap["name"] # "Hanen"
mymap["city"] # "Berlin"
15. object({ ... }) - ANSWER An object is like a map but with a fixed structure.
The keys are defined in advance.
The values can be different types.