0% found this document useful (0 votes)
62 views211 pages

Terraform 20221025

Uploaded by

alex.petrovic777
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views211 pages

Terraform 20221025

Uploaded by

alex.petrovic777
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 211

- Expert Veri�ed, Online, Free.

 Custom View Settings

Topic 1 - Single Topic


Question #1 Topic 1

The terraform.tfstate �le always matches your currently built infrastructure.

A. True

B. False

Correct Answer: B
Reference:
https://www.terraform.io/docs/language/state/index.html

Community vote distribution


B (86%) 14%

  fabiomlop Highly Voted  4 months, 1 week ago


It doesn't necessarily always matches the current infrastructure, since one can manually change resources and therefore drift from the state
configuration. Terraform has no way to know or track changes made outside of it.
upvoted 15 times

  legendary7 Most Recent  3 weeks ago


Guyz, this dump is 100 % valid

I took my exam October 1, 2022 and I passed at 80%


All the questions were from this dump
upvoted 1 times

  babuappnet 1 month ago


B is the right.
upvoted 1 times

  alemtzc 2 months, 2 weeks ago


Definitely B
upvoted 1 times

  Laureatul 2 months, 2 weeks ago


Selected Answer: B
B is the correct answer.
upvoted 1 times

  Eltooth 3 months, 3 weeks ago


Selected Answer: B
B is correct answer : false.
upvoted 2 times

  Zam88 4 months, 1 week ago


Selected Answer: B
B is correct
upvoted 3 times

  Zam88 4 months, 1 week ago


B is correct
upvoted 3 times

  Cedhulk 4 months, 1 week ago


in what case ?
upvoted 1 times

  Cedhulk 4 months, 1 week ago


ah "always" mb
upvoted 1 times
  darovero 4 months, 1 week ago
Should be A
upvoted 1 times

  amrith501 4 months, 1 week ago


what if we create the resources manually from Cloud provider. It will not match state file right. If the question Specifically mention infra created by
Terraform then it is true
upvoted 1 times

  bicycle 4 months, 2 weeks ago


Selected Answer: A
should be A
upvoted 1 times

  Eltooth 3 months, 3 weeks ago


What happens if you change you resources through the cloud portal? Until you run a terraform plan/apply the tfstate.tf file will be out of sync
with live changes. Answer should be B : false.
upvoted 2 times

  bicycle 4 months, 2 weeks ago


should be A
upvoted 1 times
Question #2 Topic 1

One remote backend con�guration always maps to a single remote workspace.

A. True

B. False

Correct Answer: A
Reference:
https://www.terraform.io/docs/language/settings/backends/remote.html

Community vote distribution


B (81%) A (19%)

  Zam88 Highly Voted  4 months, 1 week ago


Selected Answer: B
correct B
upvoted 6 times

  Bere Most Recent  1 week, 5 days ago


Selected Answer: B
As described here:
https://www.terraform.io/language/settings/backends/remote
The remote backend can work with either a single remote Terraform Cloud workspace, or with multiple similarly-named remote workspaces (like
networking-dev and networking-prod).
upvoted 1 times

  ethylyn 1 month, 1 week ago


its /31 so its true
upvoted 1 times

  ACE_ASPIRE 2 months ago


This question was in my exam.
upvoted 3 times

  Charley68 1 month ago


So what is correct answer because this site says A but most people are saying B !
upvoted 2 times

  geekneek 2 months, 1 week ago


Selected Answer: B
The remote backend can work with either a single remote Terraform Cloud workspace, or with multiple similarly-named remote workspaces (like
networking-dev and networking-prod). The workspaces block of the backend configuration determines which mode it uses:

To use a single remote Terraform Cloud workspace, set workspaces.name to the remote workspace's full name (like networking-prod).

To use multiple remote workspaces, set workspaces.prefix to a prefix used in all of the desired remote workspace names. For example, set prefix =
"networking-" to use Terraform cloud workspaces with names like networking-dev and networking-prod. This is helpful when mapping multiple
Terraform CLI workspaces used in a single Terraform configuration to multiple Terraform Cloud workspaces.
upvoted 2 times

  Eltooth 3 months, 3 weeks ago


Selected Answer: A
Poorly worded question and open to interpretation.
"The persistent data stored in the backend belongs to a workspace. Initially the backend has only one workspace, called "default", and thus there is
only one Terraform state associated with that configuration.

Certain backends support multiple named workspaces, allowing multiple states to be associated with a single configuration. The configuration still
has only one backend, but multiple distinct instances of that configuration to be deployed without configuring a new backend or changing
authentication credentials.

Named workspaces allow conveniently switching between multiple instances of a single configuration within its single backend. They are
convenient in a number of situations, but cannot solve all problems.

Named workspaces allow conveniently switching between multiple instances of a single configuration within its single backend. They are
convenient in a number of situations, but cannot solve all problems."

https://www.terraform.io/language/state/workspaces
upvoted 3 times
  Zam88 4 months, 1 week ago
The remote backend can work with either a single remote Terraform Cloud workspace, or with multiple similarly-named remote workspaces (like
networking-dev and networking-prod). The workspaces block of the backend configuration determines which mode it uses:

Correct B
upvoted 3 times

  BigSteveO 4 months, 2 weeks ago


B has to be correct, It says in the notes that it works with both a single remote workspace and multiple remote workspaces. lol So NO it doesn't
only map to a single workspace.
upvoted 2 times

  doumx 4 months, 3 weeks ago


B is the correct answer
upvoted 3 times

  bp339 5 months, 1 week ago


It is B
upvoted 3 times

  Parthasarathi 5 months, 1 week ago


Selected Answer: B
It should be B
upvoted 4 times

  softarts 5 months, 1 week ago


I take B
upvoted 3 times
Question #3 Topic 1

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

Correct Answer: A
If you and your team are using Terraform to manage meaningful infrastructure, we recommend using the remote backend with Terraform Cloud
or Terraform
Enterprise.
Reference:
https://www.terraform.io/docs/language/settings/backends/index.html

Community vote distribution


A (100%)

  softarts Highly Voted  5 months, 1 week ago


I take A
upvoted 7 times

  Atta33 Most Recent  2 weeks, 4 days ago


Selected Answer: A
A is correct
upvoted 1 times

  Janan 2 months, 2 weeks ago


Selected Answer: A
A is the answer
upvoted 2 times

  Eltooth 3 months, 3 weeks ago


Selected Answer: A
A is correct answer.
upvoted 3 times

  Zam88 4 months, 1 week ago


Backends define where Terraform's state snapshots are stored.

A given Terraform configuration can either specify a backend, integrate with Terraform Cloud, or do neither and default to storing state locally.

correct A
upvoted 2 times

  Zam88 4 months, 1 week ago


Selected Answer: A
A is correct
upvoted 2 times
Question #4 Topic 1

What is the work�ow for deploying new infrastructure with Terraform?

A. terraform plan to import the current infrastructure to the state �le, make code changes, and terraform apply to update the infrastructure.

B. Write a Terraform con�guration, run terraform show to view proposed changes, and terraform apply to create new infrastructure.

C. terraform import to import the current infrastructure to the state �le, make code changes, and terraform apply to update the infrastructure.

D. Write a Terraform con�guration, run terraform init, run terraform plan to view planned infrastructure changes, and terraform apply to create
new infrastructure.

Correct Answer: D

Community vote distribution


D (100%)

  softarts Highly Voted  5 months, 1 week ago


it is D
upvoted 12 times

  geekneek Most Recent  2 months, 1 week ago


D, no doubt about it.
upvoted 3 times

  cjig 3 months, 1 week ago


D is correct answer.
upvoted 1 times

  prince1234 3 months, 1 week ago


D is perfect .
upvoted 1 times

  saryu 3 months, 3 weeks ago


Selected Answer: D
D is correct
upvoted 2 times

  Eltooth 3 months, 3 weeks ago


Selected Answer: D
D is correct answer.
upvoted 2 times

  szl0144 4 months ago


D is correct
upvoted 2 times
Question #5 Topic 1

A provider con�guration block is required in every Terraform con�guration.


Example:

A. True

B. False

Correct Answer: A
Reference:
https://github.com/hashicorp/terraform/issues/17928

Community vote distribution


B (58%) A (42%)

  softarts Highly Voted  5 months, 1 week ago


Selected Answer: A
vote A
upvoted 19 times

  pabrojo Highly Voted  2 months, 1 week ago


Selected Answer: B
It's B. From the official documentation:

Unlike many other objects in the Terraform language, a provider block may be omitted if its contents would otherwise be empty. Terraform
assumes an empty default configuration for any provider that is not explicitly configured.

https://www.terraform.io/language/providers/configuration
upvoted 11 times

  ali�e Most Recent  1 week, 3 days ago


Selected Answer: A
tried in multiple configs with aws provider, init works wothout provider configuration but plan does not.
Error: Invalid provider configuration

│ Provider "registry.terraform.io/hashicorp/aws" requires explicit configuration. Add a provider block to the root module and configure the
provider's required arguments as described in the provider documentation.
upvoted 1 times

  Bere 1 week, 5 days ago


The documentation is confusing:
https://www.terraform.io/language/providers/configuration
-----
Additionally, all Terraform configurations must declare which providers they require so that Terraform can install and use them. The Provider
Requirements page documents how to declare providers so Terraform can install them.
-----
Unlike many other objects in the Terraform language, a provider block may be omitted if its contents would otherwise be empty. Terraform
assumes an empty default configuration for any provider that is not explicitly configured.
-----
upvoted 1 times

  niccsm 4 days, 8 hours ago


provider requirements (specified in the `terraform` block) are not the same as provider blocks
upvoted 1 times

  pmzone 2 weeks, 5 days ago


Selected Answer: B
You an run a blank .tf file as well.
upvoted 1 times

  udibie 3 weeks ago


Selected Answer: B
has to be false
upvoted 1 times

  methamode 3 weeks, 6 days ago


Selected Answer: B
This is B
upvoted 1 times

  faltu1985 4 weeks ago


Selected Answer: B
It is not required
upvoted 1 times

  PBSH56 1 month ago


Selected Answer: B
I go to with option B
if I create a block
resource "google_storage_bucket" "static-site" {
name = "image-store.com"
location = "EU"
force_destroy = true
}
then run terraform init then automatically find and install the associated provider with resource block.
upvoted 1 times

  WorkHardBeProud 1 month ago


I believe "required providers" block is required not "provider"
upvoted 1 times

  Andreaw 1 month ago


Selected Answer: B
https://www.terraform.io/language/providers/configuration
upvoted 1 times

  empperador 1 month, 3 weeks ago


Selected Answer: B
B is correct, it is not neccesary to declare a provider block, Terraform can download plugins from a resource block or from Terraform block.
upvoted 2 times

  RVivek 1 month, 3 weeks ago


Documentation says "Terraform configurations must declare which providers they require so that Terraform can install and use them"
However for many providers available in Terraform Registry, based on the resourcse bloaks we define teraafom automatically installs provider
pluggins. Hence both answers are correct.
upvoted 2 times

  yogishrb2020 2 weeks, 3 days ago


what if the provider not existing in the registry?
upvoted 1 times

  kilowd 1 month, 3 weeks ago


YES ..Terraform needs to know what provider we are working with e.g aws , azure e.tc
upvoted 1 times

  kilowd 1 month, 3 weeks ago


Please ignore previous answer..After digging further the answer is NO.
Terraform selects a provider based on the resource type name For example, the resource type google_compute_instance is associated
automatically with the default configuration for the provider named google.
upvoted 1 times

  kilowd 1 month, 3 weeks ago


What u can ignore is the terraform block:
terrafform {
required_providers {
azurerm = {}
}
}
upvoted 1 times

  kilowd 1 month, 3 weeks ago


Please ignore previous answer..After digging further the answer is NO.
Terraform selects a provider based on the resource type name For example, the resource type google_compute_instance is associated
automatically with the default configuration for the provider named google.
upvoted 1 times

  bukake 2 months ago


Selected Answer: A
A because terraform force you to always set a provider
upvoted 1 times

  DeeOne17 2 months ago


Selected Answer: A
https://www.terraform.io/language/providers/configuration
"Additionally, all Terraform configurations must declare which providers they require so that Terraform can install and use them. The Provider
Requirements page documents how to declare providers so Terraform can install them.
upvoted 2 times
  geekneek 2 months, 1 week ago
Voted A
upvoted 1 times
Question #6 Topic 1

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 �rst?

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

Correct Answer: A

Community vote distribution


A (65%) D (24%) 12%

  arapin 1 month ago


Selected Answer: B
I believe the answer is B. Terraform apply -target

Terraform does not keep track of what the provisioners do. So if we run a script via local-exec, terraform has no idea what the script does, nor can it
track it's changes. That is the exact reason why terraform says that provisioners are the last resort.

Running taint (A), would not delete the resources created via the script, but it would mark the null_resource.script for deletion and wait for the next
run.

Running terraform apply -target(B) would re-run the script.


upvoted 2 times

  RVivek 1 month, 1 week ago


Selected Answer: A
D is not correct . Because D will just apply null resource script again, however since there is no change in the script it will not run again. We have to
taint and then run target . taint is depricated now. "replace" should be used instead of taint
upvoted 2 times

  svsilence 3 months, 2 weeks ago


HashiCorp deprecated the terraform taint command in v0.15.2. If you want to force replacement of an object even though there are no
configuration changes, use the terraform plan or terraform apply command with the -replace option instead. If you are using an older version of
Terraform, continue using the terraform taint command.
upvoted 4 times

  nhatne 3 months, 2 weeks ago


Selected Answer: A
A is correct
upvoted 2 times

  Sproket 3 months, 4 weeks ago


Selected Answer: A
You are all correct that taint has been deprecated and replaced with -replace. But neither D nor any other option here uses the -replace command.
Therefore option A is the only valid option given these choices.
upvoted 4 times

  Ahmad_Terraform 4 months ago


taint basically force destroy and recreate resource, so here A seems correct
upvoted 2 times

  Zam88 4 months, 1 week ago


I think A is the best option for this question But if you check doc
Warning: This command is deprecated. For Terraform v0.15.2 and later, we recommend using the -replace option with terraform apply instead
(details below).

D is also close enough


But i think it should be A correct
upvoted 1 times

  subhala 4 months, 1 week ago


I tested this, A is correct.
upvoted 4 times

  Cedhulk 4 months, 1 week ago


Selected Answer: A
it's A
upvoted 3 times
  AzureGurl 4 months, 2 weeks ago
For these given option the answer is A. I have tested it.
upvoted 4 times

  javibadillo 5 months ago


Selected Answer: D
This command is deprecated(Taint). For Terraform v0.15.2 and later, we recommend using the -replace option with terraform apply instead (details
below).
upvoted 4 times

  rfd 3 months, 2 weeks ago


There is no reference of version in question.
upvoted 1 times

  Sproket 3 months, 4 weeks ago


Correct, taint has been replaced with -replace. But answer D doesn't include -replace so why would we choose it?
upvoted 1 times

  eboost 5 months ago


should be B
upvoted 2 times

  d0ug7979 4 months, 3 weeks ago


No you need to taint first your null resource for TF to local exec again. TF does it automatically in case of failure.
upvoted 2 times

  bp339 5 months, 1 week ago


https://www.terraform.io/cli/commands/taint
upvoted 2 times
Question #7 Topic 1

Which provisioner invokes a process on the resource created by Terraform?

A. remote-exec

B. null-exec

C. local-exec

D. �le

Correct Answer: A
The remote-exec provisioner invokes a script on a remote resource after it is created.
Reference:
https://www.terraform.io/docs/language/resources/provisioners/remote-exec.html

Community vote distribution


A (100%)

  Cloud9er Highly Voted  5 months, 3 weeks ago


No. Answer is remote-exec. because...The local-exec provisioner invokes a local executable after a resource is created. This invokes a process on the
machine running Terraform, not on the resource. (this is from the terraform web site)
upvoted 16 times

  ACE_ASPIRE Most Recent  2 months ago


This question was in my exam.
upvoted 2 times

  Eltooth 3 months, 2 weeks ago


Selected Answer: A
A is correct answer : remote-exec.

"The local-exec provisioner invokes a local executable after a resource is created. This invokes a process on the machine running Terraform, not on
the resource." https://www.terraform.io/language/resources/provisioners/local-exec

"The remote-exec provisioner invokes a script on a remote resource after it is created."


https://www.terraform.io/language/resources/provisioners/remote-exec
upvoted 3 times

  Zam88 4 months, 1 week ago


The remote-exec provisioner invokes a script on a remote resource after it is created. This can be used to run a configuration management tool,
bootstrap into a cluster, etc. To invoke a local process, see the local-exec provisioner instead. The remote-exec provisioner requires a connection
and supports both ssh and winrm.

remote-exec correct
upvoted 1 times

  subhala 4 months, 1 week ago


I think it is remote-exec, the question is asking about on the resource created by terraform. local-exec runs on the machine where we run
terraform.
upvoted 1 times

  softarts 5 months, 1 week ago


I take A remote-exec.
upvoted 3 times

  Eniras 5 months, 3 weeks ago


The local-exec provisioner invokes a local executable after a resource is created. This invokes a process on the machine running Terraform, not on
the resource. See the remote-exec provisioner to run commands on the resource.
https://www.terraform.io/language/resources/provisioners/local-exec
upvoted 2 times

  calebvar 6 months ago


Isn't local exec also correct?
upvoted 1 times

  Ahmad_Terraform 4 months ago


Eniras explained well about the Local Exec,
upvoted 1 times
Question #8 Topic 1

Which of the following is not true of Terraform providers?

A. Providers can be written by individuals

B. Providers can be maintained by a community of users

C. Some providers are maintained by HashiCorp

D. Major cloud vendors and non-cloud vendors can write, maintain, or collaborate on Terraform providers

E. None of the above

Correct Answer: D
Reference:
https://jayendrapatil.com/terraform-cheat-sheet/#Terraform_Read_and_write_con�guration

Community vote distribution


E (100%)

  icedog Highly Voted  5 months, 3 weeks ago


Selected Answer: E
E. is the correct answer.
It's obvious that D. is incorrect, of course cloud and non-cloud vendors can collaborate on creating providers just like anyone else
upvoted 15 times

  Yonex Most Recent  4 days, 13 hours ago


Selected Answer: E
It should be E, why revealed answer is D?
upvoted 1 times

  Charley68 1 month ago


I'm struggling to understand this website. I also said E along with everyone else but the revealed answer shows D ??
upvoted 1 times

  Ethik 1 month, 1 week ago


Selected Answer: E
The Terraform Registry includes documentation for a wide range of providers developed by HashiCorp, third-party vendors, and our Terraform
community.
upvoted 1 times

  Ethik 1 month, 1 week ago


E https://www.terraform.io/language/providers
Provider Documentation
Each provider has its own documentation, describing its resource types and their arguments.
The Terraform Registry includes documentation for a wide range of providers developed by HashiCorp, third-party vendors, and our Terraform
community. Use the "Documentation" link in a provider's header to browse its documentation.
Provider documentation in the Registry is versioned; you can use the version menu in the header to change which version you're viewing.
For details about writing, generating, and previewing provider documentation, see the provider publishing documentation.
upvoted 1 times

  keiffo2 1 month, 2 weeks ago


Selected Answer: E
E is the right Answer
upvoted 1 times

  Aws2222 3 months ago


why not A?
upvoted 1 times

  cjig 3 months, 1 week ago


Selected Answer: E
E is the correct Answer.
https://www.terraform.io/language/providers
upvoted 2 times

  Eltooth 3 months, 2 weeks ago


Selected Answer: E
E is correct answer: none of the above.
upvoted 3 times

  ap10001 4 months, 2 weeks ago


Selected Answer: E
D is obviously false, see i.e. https://registry.terraform.io/providers/hashicorp/google/latest - This provider is collaboratively maintained by the
Google Terraform Team at Google and the Terraform team at HashiCorp
upvoted 2 times
  doumx 4 months, 3 weeks ago
lol read the question we talk about terraform provider and not the gcp , aws terraform provider so for me is D
upvoted 1 times

  ashxos 5 months, 2 weeks ago


Selected Answer: E
The Terraform Registry includes documentation for a wide range of providers developed by HashiCorp, third-party vendors, and our Terraform
community.

https://www.terraform.io/language/providers
upvoted 2 times

  bora4motion 2 months ago


and what does terraform community mean to you? robots?
individuals by me. A.
upvoted 1 times

  danioct1917 6 months ago


I'd say D is not correct. For me, D is the good one
upvoted 3 times

  danioct1917 6 months ago


E, sorry
upvoted 2 times

  coco10k 6 months ago


Selected Answer: E
why a cloud provider cannot maintain it's own terraform provider?
upvoted 3 times
Question #9 Topic 1

What command does Terraform require the �rst time you run it within a con�guration directory?

A. terraform import

B. terraform init

C. terraform plan

D. terraform workspace

Correct Answer: B
terraform init command is used to initialize a working directory containing Terraform con�guration �les.
Reference:
https://www.terraform.io/docs/cli/commands/init.html

Community vote distribution


B (100%)

  softarts Highly Voted  5 months, 1 week ago


it is B
upvoted 7 times

  Eltooth Most Recent  4 months ago


Selected Answer: B
B is correct answer.
upvoted 2 times

  Ahmad_Terraform 4 months ago


B is correct , init starts the backend and prepare terraform
upvoted 2 times

  javibadillo 5 months ago


Selected Answer: B
Agree with B
upvoted 4 times
Question #10 Topic 1

You have deployed a new webapp with a public IP address on a cloud provider. However, you did not create any outputs for your code.
What is the best method to quickly �nd the IP address of the resource you deployed?

A. Run terraform output ip_address to view the result

B. In a new folder, use the terraform_remote_state data source to load in the state �le, then write an output for each resource that you �nd the
state �le

C. Run terraform state list to �nd the name of the resource, then terraform state show to �nd the attributes including public IP address

D. Run terraform destroy then terraform apply and look for the IP address in stdout

Correct Answer: A
Reference:
https://www.terraform.io/docs/cli/commands/output.html

Community vote distribution


C (100%)

  coco10k Highly Voted  6 months ago


Selected Answer: C
You can find the info in the state.
not A because you don't have to outputs defined.
upvoted 15 times

  Yonex Most Recent  16 hours, 32 minutes ago


Selected Answer: C
Answer should be "C" instead of "A"
You don't have output in the code then how to return from "A"?
upvoted 1 times

  babuappnet 1 month ago


C is the right one.
upvoted 1 times

  RVivek 1 month, 1 week ago


Selected Answer: C
C is the only logical answer.
A is wrong, since output is not defied
upvoted 1 times

  RVivek 1 month, 3 weeks ago


Selected Answer: C
Not A- Since you have not defined Output
Not B. You cannot write output from statafile
C- works fine
Not D -That will destroy the resource
upvoted 2 times

  cjig 3 months, 1 week ago


Selected Answer: C
C is correct answer.
https://www.terraform.io/cli/commands/state/show
upvoted 2 times

  Eltooth 4 months ago


Selected Answer: C
C is correct answer.
upvoted 2 times

  Ahmad_Terraform 4 months ago


C is correct answer
upvoted 2 times

  AzureGurl 4 months, 2 weeks ago


Answer is C, I have tested it.
upvoted 1 times

  Oyster 4 months, 3 weeks ago


Answer is C
upvoted 1 times
  javibadillo 5 months ago
Selected Answer: C
Agree with C
upvoted 2 times

  Kowser 5 months ago


Answer is C
upvoted 1 times

  ashxos 5 months, 2 weeks ago


Selected Answer: C
If the output is not defined then you will not get any output using the command mentioned in Option 1. Hence it is better to search the Value in
state file.
upvoted 1 times

  koneba1309 5 months, 3 weeks ago


I feel even C is not correct, as it will not show you the attribute value. The correct command would be terraform state show
upvoted 1 times

  imtiaz01 6 months ago


Selected Answer: C
C is the correct answer.
upvoted 3 times

  Kowser 6 months ago


agreed correct answer is C
upvoted 3 times

  Mechanic 6 months ago


Selected Answer: C
You can't output what is not defined as an output resource.
upvoted 1 times
Question #11 Topic 1

Which of the following is not a key principle of infrastructure as code?

A. Versioned infrastructure

B. Golden images

C. Idempotence

D. Self-describing infrastructure

Correct Answer: ABD


Reference:
https://docs.microsoft.com/en-us/azure/devops/learn/what-is-infrastructure-as-
code#:~:text=Idempotence%20is%20a%20principle%20of,of%20the%
20environment's%20starting%20state
.

Community vote distribution


B (79%) ABD (21%)

  ItaloVinodi Highly Voted  5 months, 2 weeks ago


Sorry but here is asking which is NOT a key principle. I think the answer is B, golden Image
upvoted 18 times

  icebox0e Most Recent  1 week, 2 days ago


Selected Answer: B
The answer is B
upvoted 1 times

  alexik96 3 weeks ago


B is correct. Even if you're not sure, you can eliminate the others
A - is a principle (think of the case when you store the state in an S3 bucket and it gets versioned)
B - is NOT a principle (where in terraform documentation is mentioned anything related to images)
C - it is a principle by definition of what terraform does
D - is a principle as you use declarative language -> infrastructure describes itself
upvoted 1 times

  RVivek 1 month, 1 week ago


Selected Answer: B
Other points defenitely part of IaC
upvoted 2 times

  geekneek 2 months, 1 week ago


I vote B. Golden Images.
upvoted 1 times

  svsilence 3 months, 2 weeks ago


B golden image.
upvoted 1 times

  GodofAzure 3 months, 4 weeks ago


Selected Answer: B
its b, its asking what is not
upvoted 3 times

  Eltooth 4 months ago


Selected Answer: B
B is correct answer.
upvoted 1 times

  Ahmad_Terraform 4 months ago


B is correct ,
upvoted 3 times

  habbypat123 4 months ago


The correct answer is B - Golden Image
upvoted 2 times

  Zam88 4 months ago


Selected Answer: ABD
correct answer
upvoted 1 times

  Zam88 4 months ago


correction answer should be B
upvoted 2 times

  rfd 4 months ago


Selected Answer: B
The correct ans is B
upvoted 2 times

  Cedhulk 4 months, 1 week ago


Selected Answer: B
Just B
upvoted 2 times

  petliura 5 months ago


ACD - are indeed the key principles of IaC. The correct answer is B.
upvoted 2 times

  javibadillo 5 months ago


Selected Answer: ABD
A,B,D is correct
upvoted 1 times

  rfd 4 months ago


The question is "Which of the following is not", it cannot be ABD as they are principles of IaC. The correct ans is B
upvoted 1 times

  Kowser 5 months ago


i think answer is B
upvoted 2 times

  vitasac 5 months, 1 week ago


Yes I'm Agree with Italo answer B
upvoted 2 times
Question #12 Topic 1

Terraform variables and outputs that set the "description" argument will store that description in the state �le.

A. True

B. False

Correct Answer: A

Community vote distribution


B (100%)

  ali�e 1 week, 3 days ago


Selected Answer: B
it isn't in the state, just check it
upvoted 1 times

  RVivek 1 month, 1 week ago


Selected Answer: B
I checked in my LAB. terraform.tfstate file doesnot store descriptions
upvoted 2 times

  ser_ka 1 month, 3 weeks ago


Selected Answer: B
Should be B. Tested this - no any descriptions v 1.2.7
upvoted 3 times

  antivrillee 1 month, 3 weeks ago


Selected Answer: B
Answer is B. Descriptions aren't stored in the state file.
upvoted 4 times
Question #13 Topic 1

What is the provider for this �ctitious resource?

A. vpc

B. main

C. aws

D. test

Correct Answer: C
Reference:
https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/resource-types.html

Community vote distribution


C (100%)

  softarts Highly Voted  5 months, 1 week ago


C (aws)
upvoted 7 times

  ali�e Most Recent  1 week, 3 days ago


Selected Answer: C
c, aws
upvoted 1 times

  Eltooth 4 months ago


Selected Answer: C
C is correct answer.
upvoted 1 times

  mk1708 4 months ago


C (aws)
upvoted 2 times

  cytron 4 months, 3 weeks ago


C (aws)
upvoted 2 times

  habros 4 months, 4 weeks ago


C. aws_vpc is subset of AWS provider
upvoted 2 times

  habros 4 months, 4 weeks ago


C. aws_vpc is sunset of AWS provider
upvoted 2 times
Question #14 Topic 1

If you manually destroy infrastructure, what is the best practice re�ecting this change in Terraform?

A. Run terraform refresh

B. It will happen automatically

C. Manually update the state �re

D. Run terraform import

Correct Answer: B

Community vote distribution


A (82%) B (18%)

  tf181 Highly Voted  6 months ago


How could change reflect in terraform without doing anything?
I think A is right answer. any thoughts?
upvoted 15 times

  G__ Highly Voted  6 months ago


Wouldn't it be A?
upvoted 7 times

  icebox0e Most Recent  1 week, 2 days ago


Selected Answer: A
The answer is A
upvoted 1 times

  joeyjones 1 week, 3 days ago


Terraform refresh will help you to check your state drift
upvoted 1 times

  udibie 3 weeks ago


Selected Answer: B
happens automatically
upvoted 1 times

  RVivek 1 month, 1 week ago


Selected Answer: B
exceret from Terraform documentation
"You shouldn't typically need to use this command, because Terraform automatically performs the same refreshing actions as a part of creating a
plan in both the terraform plan and terraform apply commands. This command is here primarily for backward compatibility, but we don't
recommend using it because it provides no opportunity to review the effects of the operation before updating the state."

https://www.terraform.io/cli/commands
/refresh#:~:text=The%20terraform%20refresh%20command%20reads%20the%20current%20settings%20from%20all%20managed%20remote%20
objects%20and%20updates%20the%20Terraform%20state%20to%20match
upvoted 2 times

  RVivek 1 month ago


B is the best parctice A will work but terraform does not recommend the command is there only for backwor comapatabilaity
upvoted 2 times

  ceros399 1 month, 2 weeks ago


Selected Answer: A
Ans = A
https://www.terraform.io/cli/commands
/refresh#:~:text=The%20terraform%20refresh%20command%20reads%20the%20current%20settings%20from%20all%20managed%20remote%20
objects%20and%20updates%20the%20Terraform%20state%20to%20match.
upvoted 1 times

  ser_ka 1 month, 3 weeks ago


Selected Answer: A
of course A, although better to use command "terraform apply -refresh-only"
upvoted 2 times

  doumx 2 months, 1 week ago


Answer is C or A
upvoted 1 times

  svsilence 2 months, 3 weeks ago


if you want to just state refresh you can use "terraform apply -refresh-only" command now. terraform refresh deprecated so answer is A
upvoted 3 times

  yuvifose 3 months, 1 week ago


A should be the answer here
upvoted 1 times

  Eltooth 3 months, 2 weeks ago


Selected Answer: A
A is correct answer (within scope of these answers) : refresh
Best answer is described below and maybe in updated exam question.

"The terraform refresh command reads the current settings from all managed remote objects and updates the Terraform state to match.

Warning: This command is deprecated, because its default behavior is unsafe if you have misconfigured credentials for any of your providers. See
below for more information and recommended alternatives.

This won't modify your real remote objects, but it will modify the Terraform state.

You shouldn't typically need to use this command, because Terraform automatically performs the same refreshing actions as a part of creating a
plan in both the terraform plan and terraform apply commands. This command is here primarily for backward compatibility, but we don't
recommend using it because it provides no opportunity to review the effects of the operation before updating the state."

https://www.terraform.io/cli/commands/refresh
upvoted 1 times

  David90 3 months, 3 weeks ago


Since Terraform does not recommend using refresh anymore, I will choose B.
upvoted 3 times

  CHRIS12722222 2 months, 4 weeks ago


Answer B CANNOT be correct since changes made outside terraform will not be incorporated automatically into terraform
upvoted 1 times

  cjig 3 months, 3 weeks ago


Option - A should be the Answer .
Ref: https://www.terraform.io/cli/commands/refresh
upvoted 1 times

  mk1708 4 months ago


A , terraform refresh is working fine
upvoted 1 times

  ShwetaAshok 4 months ago


The -destroy option to terraform apply exists only in Terraform v0.15.2 and later. For earlier versions, you must use terraform destroy to get the
effect of terraform apply -destroy.
upvoted 1 times

  AzureGurl 4 months, 2 weeks ago


A is the correct answer, I have replicated this.
Created a Resource using Tf configuration
Deleted it from the portal.
Ran Tf Refresh, This will delete the resource details from state file.
upvoted 2 times
Question #15 Topic 1

What is not processed when running a terraform refresh?

A. State �le

B. Con�guration �le

C. Credentials

D. Cloud provider

Correct Answer: CD
Reference:
https://www.terraform.io/docs/cli/commands/refresh.html

Community vote distribution


B (94%) 6%

  wangchung Highly Voted  5 months ago


Selected Answer: B
A. State file - its updated during the refresh
B. Configuration file -
C. Credentials - required to get onto the cloud
D. Cloud provider - required to carry out the refresh of whats in the cloud vs whats in state.
upvoted 10 times

  yogishrb2020 Most Recent  2 weeks ago


Selected Answer: BD
State file and if credentials stored in the state file gets updated.
I chose B and D
upvoted 1 times

  Pinky0289 1 month, 1 week ago


There is no change/impact on the configuration file during the refresh, therefore the answer is B. Configuration file.
upvoted 1 times

  cjig 3 months ago


Selected Answer: B
Configuration file is not processed.
upvoted 1 times

  LongKB 4 months, 1 week ago


Selected Answer: B
B is correct
upvoted 1 times

  atul7696 5 months ago


answer should be B...
upvoted 2 times

  cloudcuckooland 5 months ago


Selected Answer: B
the answer has to be B, as per docs, it's checking remote objects and update the state file, it needs to process the creds to connect, the cloud
provider to check objects and the state to update.
"The terraform refresh command reads the current settings from all managed remote objects and updates the Terraform state to match."
upvoted 3 times

  softarts 5 months, 1 week ago


CD https://www.terraform.io/cli/commands/refresh
upvoted 1 times

  Eniras 5 months, 3 weeks ago


Running refresh does not modify infrastructure, but does modify the state file. If the state has drifted from the last time Terraform ran, refresh
allows that drift to be detected. By default, a backup of your state file is written to terraform. tfstate.
upvoted 2 times
Question #16 Topic 1

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

Correct Answer: E
Reference:
https://www.terraform.io/docs/registry/modules/publish.html

Community vote distribution


D (96%) 4%

  Egger1992 Highly Voted  5 months, 3 weeks ago


Selected Answer: D
According to the documentation provided, D is correct.
Extract from documentation:
"The registry extracts information about the module from the module's source. The module name, provider, documentation, inputs/outputs, and
dependencies are all parsed and available via the UI or API, as well as the same information for any submodules or examples in the module's
source repository."
upvoted 18 times

  icebox0e Most Recent  1 week, 2 days ago


Selected Answer: D
The answer is D
upvoted 1 times

  RVivek 1 month, 1 week ago


Selected Answer: C
Module informttion includes only input/output.
A and B talks about input variables. Input variables is a way of providing input not

Extract from documentation:


"The registry extracts information about the module from the module's source. The module name, provider, documentation, inputs/outputs, and
dependencies are all parsed and available via the UI or API, as well as the same information for any submodules or examples in the module's
source repository."
upvoted 1 times

  RVivek 1 month, 1 week ago


Please ignore Answer is D
upvoted 2 times

  Eltooth 3 months, 2 weeks ago


Selected Answer: D
D is correct answer : All of the above.
upvoted 2 times
  fabiomlop 4 months, 1 week ago
Selected Answer: D
Provided aswer is unrelated to the question.
upvoted 1 times

  bicycle 4 months, 2 weeks ago


Selected Answer: D
https://www.terraform.io/registry/modules/publish
upvoted 1 times

  318touring 5 months, 2 weeks ago


Yes, agreed with @Egger1992, the provided answer is incorrect
upvoted 1 times

Question #17 Topic 1

If a module uses a local values, you can expose that value with a terraform output.

A. True

B. False

Correct Answer: A
Output values are like function return values.
Reference:
https://www.terraform.io/docs/language/values/locals.html
https://www.terraform.io/docs/language/values/outputs.html

Community vote distribution


A (100%)

  hectordj 6 days, 22 hours ago


Selected Answer: A
A is correct
upvoted 1 times

  poojithakadiyala 3 weeks, 5 days ago


A is correct
upvoted 1 times

  daaww 1 month, 2 weeks ago


Selected Answer: A
A is correct
upvoted 3 times
Question #18 Topic 1

You should store secret data in the same version control repository as your Terraform con�guration.

A. True

B. False

Correct Answer: B
Reference:
https://blog.gruntwork.io/a-comprehensive-guide-to-managing-secrets-in-your-terraform-code-1d586955ace1

Community vote distribution


B (100%)

  Eltooth 3 months, 2 weeks ago


Selected Answer: B
B is correct answer : false.
upvoted 4 times

  fabiomlop 4 months, 1 week ago


Selected Answer: B
If you store secrets in a version control system, they will be exposed in plain text to anyone with access to the repository.
upvoted 3 times

  Eniras 5 months, 3 weeks ago


It's false. Your secrets are stored in a dedicated secret store that enforces encryption and strict access control.
upvoted 3 times
Question #19 Topic 1

Which of the following is not a valid string function in Terraform?

A. split

B. join

C. slice

D. chomp

Correct Answer: D
Reference:
https://www.terraform.io/docs/language/functions/chomp.html

Community vote distribution


C (100%)

  testtaker_1885 Highly Voted  6 months ago


answer is c

slice not listed in official docs

https://www.terraform.io/language/functions
upvoted 14 times

  bp339 5 months, 1 week ago


https://www.terraform.io/language/functions/slice
upvoted 2 times

  doumx 4 months, 3 weeks ago


string function
upvoted 2 times

  coco10k Highly Voted  6 months ago


Selected Answer: C
slice is not in string function list.
upvoted 9 times

  staunchdaddy69 Most Recent  1 month, 1 week ago


What is with all these wrong answers?? You have provided the docs for literally a correct answer C! SORT IT OUT
upvoted 1 times

  charlesguowh 2 months ago


answer is c
slice is a collection function
upvoted 1 times

  geekneek 2 months, 1 week ago


The answer is c.
slice does not exist.
upvoted 1 times
  aiya 2 months, 2 weeks ago
Answer is C - slice
upvoted 1 times

  Eltooth 3 months, 3 weeks ago


Selected Answer: C
C is correct answer.
upvoted 1 times

  fabiomlop 4 months, 1 week ago


Selected Answer: C
Altough slice is a valid function, it is not a string function. The equivalent for string would be substr.
upvoted 4 times

  LongKB 4 months, 1 week ago


Selected Answer: C
slice is correct
upvoted 2 times

  bp339 5 months, 1 week ago


https://www.terraform.io/language/functions/slice
upvoted 1 times

  bp339 5 months, 1 week ago


sorry slice is not a string function but a collection.
upvoted 1 times

  bigboi23 5 months, 2 weeks ago


Selected Answer: C
https://www.terraform.io/language/functions/chomp
upvoted 3 times

  cminor01 5 months, 2 weeks ago


Selected Answer: C
Slice is not listed in docs as others have stated.
upvoted 2 times
Question #20 Topic 1

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 con�guration for the existing VMs

D. Run the terraform import-gcp command

Correct Answer: BD
The terraform import command is used to import existing infrastructure.
Import existing Google Cloud resources into Terraform with Terraformer.
Reference:
https://www.terraform.io/docs/cli/import/usage.html
https://cloud.google.com/docs/terraform

Community vote distribution


BC (100%)

  tipzzz Highly Voted  6 months ago


BC for sure
upvoted 20 times

  fabiomlop Highly Voted  4 months, 1 week ago


Selected Answer: BC
You should create the equivalent configuration first, and then run import to load it on the state file.
upvoted 6 times

  Pinky0289 Most Recent  1 month, 1 week ago


For resources created outside terraform, you first write the configuration and then import it inside terraform, so the answer is B and C.
upvoted 1 times

  RVivek 1 month, 1 week ago


Selected Answer: BC
To manage a resource that was created manually using Terraform you have to import the resource steps
1 Create a configuration file
2. run import
upvoted 2 times

  Chokies 1 month, 2 weeks ago


Selected Answer: BC
BC is the answer
upvoted 1 times

  Burakko 2 months ago


BC for sure
upvoted 1 times

  Dinya_jui 2 months, 1 week ago


BC for sure
upvoted 1 times

  cjig 3 months ago


Selected Answer: BC
Answer is BC
upvoted 1 times

  yuvifose 3 months, 1 week ago


B and C are the correct ones
upvoted 1 times

  svsilence 3 months, 2 weeks ago


BC ofc
upvoted 1 times
  Eltooth 3 months, 3 weeks ago
Selected Answer: BC
B and C are correct answers.
upvoted 1 times

  Valerioly98 5 months ago


Selected Answer: BC
BC I THINK
upvoted 1 times

  Haigk 5 months, 1 week ago


Selected Answer: BC
The command in D (terraform import-gcp) doesn't even exist.
upvoted 1 times

  ItaloVinodi 5 months, 2 weeks ago


Selected Answer: BC
Why Exam topics always have this wrong answers, from where did they take ? Answer is BC, first import and then declare them in configuration files
upvoted 3 times

  318touring 5 months, 2 weeks ago


Yup, BC
upvoted 1 times

  vitasac 5 months, 3 weeks ago


Selected Answer: BC
Of course BC
upvoted 2 times
Question #21 Topic 1

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 con�guring each compute instance manually. This has led to inconsistent con�guration between each compute instance.
How would you solve this using infrastructure as code?

A. Implement a ticketing work�ow that makes engineers submit a ticket before manually provisioning and con�guring a resource

B. Implement a checklist that engineers can follow when con�guring 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 con�gurations committed to your version control system following code
reviews

Correct Answer: A

Community vote distribution


D (100%)

  tipzzz Highly Voted  6 months ago


Selected Answer: D
D for sure
upvoted 17 times

  Eniras 5 months, 3 weeks ago


Yes Answer is D
upvoted 2 times

  vitasac Highly Voted  5 months, 4 weeks ago


Yes I'm agree D is correct
upvoted 7 times

  icebox0e Most Recent  1 week, 2 days ago


Selected Answer: D
D for sure
upvoted 1 times

  RVivek 1 month ago


Selected Answer: D
A -- Again manual provisioning it will not address the problem
B-- Using a Check list, is again a manula process and can result in error
C-- The question is about eleminating error due to manaual process. Also this is a Terraform Exam . So this soloution is irrelevent
D: Correct answer beacuse , this automates the deployment with standard conficuration.
upvoted 3 times

  cjig 3 months ago


Selected Answer: D
Answer is D
upvoted 2 times

  yuvifose 3 months, 1 week ago


D for sure, it's what TF is all about!
upvoted 1 times

  BlackZeros 4 months ago


I think wrong answers are good for brain exercise, I do not rely on their given answers and always go to discussion to figure out the right answer.
upvoted 5 times

  fabiomlop 4 months, 1 week ago


Selected Answer: D
Obviously D... who picks those answers, FFS...
upvoted 6 times

  Eltooth 4 months, 1 week ago


Selected Answer: D
D is the correct answer for sure. Any DevOps Eng would know this.
upvoted 2 times

  ItaloVinodi 5 months, 2 weeks ago


Selected Answer: D
D for sure
upvoted 3 times

Question #22 Topic 1

terraform init initializes a sample main.tf �le in the current directory.

A. True

B. False

Correct Answer: A

Community vote distribution


B (100%)

  AmitRoy 1 month, 1 week ago


Should not be A? This is from official documentation https://www.terraform.io/cli/commands/init -
The terraform init command is used to initialize a working directory containing Terraform configuration files.
As per qstn, the configuration file is sample main.tf
upvoted 1 times

  alex_cloud 1 month, 2 weeks ago


Selected Answer: B
Tested. no main/sample file after init
upvoted 1 times

  dinesh198728 1 month, 2 weeks ago


Selected Answer: B
Not require
upvoted 1 times

  empperador 1 month, 3 weeks ago


Selected Answer: B
Terrform Init prepare the state storage, retrieves modules and retrieves plugins. B is the answer
upvoted 2 times

  Burakko 1 month, 3 weeks ago


Selected Answer: B
terraform init does not initialize any sample tf file.
The correct answer is B.
upvoted 2 times

  Burakko 1 month, 3 weeks ago


terraform init does not initialize any sample tf file.
The correct answer is B.
upvoted 2 times
Question #23 Topic 1

Which two steps are required to provision new infrastructure in the Terraform work�ow? (Choose two.)

A. Destroy

B. Apply

C. Import

D. Init

E. Validate

Correct Answer: BD
Reference:
https://www.terraform.io/guides/core-work�ow.html

Community vote distribution


BD (100%)

  RVivek 1 month ago


Selected Answer: BD
A- is to destrory
C- is to import an existng resource that was manually created . The question is about provisioning a new resource
E - is sjust to valaidate the command structure
upvoted 1 times

  cjig 3 months ago


Selected Answer: BD
Options B and D are correct.
upvoted 3 times

  Eltooth 4 months ago


Selected Answer: BD
B and D are correct answers.
upvoted 3 times

  BlackZeros 4 months ago


Selected Answer: BD
b and d sounds logical
upvoted 2 times

  javibadillo 4 months, 2 weeks ago


Selected Answer: BD
b and d
upvoted 3 times

  softarts 5 months, 1 week ago


D and B
upvoted 4 times
Question #24 Topic 1

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

Correct Answer: B
The terraform taint command manually marks a Terraform-managed resource as tainted, forcing it to be destroyed and recreated on the next
apply.
Reference:
https://www.terraform.io/docs/cli/commands/taint.html

Community vote distribution


B (100%)

  Eltooth 3 months, 2 weeks ago


Selected Answer: B
Noe of the answers really explain what taint command does - except B is closest.

"The terraform taint command informs Terraform that a particular object has become degraded or damaged. Terraform represents this by marking
the object as "tainted" in the Terraform state, and Terraform will propose to replace it in the next plan you create."

https://www.terraform.io/cli/commands/taint
upvoted 4 times

  BlackZeros 4 months ago


Selected Answer: B
b it is
upvoted 2 times

  javibadillo 4 months, 2 weeks ago


Selected Answer: B
https://www.terraform.io/cli/commands/taint#recommended-alternative
upvoted 3 times

  softarts 5 months, 1 week ago


it is B
upvoted 3 times

  d0ug7979 5 months, 2 weeks ago


This command is now deprecated since v0.15.2 and suggested option is now terraform apply -replace="state_object"
https://www.terraform.io/cli/commands/taint#recommended-alternative
upvoted 2 times

  biscuithammer 5 months ago


yes but on the exam it's still a valid answer
upvoted 1 times
Question #25 Topic 1

Terraform requires the Go runtime as a prerequisite for installation.

A. True

B. False

Correct Answer: B
Reference:
https://www.terraform.io/docs/extend/guides/v1-upgrade-guide.html

Community vote distribution


B (100%)

  Eltooth 3 months, 2 weeks ago


Selected Answer: B
B is correct answer : False.

This has been updated with https://www.terraform.io/plugin/sdkv2/guides/v1-upgrade-guide and https://www.terraform.io/plugin/sdkv2/guides


/v2-upgrade-guide
upvoted 4 times

  Empel 4 months ago


Selected Answer: B
Terraform software is written in Go but it is not require to have go installed as you get a binary after installing terraform.
upvoted 3 times

  amrith501 4 months, 2 weeks ago


Selected Answer: B
I did not see any documention saying terraform requires go runtime. I will go with false
upvoted 2 times
Question #26 Topic 1

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. You apply failed due to a state lock

Correct Answer: C
Manually unlock the state for the de�ned con�guration.
Reference:
https://www.terraform.io/docs/cli/commands/force-unlock.html

Community vote distribution


C (100%)

  Egger1992 Highly Voted  5 months, 3 weeks ago


Selected Answer: C
Be very careful with this command. If you unlock the state when someone else is holding the lock it could cause multiple writers. Force unlock
should only be used to unlock your own lock in the situation where automatic unlocking failed.
Source: https://www.terraform.io/language/state/locking
upvoted 12 times

  ceros399 Most Recent  1 month, 1 week ago


Selected Answer: C
answer is c
upvoted 1 times

  Eltooth 3 months, 2 weeks ago


Selected Answer: C
C is correct answer.
https://www.terraform.io/language/state/locking
https://www.terraform.io/cli/commands/force-unlock
upvoted 3 times
Question #27 Topic 1

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

Correct Answer: A

Community vote distribution


A (100%)

  Eltooth 4 months ago


Selected Answer: A
A is correct answer.
upvoted 2 times

  Eltooth 4 months ago


https://www.terraform.io/language/modules/sources
upvoted 2 times

  Ahmad_Terraform 4 months ago


A is correct
upvoted 1 times

  HungDang 4 months, 1 week ago


Selected Answer: A
A is correct
upvoted 3 times

  softarts 5 months, 1 week ago


I choose A
upvoted 4 times
Question #28 Topic 1

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

Correct Answer: A

Community vote distribution


A (90%) 10%

  koneba1309 Highly Voted  5 months, 3 weeks ago


Selected Answer: A
I think it is A.
upvoted 8 times

  RVivek Most Recent  1 month ago


Selected Answer: A
A is available in Terraform cloud and not in Terraform OSS
upvoted 1 times

  0ptimus 1 month, 3 weeks ago


Selected Answer: A
It is definitely A
upvoted 3 times

  yuvifose 3 months, 1 week ago


Selected Answer: A
I think is A
upvoted 3 times

  nhatne 3 months, 3 weeks ago


Selected Answer: A
it's A
upvoted 4 times

  Ahmad_Terraform 4 months ago


i think A
upvoted 1 times

  bp339 5 months ago


Selected Answer: A
A is correct
upvoted 3 times

  biscuithammer 5 months ago


Selected Answer: A
it should be A
upvoted 2 times

  ItaloVinodi 5 months, 2 weeks ago


Selected Answer: A
I think A is correct
upvoted 2 times

  JoG1221 5 months, 2 weeks ago


A is correct
upvoted 2 times

  tipzzz 6 months ago


Selected Answer: D
for sure
upvoted 3 times
Question #29 Topic 1

terraform validate validates the syntax of Terraform �les.

A. True

B. False

Correct Answer: A
The terraform validate command validates the syntax and arguments of the Terraform con�guration �les.
Reference:
https://www.terraform.io/docs/cli/code/index.html

Community vote distribution


A (100%)

  kilowd 1 month, 3 weeks ago


Validate runs checks that verify whether a configuration is syntactically valid and internally consistent, regardless of any provided variables or
existing state. It is thus primarily useful for general verification of reusable modules, including correctness of attribute names and value types.
upvoted 2 times

  Eltooth 3 months, 2 weeks ago


Selected Answer: A
A is correct answer.
https://www.terraform.io/cli/commands/validate
upvoted 2 times

  biscuithammer 5 months ago


Selected Answer: A
A is correct

https://www.terraform.io/cli/commands/validate
upvoted 4 times
Question #30 Topic 1

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 con�guration. To be safe, you would like to �rst 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 �rst output all the resources that will be deleted before prompting for approval.

Correct Answer: CD
Reference:
https://www.terraform.io/docs/cli/commands/state/rm.html

Community vote distribution


AD (100%)

  Ipergorta Highly Voted  5 months, 3 weeks ago


The answer is A,D
upvoted 19 times

  ItaloVinodi Highly Voted  5 months, 2 weeks ago


Selected Answer: AD
We need to choose two so AD
upvoted 8 times

  RVivek Most Recent  1 month ago


Selected Answer: AD
https://www.terraform.io/cli/commands/destroy
terraform plan -destroy
Copy
This will run terraform plan in destroy mode, showing you the proposed destroy changes without executing them

C is absurd that will make the deployed resources not managible by Terraform
upvoted 2 times

  Pinky0289 1 month, 1 week ago


Tested. Options A and D are correct.
upvoted 2 times

  najslejdi 2 months ago


Usage: terraform destroy [options]

This command is just a convenience alias for the following command:

terraform apply -destroy

For that reason, this command accepts most of the options that terraform apply accepts, although it does not accept a plan file argument and
forces the selection of the "destroy" planning mode.
upvoted 1 times
  cjig 3 months ago
Selected Answer: AD
Answer is A and D
upvoted 1 times

  yuvifose 3 months, 1 week ago


Selected Answer: AD
A and D!
upvoted 1 times

  Eltooth 3 months, 2 weeks ago


Selected Answer: AD
A and D are correct answers.
upvoted 1 times

  nhatne 3 months, 3 weeks ago


Selected Answer: AD
should be A,D
upvoted 1 times

  Rikktm 4 months ago


it's A and D, checked it.
upvoted 1 times

  HungDang 4 months, 1 week ago


Selected Answer: AD
AD is correct
upvoted 4 times

  Ipergorta 5 months, 3 weeks ago


terraform plan -destroy
Select the "destroy" planning mode, which creates a plan to destroy all objects currently managed by this
Terraform configuration instead of the usual behavior.
upvoted 2 times
Question #31 Topic 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

Correct Answer: A

Community vote distribution


D (100%)

  tipzzz Highly Voted  6 months ago


D for sure
upvoted 18 times

  vitasac Highly Voted  5 months, 4 weeks ago


Selected Answer: D
Yes I'm agree D
upvoted 9 times

  RVivek Most Recent  1 month ago


Selected Answer: D
D
to pass a value to a module the syntax is
<child module variable name > = <value>
Here child module variable name is servers
to reference the value of a variable in main/root module var. <name_of _the varibale>
upvoted 1 times

  najslejdi 2 months ago


Selected Answer: D
D correct
upvoted 2 times

  prince1234 2 months, 2 weeks ago


Selected Answer: D
I am thinking these supplied answer want to engage discussions .
upvoted 2 times

  Tomcrui1234589 2 months, 2 weeks ago


Selected Answer: D
D for sure.
Variables are called using var.<variable_name> inside the resource arguments
upvoted 1 times

  yuvifose 3 months, 1 week ago


Selected Answer: D
D for sure!
upvoted 1 times

  Eltooth 3 months, 2 weeks ago


Selected Answer: D
D is correct answer : var.NAME

"Within the module that declared a variable, its value can be accessed from within expressions as var.<NAME>, where <NAME> matches the label
given in the declaration block:

Note: Input variables are created by a variable block, but you reference them as attributes on an object named var."

https://www.terraform.io/language/values/variables#using-input-variable-values
upvoted 3 times

  ItaloVinodi 5 months, 2 weeks ago


Selected Answer: D
D is the right one
upvoted 3 times
Question #32 Topic 1

A Terraform provisioner must be nested inside a resource con�guration block.

A. True

B. False

Correct Answer: A
Most provisioners require access to the remote resource via SSH or WinRM, and expect a nested connection block with details about how to
connect.
Reference:
https://www.terraform.io/docs/language/resources/provisioners/connection.html

Community vote distribution


A (63%) B (37%)

  quixo Highly Voted  3 months, 2 weeks ago


A: True.

Example:

resource "aws_instance" "web" {


# ...

provisioner "local-exec" {
command = "echo The server's IP address is ${self.private_ip}"
}
}
upvoted 5 times

  faltu1985 Most Recent  4 weeks ago


Selected Answer: A
I think ans is A
upvoted 2 times

  RVivek 1 month ago


Selected Answer: A
True
null_resource is resource type used when you want to run provsioner out side any resorce block
provsioner block will not work if it is not included in a resource/null_resource block
upvoted 1 times

  Burakko 1 month, 3 weeks ago


Selected Answer: B
can be , not must be.
upvoted 1 times

  donathon 2 months, 2 weeks ago


Selected Answer: B
resource "aws_eip" "myeip" {
vpc = "true"
}

resource "aws_eip" "myeip01" {


vpc = "true"
provider = aws.aws02
}

provider "aws" {
region = "us-west-1"
}

provider "aws" {
alias = "aws02"
region = "ap-south-1"
}
Looking at my lab example. The answer is false. You can put it inside resource block but it doesn't have to be. You only put it in resource block if
there are multiple providers.
upvoted 3 times

  Ashu_0007 2 months, 2 weeks ago


Do you understand difference between provider and provisioner
upvoted 9 times
  svsilence 3 months, 2 weeks ago
answer B.

not must be. it can be inside resource block.


upvoted 2 times

  CHRIS12722222 2 months, 3 weeks ago


Which other block type can it be in if not resource block?
upvoted 2 times

  nhatne 3 months, 3 weeks ago


Selected Answer: B
But the key here is "must be". it's not "must be"
upvoted 1 times

  nhatne 3 months, 3 weeks ago


sorry i was confuse with provider, it should be A
upvoted 2 times

  Oskar_Madin 3 months, 4 weeks ago


Terraform provisioner must NOT be nested inside a resource configuration block because not all resource configuration blocks require a
provisioner block. (it is absolutely not necessary a provisioner block for example for "aws_vpc").
upvoted 1 times

  Cedhulk 3 months, 4 weeks ago


Selected Answer: A
"you can add a provisioner block inside the resource block..."
source : https://www.terraform.io/language/resources/provisioners/syntax
upvoted 4 times

  Eltooth 4 months ago


Selected Answer: A
A is correct answer.

"If you are certain that provisioners are the best way to solve your problem after considering the advice in the sections above, you can add a
provisioner block inside the resource block of a compute instance."

https://www.terraform.io/language/resources/provisioners/syntax?_ga=2.158695858.964344447.1656246968-433701022.1656246968&
_gl=1*1rbcuyq*_ga*NDMzNzAxMDIyLjE2NTYyNDY5Njg.*_ga_P7S46ZYEKW*MTY1NjI3MDA3Ny4yLjEuMTY1NjI3MTM5NS4w#how-to-use-
provisioners
upvoted 2 times

  Empel 4 months ago


Selected Answer: A
Quote from Terraform site "f you are certain that provisioners are the best way to solve your problem after considering the advice in the sections
above, you can add a provisioner block inside the resource block of a compute instance." https://www.terraform.io/language/resources
/provisioners/syntax#how-to-use-provisioners
upvoted 3 times

  rfd 3 months, 4 weeks ago


What you have referred to above talks about a specific scenario, not a blanket statement. No specific scenario is mentioned in question. So
"must be nested...." is not required.
upvoted 1 times

  Teanna 4 months ago


I think the answer is A. This is an example of code that I've written that has been tested and works.

resource "aws_volume_attachment" "ebs_att" {


device_name = "/dev/sdh"
volume_id = aws_ebs_volume.kibana_storage.id
instance_id = aws_instance.kibana.id
}

resource "aws_ebs_volume" "kibana_storage" {


availability_zone = "us-east-2a"
size = 50
}
upvoted 3 times

  szl0144 4 months ago


A Terraform provisioner must be nested inside a resource configuration block
upvoted 1 times

  subhala 4 months ago


Provisioner block should be inside the resource config block.
upvoted 1 times

  Zam88 4 months, 1 week ago


A CORRECT
If you are certain that provisioners are the best way to solve your problem after considering the advice in the sections above, you can add a
provisioner block inside the resource block of a compute instance. https://www.terraform.io/language/resources/provisioners/syntax
upvoted 4 times
  fabiomlop 4 months, 1 week ago
Selected Answer: B
Provisioner configuration doesn't go inside a resource configuration block.
upvoted 2 times

Question #33 Topic 1

Terraform can run on Windows or Linux, but it requires a Server version of the Windows operating system.

A. True

B. False

Correct Answer: B

Community vote distribution


B (100%)

  softarts Highly Voted  5 months, 1 week ago


choose B
upvoted 13 times

  Eltooth Most Recent  3 months, 2 weeks ago


Selected Answer: B
B is correct answer : false.
upvoted 3 times

  javibadillo 4 months, 1 week ago


Selected Answer: B
B https://www.terraform.io/downloads
upvoted 4 times
Question #34 Topic 1

What does the default "local" Terraform backend store?

A. tfplan �les

B. Terraform binary

C. Provider plugins

D. State �le

Correct Answer: D
The local backend stores state on the local �lesystem, locks that state using system APIs, and performs operations locally.
Reference:
https://www.terraform.io/docs/language/settings/backends/local.html

Community vote distribution


D (100%)

  softarts Highly Voted  5 months, 1 week ago


choose D
upvoted 10 times

  Eltooth Most Recent  4 months ago


Selected Answer: D
D is correct answer.
https://www.terraform.io/language/settings/backends/local
https://www.terraform.io/language/state
upvoted 4 times
Question #35 Topic 1

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 Con�guration 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 �le (*.tf)

D. Write a shell script to transform Terraform �les using tools such as AWK, Python, and sed

Correct Answer: C
✑ Indent two spaces for each nesting level.
✑ When multiple arguments with single-line values appear on consecutive lines at the same nesting level, align their equals signs.
Reference:
https://www.terraform.io/docs/language/syntax/style.html

Community vote distribution


A (100%)

  vitasac Highly Voted  5 months, 4 weeks ago


Selected Answer: A
Yes Answer A
upvoted 23 times

  calebvar Highly Voted  6 months ago


correct answer is A
upvoted 7 times

  yuvifose Most Recent  3 months, 1 week ago


Selected Answer: A
A is what `terraform fmt` is designed for. Similar to `go fmt`
upvoted 1 times

  Eltooth 3 months, 2 weeks ago


Selected Answer: A
A is correct answer.
https://www.terraform.io/cli/commands/fmt
upvoted 1 times

  Eltooth 4 months ago


Selected Answer: A
A is correct answer.
https://www.terraform.io/cli/commands/fmt
upvoted 1 times

  fabiomlop 4 months, 1 week ago


Selected Answer: A
terraform fmt is meant for this task.
upvoted 2 times

  Haigk 5 months ago


Selected Answer: A
Yup, this should be A.
upvoted 3 times

  temp111 5 months, 3 weeks ago


Yes. Correct Answer is A
upvoted 2 times

  tipzzz 6 months ago


Note: You can enforce these conventions automatically by running terraform fmt.
upvoted 3 times
Question #36 Topic 1

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

Correct Answer: D
Terraform Registry is an index of modules shared publicly using this protocol. This public registry is the easiest way to get started with
Terraform and �nd modules created by others in the community.
Reference:
https://www.terraform.io/docs/language/modules/sources.html

Community vote distribution


C (100%)

  vitasac Highly Voted  5 months, 4 weeks ago


Selected Answer: C
for sure C
upvoted 13 times

  tipzzz Highly Voted  6 months ago


Selected Answer: C
Terraform Cloud's private registry works similarly to the public Terraform Registry and helps you share Terraform providers and Terraform modules
across your organization. It includes support for versioning and a searchable list of available providers and modules.
upvoted 6 times

  legendary7 Most Recent  3 weeks, 6 days ago


C - is the correct answer.
D- is simply the advantage of Public registry over Private registry. It is the opposite of what the question asks
upvoted 1 times

  yuvifose 3 months, 1 week ago


Selected Answer: C
The answer should be C
upvoted 1 times

  Eltooth 4 months ago


Selected Answer: C
C is correct answer.
upvoted 1 times

  fabiomlop 4 months, 1 week ago


Selected Answer: C
It's a private registry, therefore you can make it private LOL
upvoted 2 times

  Parthasarathi 5 months, 2 weeks ago


Selected Answer: C
It should be C
upvoted 1 times

  temp111 5 months, 3 weeks ago


Answer is C
upvoted 2 times
Question #37 Topic 1

Which task does terraform init not perform?

A. Sources all providers present in the con�guration and ensures they are downloaded and available locally

B. Connects to the backend

C. Sources any modules and copies the con�guration locally

D. Validates all required variables are present

Correct Answer: D
Reference:
https://www.terraform.io/docs/cli/commands/init.html

Community vote distribution


D (100%)

  elvancedonzy Highly Voted  4 months, 3 weeks ago


Selected Answer: D
D is correct
upvoted 11 times

  Burakko Most Recent  1 month, 3 weeks ago


Selected Answer: D
terraform plan or apply does "validates all required variables are present"
upvoted 1 times

  �aviu888 3 months, 3 weeks ago


yes, should be D
upvoted 2 times

  Eltooth 4 months ago


Selected Answer: D
D is correct answer.
upvoted 1 times

  Ahmad_Terraform 4 months ago


yes INIT does not validate variables
upvoted 1 times

  habros 4 months, 4 weeks ago


Looks like C to me
upvoted 2 times

  Oskar_Madin 3 months, 3 weeks ago


go and learn first no one need your looks like
upvoted 3 times
Question #38 Topic 1

You have declared a variable called var.list which is a list of objects that all have an attribute id.
Which options will produce a list of the IDs? (Choose two.)

A. { for o in var.list : o => o.id }

B. var.list[*].id

C. [ var.list[*].id ]

D. [ for o in var.list : o.id ]

Correct Answer: AB

Community vote distribution


BD (89%) 11%

  bigboi23 Highly Voted  5 months, 1 week ago


Selected Answer: BD
https://www.terraform.io/language/expressions/splat
A splat expression provides a more concise way to express a common operation that could otherwise be performed with a for expression.
upvoted 11 times

  niccsm Most Recent  4 days, 8 hours ago


Definitely D not A
https://developer.hashicorp.com/terraform/language/expressions/for
upvoted 1 times

  asudhin 3 weeks ago


Selected Answer: BD
It is B&D
upvoted 1 times

  nick7513 1 month, 1 week ago


Selected Answer: BD
B&D are correct both

[for o in var.list : o.id] This is equivalent to the following splat expression: var.list[*].id
upvoted 1 times

  najslejdi 2 months ago


Selected Answer: BD
B & D are correct
upvoted 2 times

  yuvifose 3 months, 1 week ago


Selected Answer: BD
B and D. {} are not lists but dicts/maps/objects
upvoted 1 times

  Eltooth 3 months, 4 weeks ago


Selected Answer: BD
B and D are correct answers.

https://www.terraform.io/language/expressions/splat
upvoted 1 times

  BlackZeros 4 months ago


Selected Answer: BD
b and d seems correct
upvoted 1 times

  Zam88 4 months, 1 week ago


Selected Answer: BD
BD correct
upvoted 3 times

  fsdgrtsdfcjmu 5 months ago


I choose BD
upvoted 4 times
  petliura 5 months ago
B, D - straight from the documentation: https://www.terraform.io/language/expressions/splat
upvoted 4 times

  ItaloVinodi 5 months, 2 weeks ago


Selected Answer: BD
I'm wrong sorry according to documentation https://www.terraform.io/language/expressions/for BD is the right
upvoted 4 times

  ItaloVinodi 5 months, 2 weeks ago


Selected Answer: AB
I think AB is correct also looking at brackets
upvoted 2 times

  Parthasarathi 5 months, 2 weeks ago


Selected Answer: AB
AB is correct
upvoted 2 times

  rajje 5 months, 2 weeks ago


https://www.terraform.io/language/expressions/splat
upvoted 3 times

  dumbu 5 months, 2 weeks ago


AB is correct as D is already list and it has for loop inside a list, which is not required
upvoted 1 times

  vitasac 5 months, 3 weeks ago


Selected Answer: BD
BD for sure
upvoted 4 times
Question #39 Topic 1

Which argument(s) is (are) required when declaring a Terraform variable?

A. type

B. default

C. description

D. All of the above

E. None of the above

Correct Answer: B
The variable declaration can also include a default argument.
Reference:
https://www.terraform.io/docs/language/values/variables.html

Community vote distribution


E (88%) 12%

  Egger1992 Highly Voted  5 months, 3 weeks ago


Selected Answer: E
The type argument in a variable block allows you to restrict the type of value that will be accepted as the value for a variable. If no type constraint
is set then a value of any type is accepted.
Source: https://www.terraform.io/language/values/variables
upvoted 19 times

  gcpz Highly Voted  6 months ago


Correct is E
Terraform CLI defines the following OPTIONAL arguments for variable declarations:

default - A default value which then makes the variable optional.


type - This argument specifies what value types are accepted for the variable.
description - This specifies the input variable's documentation.
validation - A block to define validation rules, usually in addition to type constraints.
sensitive - Limits Terraform UI output when the variable is used in configuration.
nullable - Specify if the variable can be null within the module.
upvoted 10 times

  Tomcrui1234589 Most Recent  2 months, 2 weeks ago


Correct Answer E.
When a variable block is written like variable "foo" {
}
you get an interactive prompts for entering values for foo
all arguments are optional
upvoted 1 times

  Eltooth 3 months, 4 weeks ago


Selected Answer: E
E is correct answer.
https://www.terraform.io/language/values/variables#arguments
upvoted 1 times

  AzureGurl 4 months, 2 weeks ago


E is the correct option. You can define like this

variable "application_name" {
}

and it works, in the tf plan.


upvoted 5 times

  Parthasarathi 5 months, 2 weeks ago


Selected Answer: E
Correct is E
upvoted 2 times

  318touring 5 months, 2 weeks ago


E is the correct answer
upvoted 2 times

  dumbu 5 months, 2 weeks ago


E is correct answer.
upvoted 2 times

  esandips 5 months, 4 weeks ago


Ans: E
Terraform CLI defines the following optional arguments for variable declarations:
default - A default value which then makes the variable optional.
type - This argument specifies what value types are accepted for the variable.
description - This specifies the input variable's documentation.
validation - A block to define validation rules, usually in addition to type constraints.
sensitive - Limits Terraform UI output when the variable is used in configuration.
upvoted 5 times

  calebvar 6 months ago


Answer should be A
upvoted 2 times

  tipzzz 6 months ago


Selected Answer: A
A for sure
upvoted 3 times
Question #40 Topic 1

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?

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

Correct Answer: C

Community vote distribution


C (100%)

  amrith501 Highly Voted  4 months, 2 weeks ago


Selected Answer: C
C correct answer

Version
When using modules installed from a module registry, we recommend explicitly constraining the acceptable version numbers to avoid unexpected
or unwanted changes.

Use the version argument in the module block to specify versions:

module "consul" {
source = "hashicorp/consul/aws"
version = "0.0.5"

servers = 3
}
upvoted 12 times

  aleksand41 Most Recent  2 weeks, 5 days ago


Selected Answer: C
C is correct
upvoted 1 times

  Eltooth 3 months, 4 weeks ago


Selected Answer: C
C is correct answer.

The version argument accepts a version constraint string. Terraform will use the newest installed version of the module that meets the constraint; if
no acceptable versions are installed, it will download the newest version that meets the constraint.

Version constraints are supported only for modules installed from a module registry, such as the public Terraform Registry or Terraform Cloud's
private module registry. Other module sources can provide their own versioning mechanisms within the source string itself, or might not support
versions at all. In particular, modules sourced from local file paths do not support version; since they're loaded from the same source repository,
they always share the same version as their caller.

https://www.terraform.io/language/modules/syntax#version
upvoted 2 times

  elvancedonzy 4 months, 3 weeks ago


Selected Answer: C
C is correct
https://www.terraform.io/language/modules/syntax
upvoted 3 times
Question #41 Topic 1

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)

Correct Answer: BC
Reference:
https://www.terraform.io/docs/enterprise/admin/automated-recovery.html https://www.terraform.io/docs/language/state/remote.html

Community vote distribution


CD (100%)

  cytron Highly Voted  4 months, 3 weeks ago


Selected Answer: CD
CD because there is web UI
upvoted 15 times

  cjig Most Recent  3 months ago


Selected Answer: CD
C and D are correct answers, there is no auto backup in Terraform cloud.
https://www.terraform.io/enterprise/admin/infrastructure/backup-restore
upvoted 4 times

  Eltooth 3 months, 2 weeks ago


Selected Answer: CD
C and D are correct answers.
upvoted 2 times

  Ahmad_Terraform 4 months ago


BCD looks fitting
upvoted 1 times

  Raynman727 5 months ago


Is this not CD? There is definitely a Web UI for Terraform Cloud
upvoted 2 times

  pj2001 5 months ago


should be CD?
upvoted 2 times
Question #42 Topic 1

Where does the Terraform local backend store its state?

A. In the /tmp directory

B. In the terraform �le

C. In the terraform.tfstate �le

D. In the user's terraform.state �le

Correct Answer: C
The local backend stores state on the local �lesystem, locks that state using system APIs, and performs operations locally.
Reference:
https://www.terraform.io/docs/language/settings/backends/local.html

Community vote distribution


C (100%)

  mav3r1ck Highly Voted  1 month, 3 weeks ago


C.

https://www.terraform.io/language/settings/backends/local
upvoted 5 times

  root_i_am Most Recent  1 month, 1 week ago


Selected Answer: C
The state is stored in the terraform.tfstate file in the root directory of the terraform project
upvoted 1 times
Question #43 Topic 1

Which option can not be used to keep secrets out of Terraform con�guration �les?

A. A Terraform provider

B. Environment variables

C. A -var �ag

D. secure string

Correct Answer: C
Reference:
https://secrethub.io/blog/secret-management-for-terraform/

Community vote distribution


D (63%) B (21%) A (16%)

  hip9k Highly Voted  2 months ago


Selected Answer: D
It's D
We can use providers to supply variable values (vault for example).
We can provide input variable value in parameter for apply command.
We can use environment variables.
HashiCorp is not mentioning anything about secure strings.
Reference:
https://www.terraform.io/language/values/variables
upvoted 9 times

  stalk98 Highly Voted  4 months, 2 weeks ago


i think D
upvoted 8 times

  Cassterraform Most Recent  1 month, 2 weeks ago


I think its A as its provider which has no relation with keeping secrets
upvoted 2 times

  donathon 2 months, 2 weeks ago


Selected Answer: A
B and C is definate a method as it's well documented.
https://www.terraform.io/language/values/variables#variables-on-the-command-line >> this shows an example of using -var during an apply to
put in something like secrets of password so it's not stored anywhere else. But this is not a very good method as the state file will still contain the
password in plain text.
upvoted 2 times

  bukake 2 months ago


Well AWS provider apply sensitive = true automatically for any DB created so technically Provider can be used to secure value
upvoted 1 times

  prince1234 2 months, 2 weeks ago


Selected Answer: D
I dont think they is something called secure string.
upvoted 1 times

  nhatne 3 months, 2 weeks ago


Selected Answer: D
I vote D
upvoted 1 times

  devopschamp 3 months, 3 weeks ago


Selected Answer: A
A appears to be the correct answer, by reading these references: https://blog.gruntwork.io/a-comprehensive-guide-to-managing-secrets-in-your-
terraform-code-1d586955ace1
and this https://github.com/hashicorp/terraform/issues/516
upvoted 1 times

  trongod05 3 months, 3 weeks ago


What is a -var flag?
upvoted 1 times

  Empel 3 months, 4 weeks ago


Selected Answer: D
The correct is D
upvoted 1 times

  Eltooth 3 months, 4 weeks ago


Selected Answer: B
If we remove the "not" from the question, we can eliminate incorrect answers.
Which option can "not" be used to keep secrets out of Terraform configuration files?

A. A Terraform provider - can pass strings and templates containing secrets within provider module
B. Environment variables - TF_VAR can be used to inject secrets outside of code
C. A -var flag - Can be used to pass variable from secret.tfvars file
D. secure string - Can be used to hold password

Correct answer is B

https://blog.gruntwork.io/a-comprehensive-guide-to-managing-secrets-in-your-terraform-code-1d586955ace1
upvoted 4 times

  yuvifose 3 months, 1 week ago


Yepp, looks like a typo in the question
upvoted 2 times

  Ahmad_Terraform 3 months, 4 weeks ago


A seems credible , Provider can not be used
upvoted 2 times

  szl0144 4 months ago


D is correct in my view.
upvoted 2 times

  habros 4 months, 3 weeks ago


I lean my decision towards A. Use a provider like Vault or Parameter Store to store sensitive keys
upvoted 5 times

  Empel 4 months ago


Is asking which is not.
upvoted 1 times

  abconline 4 months, 4 weeks ago


question is what cannot be used so I think A is correct
upvoted 3 times

  koneba1309 5 months, 3 weeks ago


Even B is valid option, as you can pass variables by setting the TF_VAR_whatever env variables
upvoted 3 times
Question #44 Topic 1

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 con�guration harder to read and understand

D. Terraform will run more slowly

Correct Answer: A
Reference:
https://github.com/hashicorp/terraform/issues/19291

Community vote distribution


C (100%)

  ItaloVinodi Highly Voted  5 months, 2 weeks ago


Selected Answer: C
Looking at documentation "Overuse of dynamic blocks can make configuration hard to read and maintain"
upvoted 7 times

  legendary7 Most Recent  3 weeks, 6 days ago


C- is the correct answer
Ref: https://www.terraform.io/language/expressions/dynamic-blocks#best-practices-for-dynamic-blocks
upvoted 2 times

  dnscloud02 1 month ago


Selected Answer: C
C is correct answer.
upvoted 1 times

  yuvifose 3 months, 1 week ago


Selected Answer: C
C is the correct answer. It's not recommended to abuse them because it hurts readability
upvoted 1 times

  Ahmad_Terraform 3 months, 1 week ago


They make configuration harder to read and understand
upvoted 1 times

  trongod05 3 months, 3 weeks ago


C "Overuse of dynamic blocks can make configuration hard to read and maintain, so we recommend using them only when you need to hide
details in order to build a clean user interface for a re-usable module. Always write nested blocks out literally where possible."
upvoted 3 times

  Eltooth 3 months, 4 weeks ago


Selected Answer: C
C is correct answer.
upvoted 1 times

  bigboi23 5 months, 1 week ago


Selected Answer: C
Dynamic blocks are used for looping, C is the right answer.
upvoted 4 times

  Oyster 5 months, 1 week ago


Answer should be C, They make your codes difficult to read
upvoted 3 times

  ShinLi 5 months, 3 weeks ago


Selected Answer: C
it should be C, A is a bug, from the URL provided below, it was fixed. "I re-tested this with v0.12.0-alpha4 and it seems to now be fixed. I did make a
few adjustments to the configuration example, though:"
upvoted 4 times
Question #45 Topic 1

Only the user that generated a plan may apply it.

A. True

B. False

Correct Answer: B

Community vote distribution


B (100%)

  Jaro3000 Highly Voted  4 months, 3 weeks ago


I suppose they do it by purpose so we discuss it
upvoted 9 times

  kopper2019 2 months, 2 weeks ago


this made me laugh :)
upvoted 1 times

  yuvifose Most Recent  3 months, 1 week ago


B is correct, a plan can be stored as a file and another person can execute the plan file
upvoted 4 times

  Ahmad_Terraform 3 months, 1 week ago


B is correct ,,
upvoted 1 times

  Eltooth 3 months, 4 weeks ago


Selected Answer: B
B is correct answer.
upvoted 2 times

  fsdgrtsdfcjmu 5 months ago


It looks like 50% of provided answers here are wrong, should be false
upvoted 2 times

  biscuithammer 5 months ago


Selected Answer: B
It should be B
upvoted 4 times

  ItaloVinodi 5 months, 2 weeks ago


Selected Answer: B
A lot of question are wrong here, in this case is B: False
upvoted 4 times

  Ipergorta 5 months, 3 weeks ago


B: False
upvoted 4 times
Question #46 Topic 1

Examine the following Terraform con�guration, which uses the data source for an AWS AMI.
What value should you enter for the ami argument in the AWS instance resource?

A. aws_ami.ubuntu

B. data.aws_ami.ubuntu

C. data.aws_ami.ubuntu.id

D. aws_ami.ubuntu.id

Correct Answer: C
resource "aws_instance" "web" {
ami = data.aws_ami.ubuntu.id
Reference:
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/instance

Community vote distribution


C (100%)

  Jaro3000 Highly Voted  4 months, 2 weeks ago


C is correct.
upvoted 11 times

  0ptimus Most Recent  1 month, 2 weeks ago


Selected Answer: C
data.aws_ami.ubuntu.id
upvoted 1 times

  Ahmad_Terraform 3 months, 1 week ago


data.aws_ami.ubuntu.id
upvoted 3 times

  Eltooth 3 months, 4 weeks ago


Selected Answer: C
C is correct answer.

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/instance
upvoted 4 times
Question #47 Topic 1

FILL BLANK -
You need to specify a dependency manually.
What resource meta-parameter can you use to make sure Terraform respects the dependency?
Type your answer in the �eld provided. The text �eld is not case-sensitive and all variations of the correct answer are accepted.

Correct Answer: depends_on

  habros Highly Voted  4 months, 4 weeks ago


depends_on
upvoted 11 times

  ddewit Most Recent  2 months ago


depends_on
upvoted 3 times

  kopper2019 2 months, 2 weeks ago


depends_on
upvoted 3 times

  svsilence 3 months, 2 weeks ago


depends_on
upvoted 4 times

  Eltooth 3 months, 2 weeks ago


"depends_on" is correct answer.
upvoted 4 times
Question #48 Topic 1

You have never used Terraform before and would like to test it out using a shared team account for a cloud provider. The shared team account
already contains
15 virtual machines (VM). You develop a Terraform con�guration containing one VM, perform terraform apply, and see that your VM was created
successfully.
What should you do to delete the newly-created VM with Terraform?

A. The Terraform state �le contains all 16 VMs in the team account. Execute terraform destroy and select the newly-created VM.

B. The Terraform state �le only contains the one new VM. Execute terraform destroy.

C. Delete the Terraform state �le and execute Terraform apply.

D. Delete the VM using the cloud provider console and terraform apply to apply the changes to the Terraform state �le.

Correct Answer: B

Community vote distribution


B (78%) A (22%)

  habros Highly Voted  4 months, 3 weeks ago


B. Only resources mentioned in terraform will be applied and reflected in state. Resources manually created in console and/or not defined in code
will not be captured by Terraform
upvoted 15 times

  pmzone Most Recent  3 weeks, 5 days ago


The single Vm can be deleted using -target option in terraform destroy. In this case, I am assuming that the 15 VM's are created using TF.
upvoted 1 times

  therealquan 2 months, 3 weeks ago


Selected Answer: B
Definitely B
upvoted 2 times

  therealquan 2 months, 3 weeks ago


the other existing VMs need to be imported to be affected by the terraform destroy
upvoted 2 times

  yuvifose 3 months, 1 week ago


Selected Answer: B
Since the other machines are not in Terraform yet, it won't touch them
upvoted 1 times

  Ahmad_Terraform 3 months, 1 week ago


because its shared ac
So A is correct
upvoted 1 times

  Eltooth 3 months, 4 weeks ago


Selected Answer: B
B is correct answer.
upvoted 1 times

  VANSI 4 months ago


Selected Answer: B
B easy
upvoted 3 times

  Empel 4 months ago


Selected Answer: B
Is B for sure. the state file does not contain information about anything else that you might have on the cloud provider
upvoted 1 times

  Zam88 4 months ago


You develop a Terraform configuration containing one VM, perform terraform apply, and see that your VM was created successfully.

read the question carefully "Terraform configuration containing one VM, perform terraform apply" so only one VM is in state file.

B should be correct
upvoted 2 times
  HDDH 4 months ago
Selected Answer: B
For sure
upvoted 2 times

  Zam88 4 months, 1 week ago


Selected Answer: B
I also think its B
upvoted 2 times

  Cedhulk 4 months, 1 week ago


Selected Answer: B
imo B because it wasn't mentioned that the 15 vm were created by terraform. So, it's not in the conf. You have to import before if you want your
conf update
upvoted 2 times

  stalk98 4 months, 2 weeks ago


i think b
upvoted 2 times

  biscuithammer 5 months ago


Selected Answer: A
It didn't mention whether it's using a different workspace or even whether the configuration was overwritten or a separate one. It should be A
upvoted 1 times

  wangchung 5 months ago


The question says " You develop a Terraform configuration containing one VM,"... would that not mean that a different state file therefore the 15
vms would not be registered
upvoted 4 times

  wangchung 5 months ago


B still.

" A. The Terraform state file contains all 16 VMs in the team account. Execute terraform destroy and select the newly-created VM. " ---- what
does that meant "select the newly-created VM" you can't destroy a single resource, to destroy and recreate a new resource you use terraform
taint to mark the resource for deletions and recreation
upvoted 3 times

  Jaro3000 4 months, 3 weeks ago


You can destroy a single resource using --target
But still B as we assume we have a separate state file with our vm only
upvoted 1 times

  Maaran07 5 months, 1 week ago


Selected Answer: A
Because it is shared account they already have 15 VM is running, hence state file might having those VM details. if it is different workspace i agree
with answer but this scenario would be A.
upvoted 3 times

  Maaran07 5 months, 1 week ago


But Answer A also raising concerns saying run terraform destroy then select VM which is not possible ! wondering !! some insight might help to
better understanding
upvoted 1 times

  wangchung 5 months ago


Its tricky as the question doesn't explicity say these 15 vm resources were created by TF
upvoted 4 times
Question #49 Topic 1

What is the name assigned by Terraform to reference this resource?

A. dev

B. azurerm_resource_group

C. azurerm

D. test

Correct Answer: A

Community vote distribution


A (100%)

  tipzzz Highly Voted  6 months ago


Selected Answer: A
dev for sure
upvoted 7 times

  najslejdi Most Recent  1 month, 4 weeks ago


Selected Answer: A
I am so disappointed. So many incorrect answers :-(
A is correct
upvoted 2 times

  Tomcrui1234589 2 months, 2 weeks ago


Selected Answer: A
FFS it should be A
upvoted 2 times

  Ahmad_Terraform 3 months, 1 week ago


dev
A. is correct
upvoted 2 times

  Eltooth 3 months, 2 weeks ago


Selected Answer: A
A is correct answer : dev.
upvoted 1 times

  Ahmad_Terraform 3 months, 4 weeks ago


dev A Correct
upvoted 3 times

  cloudbusting 5 months, 1 week ago


dev is tha answer
upvoted 3 times

  ItaloVinodi 5 months, 2 weeks ago


Selected Answer: A
"dev" ... answer A
upvoted 4 times

  temp111 5 months, 3 weeks ago


"dev"... Answer is A
upvoted 2 times

  vitasac 5 months, 4 weeks ago


Selected Answer: A
For Sure A
upvoted 4 times

  Kowser 6 months ago


Answer is A
upvoted 3 times
Question #50 Topic 1

Setting the TF_LOG environment variable to DEBUG causes debug messages to be logged into syslog.

A. True

B. False

Correct Answer: A
Reference:
https://www.terraform.io/docs/internals/debugging.html

Community vote distribution


B (75%) A (25%)

  esandips Highly Voted  5 months, 4 weeks ago


B
TF_LOG_PATH needs to be set as well
upvoted 12 times

  bigboi23 5 months, 1 week ago


No.
A is correct.
To persist logged output you can set TF_LOG_PATH in order to force the log to always be appended to a specific file when logging is enabled.
Note that even when TF_LOG_PATH is set, TF_LOG must be set in order for any logging to be enabled.
upvoted 1 times

  scepticemia 5 months, 2 weeks ago


Incorrect. A is the correct answer. TF_LOG_PATH just enables persistent logging to be appended to a specific file.
From the docs:
To persist logged output you can set TF_LOG_PATH in order to force the log to always be appended to a specific file when logging is enabled.

https://www.terraform.io/internals/debugging
upvoted 1 times

  nhatne 3 months, 2 weeks ago


B is correct because
TF_LOG_PATH IS NOT REQUIRED, in the docs, they do not mention HAVE TO SET TF_LOG_PATH, it is optional,
therefore without TF_LOG_PATH will cause detailed logs to appear on stderr.
upvoted 2 times

  abconline Highly Voted  4 months, 4 weeks ago


it should be false as it wont write to syslog but will just display on screen
upvoted 7 times

  kilowd 1 month, 3 weeks ago


Agree with @abcoline:
If TF_LOG_PATH is not set, output is sent to standard output and error in the terminal. If the environment variable is set, Terraform will append
logs from each run to the specified file.
upvoted 1 times

  RVivek Most Recent  1 month ago


Selected Answer: B
TF_LOG will enable log and send that to stderr (by default it iscreen) not to any syslog server.
TF_LOG_PARH can be set to redirect logs to a specific file
upvoted 2 times
  Pinky0289 1 month, 1 week ago
The answer should be B. False.
Setting TF_LOG variable to any env var ( TRACE, DEBUG, INFO, WARN, and Error) just causes it to display logs to stderr. In order to persist the log,
TF_LOG_PATH needs to be set.
upvoted 1 times

  lightbrd 1 month, 1 week ago


Its B.
If TF_LOG_PATH is empty (which is by default) the debug logs are directed to STDOUT ( terminal)
upvoted 1 times

  Ahmad_Terraform 3 months, 1 week ago


B is correct
upvoted 1 times

  Eltooth 3 months, 2 weeks ago


Selected Answer: B
B is correct answer.

Use TF_LOG_PATH to specify a file path where the log output file should be written. If you do not specify a log path, Terraform writes the specified
log output to stderr.
"Stderr, also known as standard error, is the default file descriptor where a process can write error messages.

In Unix-like operating systems, such as Linux, macOS X, and BSD, stderr is defined by the POSIX standard. Its default file descriptor number is 2.

In the terminal, standard error defaults to the user's screen."

https://www.computerhope.com/jargon/s/stderr.htm#:~:text=Stderr
%2C%20also%20known%20as%20standard,defaults%20to%20the%20user's%20screen.
upvoted 1 times

  Oskar_Madin 3 months, 4 weeks ago


please stop writing or suggestions if you don't know the answer or are not sure!
upvoted 5 times

  Zam88 3 months, 4 weeks ago


B false
upvoted 2 times

  Eltooth 3 months, 4 weeks ago


Selected Answer: A
A is correct answer. True.

"Terraform has detailed logs which can be enabled by setting the TF_LOG environment variable to any value. This will cause detailed logs to appear
on stderr."

"To persist logged output you can set TF_LOG_PATH in order to force the log to always be appended to a specific file when logging is enabled.
Note that even when TF_LOG_PATH is set, TF_LOG must be set in order for any logging to be enabled."

https://www.terraform.io/internals/debugging

"Logging is off for all subsystems by default. To enable logging for a Terraform run, set one or more logging environment variables to either JSON
format or a verbosity level."
"Use TF_LOG_PATH to specify a file path where the log output file should be written. If you do not specify a log path, Terraform writes the specified
log output to stderr."

Terraform can automatically create the output file at TF_LOG_PATH if it does not already exist. If the file does exist, Terraform adds new log output
onto the end of the file without truncating the file contents."
https://www.terraform.io/plugin/log/managing#enable-logging
upvoted 2 times

  Eltooth 3 months, 2 weeks ago


stderr outputs to screen. Answer should be B.

https://www.computerhope.com/jargon/s/stderr.htm#:~:text=Stderr
%2C%20also%20known%20as%20standard,defaults%20to%20the%20user's%20screen.
upvoted 1 times

  Zam88 4 months ago


How do you get Terraform logs?
Terraform has detailed logs which can be enabled by setting the TF_LOG environment variable to any value. This will cause detailed logs to appear
on stderr. You can set TF_LOG to one of the log levels TRACE , DEBUG , INFO , WARN or ERROR to change the verbosity of the logs.

B
upvoted 2 times

  bp339 4 months, 3 weeks ago


Selected Answer: B
Terraform has detailed logs which can be enabled by setting the TF_LOG environment variable to any value. This will cause detailed logs to appear
on stderr.

https://www.terraform.io/internals/debugging
upvoted 3 times
  pj2001 5 months ago
B, TF_LOG setting would send logs to stderr / console / terminal, not syslog
upvoted 5 times

Question #51 Topic 1

Where in your Terraform con�guration do you specify a state backend?

A. The terraform block

B. The resource block

C. The provider block

D. The datasource block

Correct Answer: A
Backends are con�gured with a nested backend block within the top-level terraform block.
Reference:
https://www.terraform.io/docs/language/settings/backends/con�guration.html

Community vote distribution


A (100%)

  Eltooth Highly Voted  3 months, 4 weeks ago


Selected Answer: A
A is correct answer.
"To configure a backend, add a nested backend block within the top-level terraform block. The following example configures the remote backend."

https://www.terraform.io/language/settings/backends/configuration
https://www.terraform.io/language/settings/backends/configuration#using-a-backend-block
upvoted 5 times

  Zam88 Most Recent  4 months, 1 week ago


A. The terraform block
upvoted 2 times

  CHRIS12722222 4 months, 1 week ago


terraform block
upvoted 1 times
Question #52 Topic 1

In Terraform 0.13 and above, outside of the required_providers block, Terraform con�gurations always refer to providers by their local names.

A. True

B. False

Correct Answer: A
Outside of the required_providers block, Terraform con�gurations always refer to providers by their local names.
Reference:
https://www.terraform.io/docs/language/providers/requirements.html

Community vote distribution


A (100%)

  Chehh 2 months ago


"Outside of the required_providers block, Terraform configurations always refer to providers by their local names."
https://www.terraform.io/language/providers/requirements#local-names
upvoted 3 times

  Eltooth 3 months, 4 weeks ago


Selected Answer: A
A is correct answer.

"Local names are module-specific, and are assigned when requiring a provider. Local names must be unique per-module.
Outside of the required_providers block, Terraform configurations always refer to providers by their local names."

https://www.terraform.io/language/providers/requirements#local-names
upvoted 4 times

  bigboi23 5 months, 1 week ago


Selected Answer: A
Correct!
https://www.terraform.io/language/providers/requirements
upvoted 4 times
Question #53 Topic 1

What command should you run to display all workspaces for the current con�guration?

A. terraform workspace

B. terraform workspace show

C. terraform workspace list

D. terraform show workspace

Correct Answer: C
terraform workspace list
The command will list all existing workspaces.
Reference:
https://www.terraform.io/docs/cli/commands/workspace/list.html

Community vote distribution


C (100%)

  bicycle Highly Voted  4 months, 2 weeks ago


Selected Answer: C
The terraform workspace list command is used to list all existing workspaces.
upvoted 5 times

  kcw6 Most Recent  2 months, 3 weeks ago


terraform workspace -help
Usage: terraform [global options] workspace

new, list, show, select and delete Terraform workspaces.

Subcommands:
delete Delete a workspace
list List Workspaces
new Create a new workspace
select Select a workspace
show Show the name of the current workspace
upvoted 3 times

  Eltooth 3 months, 4 weeks ago


Selected Answer: C
C is correct answer.
"The terraform workspace list command is used to list all existing workspaces."

https://www.terraform.io/cli/commands/workspace/list
upvoted 2 times
Question #54 Topic 1

Terraform providers are always installed from the Internet.

A. True

B. False

Correct Answer: B
Terraform con�gurations must declare which providers they require, so that Terraform can install and use them.
Reference:
https://www.terraform.io/docs/language/providers/con�guration.html

Community vote distribution


B (100%)

  Ahmad_Terraform 3 months, 1 week ago


B is correct,
upvoted 1 times

  Eltooth 3 months, 2 weeks ago


Selected Answer: B
B is correct answer.
upvoted 2 times

  amrith501 4 months, 1 week ago


Selected Answer: B
For air gapped systems, we can bundle provider along with the Terraform binaries. These Bundle can be installed without internet on air gapped
system.
NOTE: For downloading the bundle we need internet access, this can be done on a system which as internet access and later transfer to the air
gapped system
upvoted 3 times

  bigboi23 5 months, 1 week ago


Terraform CLI finds and installs providers when initializing a working directory. It can automatically download providers from a Terraform registry,
or load them from a local mirror or cache. If you are using a persistent working directory, you must reinitialize whenever you change a
configuration's providers.
upvoted 4 times
Question #55 Topic 1

Which of these is the best practice to protect sensitive values in state �les?

A. Blockchain

B. Secure Sockets Layer (SSL)

C. Enhanced remote backends

D. Signed Terraform providers

Correct Answer: C
Use of remote backends and especially the availability of Terraform Cloud, there are now a variety of backends that will encrypt state at rest and
will not store the state in cleartext on machines running.
Reference:
https://www.terraform.io/docs/extend/best-practices/sensitive-state.html

Community vote distribution


C (100%)

  Ahmad_Terraform 3 months, 1 week ago


Enhanced remote backends
upvoted 3 times

  Eltooth 3 months, 2 weeks ago


Selected Answer: C
C is correct answer.
upvoted 2 times

  HDDH 4 months ago


C for course
upvoted 1 times

  jouyang 5 months, 3 weeks ago


encrypted backend
upvoted 1 times
Question #56 Topic 1

When does terraform apply re�ect changes in the cloud environment?

A. Immediately

B. However long it takes the resource provider to ful�ll the request

C. After updating the state �le

D. Based on the value provided to the -refresh command line argument

E. None of the above

Correct Answer: B

Community vote distribution


B (81%) C (19%)

  vitasac Highly Voted  5 months, 3 weeks ago


Selected Answer: B
B for sure
upvoted 11 times

  Ipergorta Highly Voted  5 months, 3 weeks ago


Why no B?
upvoted 5 times

  faltu1985 Most Recent  4 weeks ago


Selected Answer: B
B for sure
upvoted 1 times

  Nightducky 1 week, 4 days ago


Why B? You have "when" not "how long" in the question.
upvoted 1 times

  RVivek 1 month ago


Selected Answer: C
When does terraform apply reflect changes in the cloud environment?
Terraform will apply chnages to the cloud, then it will update the state file. After it updates the statefile only it "reflects" those changes to the
screen
upvoted 1 times

  nhatne 3 months, 2 weeks ago


Selected Answer: C
I vote C because the question is "When" and from the docs:

Terraform plan and apply operations run an implicit in-memory refresh as part of their functionality, reconciling any drift from your state file before
suggesting infrastructure changes.
upvoted 2 times

  Eltooth 3 months, 2 weeks ago


Selected Answer: B
B is correct answer.
upvoted 1 times

  Zam88 4 months, 1 week ago


B is correct
upvoted 1 times

  AzureGurl 4 months, 2 weeks ago


B is the correct answer.
upvoted 1 times

  temp111 5 months, 3 weeks ago


I think, the answer is B.
upvoted 4 times
Question #57 Topic 1

How would you reference the "name" value of the second instance of this �ctitious resource?

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

Correct Answer: A
Reference:
https://www.terraform.io/docs/con�guration-0-11/interpolation.html

Community vote distribution


B (90%) 5%

  bigboi23 Highly Voted  5 months, 1 week ago


Selected Answer: B
B!!!!!!!!
upvoted 11 times

  franksoul Highly Voted  4 months, 2 weeks ago


Dear ALL, tested in Lab and Answer is : B
upvoted 8 times

  asudhin Most Recent  3 weeks ago


Selected Answer: B
It is B
upvoted 1 times

  RVivek 3 weeks, 5 days ago


Selected Answer: B
B is the right fromat
upvoted 1 times

  legendary7 3 weeks, 6 days ago


B is the correct answer no doubt.
upvoted 1 times

  kopper2019 2 months, 2 weeks ago


Selected Answer: B
B, aws_instance.web[1].name
upvoted 2 times

  kcw6 2 months, 3 weeks ago


B is correct.

resource "aws_iam_user" "lb" {


name = "terraform-${count.index}"
count = 2
path = "/system/"
}

output "testing" {
value = aws_iam_user.lb[1].name
}
===== output ======
Plan: 2 to add, 0 to change, 0 to destroy.

Changes to Outputs:
+ testing = "terraform-1"
upvoted 3 times
  Daniel2020 3 months, 3 weeks ago
Selected Answer: B
B - aws_instance.web[1].name !!!

Index starts at 0 so the second instance would be 1 - the link below confirms this:

https://www.terraform.io/language/meta-arguments/count#referring-to-instances
upvoted 2 times

  Eltooth 3 months, 4 weeks ago


Selected Answer: B
B is correct answer.
upvoted 1 times

  stalk98 4 months, 2 weeks ago


B from doc
upvoted 2 times

  cytron 4 months, 3 weeks ago


Selected Answer: A
They are two values of the name.
name = terraform-1
name = terraform-2

The index is not assigned to the key (name) but to the value (terraform-$(count.index). Remember this is not a list assigned to a variable, don't
reference it as a list.

So you can't call the resource by specifying the index directly onto the key like name[1] simply because the the index is assigned to a part of the
value which is a string not a list.

The only way I think is to use the element function to call the resource after which specify the index number as an argument to the function -
element(resource, index)
upvoted 1 times

  CHRIS12722222 4 months, 1 week ago


Option A is wrong because the element (list, index) is zero-based, so if at all we should use this function, the index ought to be 1, not 2

https://www.terraform.io/language/functions/element
upvoted 3 times

  rfd 4 months ago


Don't understand why you are suggesting A. Surely there will be two ec2 instances created here, you can just get the name property for those
instances using B.
The code terraform-${count.index} has no bearing on execution of the loop or anything to do with list's indexes.
upvoted 2 times

  Sathya22 5 months, 1 week ago


Answer is option B .Index starts at 0 , so name[1] is equivalent to second resource . SO this should be the answer
upvoted 4 times

  rogerxavier 5 months, 2 weeks ago


It is correct, really is letter A, following the offcial answer above:

element(list, index) - Returns a single element from a list at the given index. If the index is greater than the number of elements, this function will
wrap using a standard mod algorithm. This function only works on flat lists. Examples:

element(aws_subnet.foo.*.id, count.index)
element(var.list_of_strings, 2)
upvoted 2 times

  JoG1221 5 months, 2 weeks ago


B..it is
upvoted 5 times

  temp111 5 months, 3 weeks ago


it must be B.
upvoted 4 times

  Ipergorta 5 months, 3 weeks ago


B for sure
upvoted 5 times

  vitasac 5 months, 3 weeks ago


Selected Answer: D
D for sure
upvoted 1 times

  smyndlo 5 months, 3 weeks ago


Index start with [0], so the second instance will be aws_instance.web[1].
Answer is B
upvoted 1 times

  vitasac 5 months, 2 weeks ago


Yes your're right
upvoted 1 times
Question #58 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

Correct Answer: D
Reference:
https://www.terraform.io/docs/con�guration-0-11/providers.html

Community vote distribution


B (71%) 14% 14%

  Zam88 Highly Voted  4 months, 1 week ago


answer is B
upvoted 5 times

  amrith501 Highly Voted  4 months, 2 weeks ago


Selected Answer: B
The answer should be B
A terraform can only provision resouce in one Cloud not multiple cloud
upvoted 5 times

  maddy90 Most Recent  3 days, 15 hours ago


answer is D
upvoted 1 times

  john_doe_1999 3 days, 19 hours ago


Answer is C
upvoted 1 times

  Bobby1977 2 weeks, 6 days ago


ya D is correct
upvoted 2 times

  tf_user 1 month, 1 week ago


Selected Answer: D
D is the correct
upvoted 2 times

  Fati_2022 1 month, 2 weeks ago


"The fact that Terraform is not tied to a specific infrastructure or cloud provider makes it a powerful tool in multi-provider deployments. You are
able to manage all resources using the same set of configuration files, sharing variables or defining dependencies between resources across
providers"
upvoted 2 times

  Fati_2022 1 month, 2 weeks ago


D is the correct answer
upvoted 4 times

  GopinathM 1 month, 2 weeks ago


D is right answer its says the provider is not responsible for .
Provider is responsible for below Providers
Providers are a logical abstraction of an upstream API. They are responsible for understanding API interactions and exposing resources. and also
multiple clouds
upvoted 3 times
  zyxphreez 2 months ago
Selected Answer: A
Im not completely sure if the answer is A or D, the question is about the provider IS NOT responsible...... and definitely the provider IS responsible
to provision Infrastructure in multiple cloud providers.

"Terraform uses providers to provision resources, which describe one or more infrastructure objects like virtual networks and compute instances.
Each provider on the Terraform Registry has documentation detailing available resources and their configuration options."
https://www.terraform.io/cdktf/concepts/providers
upvoted 2 times

  Eltooth 3 months, 2 weeks ago


Selected Answer: B
B is correct answer.
upvoted 1 times

  saryu 3 months, 3 weeks ago


Selected Answer: B
B is right
upvoted 2 times

  bicycle 4 months, 2 weeks ago


Selected Answer: B
https://www.terraform.io/language/providers
upvoted 2 times
Question #59 Topic 1

Terraform provisioners can be added to any resource block.

A. True

B. False

Correct Answer: A
Reference:
https://www.terraform.io/docs/language/resources/provisioners/syntax.html

Community vote distribution


A (53%) B (47%)

  elnurgu 6 days, 10 hours ago


Selected Answer: A
I can add local-exec to any resource block such as aws_s3, aws_eip and etc.,
So, answer is A
upvoted 3 times

  kshdiuashduahsduas 2 weeks, 6 days ago


Selected Answer: A
definitely A
upvoted 1 times

  Bobby1977 2 weeks, 6 days ago


A is correct
upvoted 1 times

  alexik96 3 weeks ago


A: I can add a local-exec to any resource block
upvoted 1 times

  udibie 3 weeks, 1 day ago


Selected Answer: A
A is correct
upvoted 1 times

  daaww 3 weeks, 2 days ago


Selected Answer: A
A is correct
upvoted 1 times

  faltu1985 4 weeks ago


Selected Answer: A
I think ans is A
upvoted 1 times
  GopinathM 1 month, 2 weeks ago
A is correct
https://www.terraform.io/language/resources/provisioners/syntax
resource "aws_instance" "web" {
# ...

provisioner "local-exec" {
command = "echo The server's IP address is ${self.private_ip}"
}
}
upvoted 4 times

  Fati_2022 1 month, 2 weeks ago


A
https://www.phillipsj.net/posts/introduction-to-terraform-provisioners/
As you continue learning about Terraform, you will start hearing about provisioners. Terraform provisioners can be created on any resource and
provide a way to execute actions on local or remote machines.
upvoted 1 times

  tbhtp 2 months, 1 week ago


Selected Answer: A
A is right: You definitively CAN add the "local-exec" provisioner to any resource, as this executes the command on the local system where the tf
runs.
See the doc example with the "null_resource" for local-exec.
Please note that people maybe voted B because "remote-exec" is the only provisioner they know.

https://www.terraform.io/language/resources/provisioners/local-exec
upvoted 1 times

  19kilo 3 months, 2 weeks ago


Literally just tried it in an S3 resource. lol almost like they put out a false question list to weed people out.

Error: Unsupported block type


on main.tf line 20, in module "s3_bucket":
20: provisioner "local-exec" {
Blocks of type "provisioner" are not expected here.
upvoted 1 times

  19kilo 3 months, 2 weeks ago


Never mind, forgot that I was using a module. Seemed to validate and plan ok with an S3 resource while also having a provisioner. Has to be a
trick question. The documentation states "you can add a provisioner block inside the resource block of a compute instance." They call out
compute instance, but it appears to work on non-compute resource blocks. ¯\_(ツ)_/¯ I'm calling it true from my testing. However, the apply did
fail due to what was in the provisioner.
https://www.terraform.io/language/resources/provisioners/syntax#how-to-use-provisioners
upvoted 1 times

  lucitama 3 months, 3 weeks ago


If you are certain that provisioners are the best way to solve your problem after considering the advice in the sections above, you can add a
provisioner block inside the resource block of a compute instance.

B is correct
upvoted 2 times

  Eltooth 3 months, 4 weeks ago


Selected Answer: B
B is correct answer. False.
https://www.terraform.io/language/providers/requirements#requiring-providers
upvoted 2 times

  tbhtp 2 months, 1 week ago


B is certainly false: The question is about provisioners not providers.
upvoted 1 times

  Oskar_Madin 3 months, 4 weeks ago


how we can execute scripts for example in such resource "aws_security_group" even its resource? Provisioners are used to execute scripts on a local
or remote machine as part of resource creation or destruction. so answer is False.
upvoted 1 times

  CHRIS12722222 2 months, 4 weeks ago


This statement is incorrect. Local exec provisioners can execute in any resource block. I think you are referrring to remote-exec provisioners
which need to be in resource block of compute instances
upvoted 2 times

  Zam88 4 months, 1 week ago


If you are certain that provisioners are the best way to solve your problem after considering the advice in the sections above, you can add a
provisioner block inside the resource block of a compute instance.

above from the doc


B is correct
upvoted 1 times
  cytron 4 months, 3 weeks ago
Selected Answer: B
Its a B. You can't add a provisioned to the Terraform block in example.
upvoted 2 times

  Jaro3000 4 months, 2 weeks ago


They ask about resource blocks. Terraform block is not a resource block.
upvoted 3 times

  mifune 4 months ago


You are right, but, within all "resource" blocks, not all of them can address a provisioner, for example, an aws_eip
upvoted 1 times

  pj2001 5 months ago


Can you not add "local-exec" provisioner to any resource block? I pick A
upvoted 2 times
Question #60 Topic 1

What is terraform refresh intended to detect?

A. Terraform con�guration code changes

B. Empty state �les

C. State �le drift

D. Corrupt state �les

Correct Answer: C
Reference:
https://www.hashicorp.com/blog/detecting-and-managing-drift-with-terraform

Community vote distribution


C (100%)

  lucitama 3 months, 3 weeks ago


Selected Answer: C
C is correct
upvoted 3 times

  Eltooth 3 months, 4 weeks ago


Selected Answer: C
C is the closet correct answer, however this command is no longer in use.

"The terraform refresh command reads the current settings from all managed remote objects and updates the Terraform state to match.

Warning: This command is deprecated, because its default behavior is unsafe if you have misconfigured credentials for any of your providers. See
below for more information and recommended alternatives."

https://www.terraform.io/cli/commands/refresh
upvoted 3 times

  amrith501 4 months, 1 week ago


Selected Answer: C
State file drift for sure
upvoted 4 times
Question #61 Topic 1

FILL BLANK -
Which �ag would you add to terraform plan to save the execution plan to a �le?
Type your answer in the �eld provided. The text �eld is not case-sensitive and all variations of the correct answer are accepted.

Correct Answer: -out=FILENAME


Reference:
https://www.terraform.io/docs/cli/commands/plan.html

  kopper2019 2 months, 2 weeks ago


terraform plan -out=FILE
upvoted 2 times

  Honeywealth 3 months, 3 weeks ago


-out=FILE
upvoted 3 times

  Eltooth 3 months, 4 weeks ago


Answer is correct: terraform plan -out=FILE

"You can use the optional -out=FILE option to save the generated plan to a file on disk, which you can later execute by passing the file to terraform
apply as an extra argument. This two-step workflow is primarily intended for when running Terraform in automation.

If you run terraform plan without the -out=FILE option then it will create a speculative plan, which is a description of the effect of the plan but
without any intent to actually apply it."

https://www.terraform.io/cli/commands/plan
upvoted 1 times
Question #62 Topic 1

FILL BLANK -
What is the name of the default �le where Terraform stores the state?
Type your answer in the �eld provided. The text �eld is not case-sensitive and all variations of the correct answer are accepted.

Correct Answer: Terraform.tfstate


Reference:
https://www.terraform.io/docs/language/state/index.html

  kopper2019 2 months, 2 weeks ago


terraform.tfstate
upvoted 1 times

  Eltooth 3 months, 4 weeks ago


Answer is correct : terraform.tfstate

"This state is stored by default in a local file named "terraform.tfstate", but it can also be stored remotely, which works better in a team
environment."

https://www.terraform.io/language/state
upvoted 1 times
Question #63 Topic 1

A Terraform local value can reference other Terraform local values.

A. True

B. False

Correct Answer: A
Reference:
https://www.terraform.io/docs/con�guration-0-11/locals.html

Community vote distribution


A (100%)

  Eltooth Highly Voted  3 months, 4 weeks ago


Answer is correct : True

"The expressions in local values are not limited to literal constants; they can also reference other values in the module in order to transform or
combine them, including variables, resource attributes, or other local values:"

https://www.terraform.io/language/values/locals#declaring-a-local-value
upvoted 6 times

  eduvar4 Most Recent  3 weeks, 6 days ago


Selected Answer: A
https://developer.hashicorp.com/terraform/language/values/locals#declaring-a-local-value
upvoted 1 times
Question #64 Topic 1

Which of the following is not a valid Terraform collection type?

A. list

B. map

C. tree

D. set

Correct Answer: C
Reference:
https://www.terraform.io/docs/language/expressions/type-constraints.html

Community vote distribution


C (100%)

  Ignotus 3 months, 2 weeks ago


my bad, is NOT a valid... answer C is correct
upvoted 1 times

  Ignotus 3 months, 2 weeks ago


tree isn't even on that page..
upvoted 1 times

  Ahmad_Terraform 3 months, 3 weeks ago


C is the right answer
upvoted 3 times

  Eltooth 3 months, 4 weeks ago


Selected Answer: C
C is correct answer. Tree

https://www.terraform.io/language/expressions/type-constraints#collection-types
upvoted 2 times
Question #65 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

Correct Answer: B
Reference:
https://www.devopsschool.com/blog/terraform-taint-and-untaint-explained-with-example-programs-and-tutorials/

Community vote distribution


B (100%)

  Ahmad_Terraform 3 months, 1 week ago


next apply.
upvoted 2 times

  HereToReAssureMyself 3 months, 3 weeks ago


Selected Answer: B
its not immediately

The terraform taint command informs Terraform that a particular object has become degraded or damaged. Terraform represents this by marking
the object as "tainted" in the Terraform state, and Terraform will propose to replace it in the next plan you create.
upvoted 3 times

  Eltooth 3 months, 4 weeks ago


Selected Answer: B
B is correct answer. False.

"The terraform taint command informs Terraform that a particular object has become degraded or damaged. Terraform represents this by marking
the object as "tainted" in the Terraform state, and Terraform will propose to replace it in the next plan you create."

FYI - This command is deprecated. For Terraform v0.15.2 and later, we recommend using the -replace option with terraform apply instead. For
Terraform v0.15.2 and later, we recommend using the -replace option with terraform apply to force Terraform to replace an object even though
there are no configuration changes that would require it.

https://www.terraform.io/cli/commands/taint
upvoted 3 times

  ��1907 4 months, 3 weeks ago


Not A?
The terraform taint command manually marks a Terraform-managed resource as tainted, forcing it to be destroyed and recreated on the next
apply.
upvoted 2 times

  bp339 4 months, 3 weeks ago


Terraform will immediately destroy and recreate the resource.. tf doesn't immediately destroy it.. it will just mark it as tainted and in the next
plan/apply it will recreate..so answer is B
upvoted 8 times
Question #66 Topic 1

All standard backend types support state storage, locking, and remote operations like plan, apply and destroy.

A. True

B. False

Correct Answer: A
Reference:
https://www.terraform.io/docs/language/settings/backends/remote.html

Community vote distribution


B (100%)

  kopper2019 2 months, 2 weeks ago


Selected Answer: B
not all of them so False
upvoted 2 times

  Ggggg23 3 months, 1 week ago


https://www.terraform.io/language/settings/backends/configuration
"Some of these backends act like plain remote disks for state files, while others support locking the state while operations are being performed.
This helps prevent conflicts and inconsistencies. The built-in backends listed are the only backends. You cannot load additional backends as
plugins."
upvoted 1 times

  Ahmad_Terraform 3 months, 1 week ago


Not all backend encrypt , B false = correct
upvoted 1 times

  Eltooth 3 months, 4 weeks ago


Selected Answer: B
B is correct answer : False.

"By default, Terraform uses a backend called local, which stores state as a local file on disk. You can also configure one of the built-in backends
listed in the documentation sidebar.

Some of these backends act like plain remote disks for state files, while others support locking the state while operations are being performed. This
helps prevent conflicts and inconsistencies. The built-in backends listed are the only backends. You cannot load additional backends as plugins."

https://www.terraform.io/language/settings/backends/configuration#available-backends
upvoted 3 times

  HDDH 4 months ago


Selected Answer: B
What Backends Do

Backends primarily determine where Terraform stores its state. Terraform uses this persisted state data to keep track of the resources it manages.
Since it needs the state in order to know which real-world infrastructure objects correspond to the resources in a configuration, everyone working
with a given collection of infrastructure resources must be able to access the same state data.

By default, Terraform implicitly uses a backend called local to store state as a local file on disk. Every other backend stores state in a remote service
of some kind, which allows multiple people to access it. Accessing state in a remote service generally requires some kind of access credentials,
since state data contains extremely sensitive information.

Some backends act like plain "remote disks" for state files; others support locking the state while operations are being performed, which helps
prevent conflicts and inconsistencies.
upvoted 1 times

  stalk98 4 months, 2 weeks ago


answer is B
upvoted 2 times

  bigboi23 5 months, 1 week ago


Selected Answer: B
Some backends act like plain "remote disks" for state files; others support locking the state while operations are being performed, which helps
prevent conflicts and inconsistencies.
upvoted 2 times

  bigboi23 5 months, 1 week ago


B False
Some backends act like plain "remote disks" for state files; others support locking the state while operations are being performed, which helps
prevent conflicts and inconsistencies.
upvoted 2 times
  Sunrayk 5 months, 2 weeks ago
Answer should be B False
https://www.terraform.io/language/settings/backends
upvoted 2 times

Question #67 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 con�guration �les

C. Formats your Terraform con�guration �les

D. Reconciles Terraform's state against deployed resources and permanently modi�es state using the current status of deployed resources

Correct Answer: A
Reference:
https://github.com/hashicorp/terraform/issues/19235

Community vote distribution


A (100%)

  eduvar4 3 weeks, 6 days ago


Selected Answer: A
https://developer.hashicorp.com/terraform/cli/commands/plan
upvoted 1 times

  tf_user 1 month, 1 week ago


Selected Answer: A
A for sure
upvoted 1 times

  Ahmad_Terraform 3 months, 1 week ago


Validates your expectations
upvoted 1 times

  Eltooth 3 months, 4 weeks ago


Selected Answer: A
A is correct answer : Validates your expectations against the execution plan without permanently modifying state

"The terraform plan command creates an execution plan, which lets you preview the changes that Terraform plans to make to your infrastructure.
By default, when Terraform creates a plan it:
Reads the current state of any already-existing remote objects to make sure that the Terraform state is up-to-date.
Compares the current configuration to the prior state and noting any differences.
Proposes a set of change actions that should, if applied, make the remote objects match the configuration."

"The plan command alone will not actually carry out the proposed changes, and so you can use this command to check whether the proposed
changes match what you expected before you apply the changes or share your changes with your team for broader review.

If Terraform detects that no changes are needed to resource instances or to root module output values, terraform plan will report that no actions
need to be taken."

https://www.terraform.io/cli/commands/plan
upvoted 3 times

  CHRIS12722222 4 months, 1 week ago


A looks good
upvoted 1 times

  Zam88 4 months, 1 week ago


A correct.
upvoted 1 times
Question #68 Topic 1

You would like to reuse the same Terraform con�guration for your development and production environments with a different state �le for each.
Which command would you use?

A. terraform import

B. terraform workspace

C. terraform state

D. terraform init

Correct Answer: B

Community vote distribution


B (100%)

  amrith501 Highly Voted  4 months, 2 weeks ago


Selected Answer: B
Workspace is the right answer
upvoted 5 times

  eduvar4 Most Recent  3 weeks, 6 days ago


Selected Answer: B
https://developer.hashicorp.com/terraform/language/state/workspaces#when-to-use-multiple-workspaces
upvoted 1 times

  Ahmad_Terraform 3 months, 1 week ago


workspace = different state file
upvoted 1 times

  Eltooth 3 months, 4 weeks ago


Selected Answer: B
B is correct answer : Workspaces.

https://www.terraform.io/language/state/workspaces#when-to-use-multiple-workspaces
upvoted 2 times
Question #69 Topic 1

What is the name assigned by Terraform to reference this resource?

A. compute_instance

B. main

C. google

D. teat

Correct Answer: B

Community vote distribution


B (100%)

  Ahmad_Terraform 3 months, 3 weeks ago


Main
is the name of the resources
upvoted 2 times

  Eltooth 3 months, 4 weeks ago


Selected Answer: B
B is correct answer : main

See Topic 1 #Question49 for similar question.


upvoted 3 times
Question #70 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 �ag

B. Copy the sensitive variables into your Terraform code

C. Store the sensitive variables in a secure_vars.tf �le

D. Store the sensitive variables as plain text in a source code repository

Correct Answer: B

Community vote distribution


A (100%)

  rfd Highly Voted  4 months, 2 weeks ago


Selected Answer: A
Definitely A.
upvoted 5 times

  eduvar4 Most Recent  3 weeks, 6 days ago


Selected Answer: A
https://developer.hashicorp.com/terraform/language/values/variables
upvoted 1 times

  tf_user 1 month, 1 week ago


Selected Answer: A
A is correct
upvoted 1 times

  Tomcrui1234589 2 months, 2 weeks ago


A for sure
upvoted 1 times

  Ahmad_Terraform 3 months, 1 week ago


A= correct
Var
upvoted 1 times

  Eltooth 3 months, 4 weeks ago


Selected Answer: A
A is correct answer : -var
See Topic 1 # Question 43

https://blog.gruntwork.io/a-comprehensive-guide-to-managing-secrets-in-your-terraform-code-1d586955ace1
upvoted 2 times

  bp339 4 months, 3 weeks ago


Selected Answer: A
A is the answer
upvoted 2 times

  biscuithammer 5 months ago


Selected Answer: A
I vote A
upvoted 1 times

  bigboi23 5 months, 1 week ago


Selected Answer: A
I too would go with A
upvoted 1 times

  Oyster 5 months, 1 week ago


A sounds right
upvoted 1 times

  Sunrayk 5 months, 2 weeks ago


Should be A; definitely not the option provided
upvoted 1 times
  Echo89 5 months, 2 weeks ago
I would choose A as well
upvoted 1 times

  Jedi 5 months, 2 weeks ago


Shouldn't this be A? Making variables part of the code just doesn't sound right.
upvoted 1 times

Question #71 Topic 1

Your security team scanned some Terraform workspaces and found secrets stored in a plaintext in state �les.
How can you protect sensitive data stored in Terraform state �les?

A. Delete the state �le every time you run Terraform

B. Store the state in an encrypted backend

C. Edit your state �le to scrub out the sensitive data

D. Always store your secrets in a secrets.tfvars �le.

Correct Answer: B
Reference:
https://www.terraform.io/docs/language/state/sensitive-data.html

Community vote distribution


B (100%)

  eduvar4 3 weeks, 6 days ago


Selected Answer: B
https://developer.hashicorp.com/terraform/language/state/sensitive-data
upvoted 1 times

  Ahmad_Terraform 3 months, 1 week ago


B
store in encrypted backend , E.g S3
upvoted 3 times

  Eltooth 3 months, 4 weeks ago


Selected Answer: B
B is correct answer : Store in encrypted backend.
upvoted 2 times
Question #72 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

Correct Answer: A

Community vote distribution


A (100%)

  kopper2019 2 months, 2 weeks ago


Selected Answer: A
A, True
upvoted 2 times

  Ahmad_Terraform 3 months, 1 week ago


A
is correct.
upvoted 1 times

  Eltooth 3 months, 2 weeks ago


Selected Answer: A
Very poorly worded question however I believe they are refering to the difference between OSS (directories) and Cloud/Ent that uses workspaces,
which includes separate working directories.

https://www.terraform.io/cloud-docs/workspaces
upvoted 2 times

  Eltooth 3 months, 2 weeks ago


"When run locally, Terraform manages each collection of infrastructure with a persistent working directory, which contains a configuration, state
data, and variables. Since Terraform CLI uses content from the directory it runs in, you can organize infrastructure resources into meaningful
groups by keeping their configurations in separate directories.

Terraform Cloud manages infrastructure collections with workspaces instead of directories. A workspace contains everything Terraform needs to
manage a given collection of infrastructure, and separate workspaces function like completely separate working directories."
upvoted 2 times

  devopschamp 3 months, 3 weeks ago


Selected Answer: A
Answer is A:
From the doc: "Terraform Cloud manages infrastructure collections with workspaces instead of directories. A workspace contains everything
Terraform needs to manage a given collection of infrastructure, and separate workspaces function like completely separate working directories."
https://www.terraform.io/cloud-docs/workspaces
upvoted 2 times

  yufei 4 months ago


Answer A is correct.
upvoted 1 times

  CHRIS12722222 4 months, 1 week ago


I think the answer should be FALSE. Terraform enterprise is essentially same as terraform cloud with additional features like logging etc.
upvoted 1 times

  Oskar_Madin 3 months, 3 weeks ago


you compared Terraform enterprise and terraform cloud but how about Terraform Open Source?
upvoted 1 times

  CHRIS12722222 2 months, 4 weeks ago


I misunderstood the question, Answer is True
upvoted 1 times
Question #73 Topic 1

You want to know from which paths Terraform is loading providers referenced in your Terraform con�guration (*.tf �les). You need to enable
debug messages to �nd 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 con�guration

C. Set the environment variable TF_VAR_log=TRACE

D. Set the environment variable TF_LOG_PATH

Correct Answer: A
Reference:
https://www.terraform.io/docs/cli/con�g/environment-variables.html

Community vote distribution


A (100%)

  Eltooth Highly Voted  3 months, 4 weeks ago


Selected Answer: A
A is correct answer. TF_LOG=TRACE

Although this will only output to stderr and if you need to review log file you will need to include TF_LOG_PATH=pathtofile

https://www.terraform.io/internals/debugging
upvoted 5 times

  Ahmad_Terraform Most Recent  3 months, 1 week ago


Set the environment variable TF_LOG=TRACE
upvoted 3 times

  yufei 4 months ago


A. TRACE is the most verbose option available and should show what the user is looking for.
TRACE will show TRACE, DEBUG, INFO, WARN and ERROR messages in the output.
upvoted 3 times
Question #74 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

Correct Answer: D

Community vote distribution


D (100%)

  0ptimus 1 month, 3 weeks ago


Selected Answer: D
D is correct. I have tested it.
upvoted 1 times

  Ahmad_Terraform 3 months, 1 week ago


By an explicit call
upvoted 2 times

  Eltooth 3 months, 4 weeks ago


Selected Answer: D
I'm going with D based on this doc.

"The current implementation of Terraform import can only import resources into the state. It does not generate configuration. A future version of
Terraform will also generate configuration.

Because of this, prior to running terraform import it is necessary to write manually a resource configuration block for the resource, to which the
imported object will be mapped.

While this may seem tedious, it still gives Terraform users an avenue for importing existing resources."

https://www.terraform.io/cli/import/usage
upvoted 4 times

  Eltooth 3 months, 2 weeks ago


https://www.terraform.io/cli/commands/import
Usage: terraform import [options] ADDRESS ID

Import will find the existing resource from ID and import it into your Terraform state at the given ADDRESS.

ADDRESS must be a valid resource address. Because any resource address is valid, the import command can import resources into modules as
well as directly into the root of your state.

ID is dependent on the resource type being imported. If the ID is invalid, you'll just receive an error message.

Warning: Terraform expects that each remote object it is managing will be bound to only one resource address, which is normally guaranteed by
Terraform itself having created all objects. If you import existing objects into Terraform, be careful to import each remote object to only one
Terraform resource address. If you import the same object multiple times, Terraform may exhibit unwanted behavior.
upvoted 1 times
Question #75 Topic 1

You have a simple Terraform con�guration 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 �le

B. Terraform will report an error

C. Terraform will not make any changes

D. Terraform will recreate the VM

Correct Answer: D

Community vote distribution


D (95%) 5%

  vitasac Highly Voted  5 months, 3 weeks ago


Selected Answer: D
for sure response D
upvoted 13 times

  Ipergorta Highly Voted  5 months, 3 weeks ago


The answer is D
upvoted 6 times

  ccieman2016 Most Recent  2 weeks, 1 day ago


Selected Answer: C
If you change any thing, like tags, tf apply recreate resource, if you don’t change and try apply again, nothing happen. So answer is here: “run
terraform apply again without changing any Terraform code”.

Letter C, I tested too.


upvoted 1 times

  yogishrb2020 2 weeks, 3 days ago


when VM deleted from console. there is disconnect from Terraform to Actual infrastructure. how will it recreate ?
upvoted 1 times

  Pinky0289 1 month, 1 week ago


I created a VM using terraform config file, and deleted it on the aws console. After issuing terraform apply again, below is the output.
<<Apply complete! Resources: 0 added, 0 changed, 0 destroyed.>>
Answer is option C.

So, the answer is C.


upvoted 5 times

  alexik96 2 weeks, 6 days ago


me too. I tested that
upvoted 2 times

  Oskar_Madin 3 months, 3 weeks ago


Another question, it doesn’t say that you enter yes in prompt or run apply with -auto-approve so it will prompt enter a value then you'll see Plan: 1
to add, 0 changed. however, here is the same You run terraform apply and the VM is created successfully.
upvoted 1 times

  Ahmad_Terraform 3 months, 3 weeks ago


D is correct , it will recreate the resource, i deleted S3 bucket from the console and then tried terraform apply , and it simply recreated the S3
bucket in AWS.
upvoted 1 times

  yogishrb2020 2 weeks, 3 days ago


S3 creation created globally. not region specific like VM.
upvoted 1 times

  Eltooth 3 months, 4 weeks ago


Selected Answer: D
D is the correct answer.
upvoted 2 times

  stalk98 4 months, 2 weeks ago


i tested is C
upvoted 2 times

  CHRIS12722222 4 months, 1 week ago


pls it should be option D
upvoted 1 times

  mifune 4 months ago


That's impossible unless you alter the terraform.tfstate too
upvoted 1 times
  bigboi23 5 months, 1 week ago
Selected Answer: D
Offcourse it will be: D
Are these answers selected randomly or what?
upvoted 4 times

  MofD 2 months, 3 weeks ago


might be examtopics way to get people to buy the contributor access and to participate in discussions
upvoted 1 times

  Sunrayk 5 months, 2 weeks ago


Correct answer is D
upvoted 3 times
Question #76 Topic 1

Which of these options is the most secure place to store secrets foe connecting to a Terraform remote backend?

A. De�ned in Environment variables

B. Inside the backend block within the Terraform con�guration

C. De�ned in a connection con�guration outside of Terraform

D. None of above

Correct Answer: A

Community vote distribution


A (67%) C (33%)

  zyxphreez Highly Voted  2 months ago


Selected Answer: A
Definitely is: A
https://www.terraform.io/language/settings/backends/configuration#credentials-and-sensitive-data
Warning: We recommend using environment variables to supply credentials and other sensitive data. If you use -backend-config or hardcode these
values directly in your configuration, Terraform will include these values in both the .terraform subdirectory and in plan files. This can leak sensitive
credentials.
upvoted 10 times

  CHRIS12722222 Highly Voted  2 months, 3 weeks ago


Selected Answer: C
I will go for option C. Whenever possible, it is best to authenticate outside of terraform to keep secrets out of state file
upvoted 5 times

  yogishrb2020 Most Recent  2 weeks, 3 days ago


Connection configuration only for login details.
upvoted 1 times

  RVivek 1 month ago


Selected Answer: A
A -- This is possible under workspace configuration on Terraform Cloud or enterprise
B-- Including the crdential on the code is not secured
C - Configuring it outside terraform on Terraform Cloud or enterprise. Not sure how to do that
D. -- The question says Which of these options and A is the option
upvoted 1 times

  Chokies 1 month, 2 weeks ago


Selected Answer: A
Connection block is for provisioners.
upvoted 1 times

  kcw6 2 months, 3 weeks ago


Selected Answer: C
I think it is C because it is for "Terraform remote backend" and I am sure of how to apply the environment variables to it.
upvoted 2 times

  Aws2222 3 months ago


D.
https://www.terraform.io/language/state/sensitive-data
upvoted 1 times

  Eltooth 3 months, 4 weeks ago


Selected Answer: A
D would be most secure by using 3rd party keyvault tools and .var calls from within code.
However A is best option to pass an secret/password using the -var switch.
upvoted 2 times

  Zam88 4 months, 1 week ago


A is correct
upvoted 3 times
Question #77 Topic 1

Your DevOps team is currently using the local backend for your Terraform con�guration. You would like to move to a remote backend to begin
storing the state �le in a central location.
Which of the following backends would not work?

A. Amazon S3

B. Artifactory

C. Git

D. Terraform Cloud

Correct Answer: A
Reference:
https://secrethub.io/blog/secret-management-for-terraform/

Community vote distribution


C (100%)

  nez15 Highly Voted  5 months, 4 weeks ago


Selected Answer: C
https://www.terraform.io/cdktf/concepts/remote-backends
upvoted 5 times

  eduvar4 Most Recent  3 weeks, 6 days ago


Selected Answer: C
https://developer.hashicorp.com/terraform/cdktf/concepts/remote-backends
upvoted 1 times

  Turak64 1 month, 4 weeks ago


You can store a remote backend in Gitlab - https://docs.gitlab.com/ee/user/infrastructure/iac/terraform_state.html
upvoted 1 times

  RVivek 1 month ago


Gitlab utilizes the generic http backend feature to provide state remote backend service
upvoted 2 times

  Eltooth 3 months, 4 weeks ago


Selected Answer: C
C is correct answer : Git

https://www.terraform.io/cdktf/concepts/remote-backends
upvoted 4 times

  rfd 4 months, 2 weeks ago


Selected Answer: C
C for sure, all other options are suitable for use as a TF backend
upvoted 3 times

  bp339 4 months, 3 weeks ago


Selected Answer: C
C is the Answer
upvoted 3 times

  vitasac 5 months, 3 weeks ago


For sure C
upvoted 3 times

  nez15 5 months, 4 weeks ago


Answer is C. Git

https://www.terraform.io/cdktf/concepts/remote-backends
upvoted 4 times
Question #78 Topic 1

Which backend does the Terraform CLI use by default?

A. Terraform Cloud

B. Consul

C. Remote

D. Local

Correct Answer: D
Reference:
https://www.terraform.io/docs/language/settings/backends/con�guration.html

Community vote distribution


D (100%)

  Ahmad_Terraform 3 months, 1 week ago


D. Local
upvoted 3 times

  Eltooth 3 months, 4 weeks ago


Selected Answer: D
D is correct answer : local

"By default, Terraform implicitly uses a backend called local to store state as a local file on disk. Every other backend stores state in a remote service
of some kind, which allows multiple people to access it. Accessing state in a remote service generally requires some kind of access credentials,
since state data contains extremely sensitive information."

https://www.terraform.io/language/settings/backends
upvoted 3 times

  Zam88 4 months, 1 week ago


By default, Terraform uses a backend called local, which stores state as a local file on disk. You can also configure one of the built-in backends listed
in the documentation sidebar.

D correct
upvoted 3 times
Question #79 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

Correct Answer: C
Reference:
https://www.terraform.io/docs/language/modules/sources.html

Community vote distribution


C (100%)

  amrith501 Highly Voted  4 months, 2 weeks ago


Selected Answer: C
on disk for sure for sure
upvoted 5 times

  Eltooth 3 months, 2 weeks ago


On disk in the .terraform sub-directory - just to clarify.
upvoted 1 times

  eduvar4 Most Recent  3 weeks, 6 days ago


Selected Answer: C
https://developer.hashicorp.com/terraform/language/modules/sources
upvoted 1 times

  Ahmad_Terraform 3 months, 1 week ago


C. On disk in the .terraform sub-directory
upvoted 1 times

  Eltooth 3 months, 4 weeks ago


Selected Answer: C
C is correct answer : hidden terraform directory

"A hidden .terraform directory, which Terraform uses to manage cached provider plugins and modules, record which workspace is currently active,
and record the last known backend configuration in case it needs to migrate state on the next run. This directory is automatically managed by
Terraform, and is created during initialization."

https://www.terraform.io/cli/init
upvoted 3 times
Question #80 Topic 1

You write a new Terraform con�guration 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 �rst

B. Terraform needs to install the necessary plugins �rst

C. The Terraform CLI needs you to log into Terraform cloud �rst

D. Terraform requires you to manually run terraform plan �rst

Correct Answer: C

Community vote distribution


B (100%)

  nez15 Highly Voted  5 months, 4 weeks ago


Selected Answer: B
Need to run Terraform Init first to install the plugins
upvoted 14 times

  kopper2019 Most Recent  2 months, 2 weeks ago


it is B
upvoted 1 times

  Ahmad_Terraform 3 months, 1 week ago


init required
Terraform needs to install the necessary plugins first
upvoted 2 times

  Ahmad_Terraform 3 months, 3 weeks ago


B plugins first
upvoted 2 times

  Eltooth 3 months, 4 weeks ago


Selected Answer: B
B is correct answer.

You need to run terraform init before running apply.


upvoted 3 times

  rfd 4 months, 2 weeks ago


Selected Answer: B
terraform init needs to be run first so it can download required modules and setup backend.
upvoted 1 times

  bp339 4 months, 3 weeks ago


Selected Answer: B
B for sure
upvoted 2 times

  Roro_Brother 5 months, 1 week ago


Selected Answer: B
B Off Course
upvoted 2 times

  bigboi23 5 months, 1 week ago


Selected Answer: B
terraform init. B
upvoted 2 times

  softarts 5 months, 1 week ago


it is B for sure
upvoted 1 times

  Sunrayk 5 months, 2 weeks ago


B which is terraform init
upvoted 1 times

  vitasac 5 months, 3 weeks ago


Selected Answer: B
B For sure
upvoted 3 times

Question #81 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

Correct Answer: D
Reference:
https://blog.gruntwork.io/how-to-manage-terraform-state-28f5697e68fa

Community vote distribution


D (100%)

  Ahmad_Terraform 3 months, 1 week ago


D. State locking
upvoted 3 times

  Eltooth 3 months, 4 weeks ago


Selected Answer: D
D is correct answer.

Somewhat ambiguous question however the key phrase is "feature".


You need a remote backend first with a State Locking feature available to avoid this scenario.

https://blog.gruntwork.io/how-to-manage-terraform-state-28f5697e68fa
upvoted 2 times

  amrith501 4 months, 2 weeks ago


Selected Answer: D
State locking
upvoted 3 times
Question #82 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]

Correct Answer: B
Reference:
https://www.terraform.io/docs/cli/commands/state/rm.html

Community vote distribution


B (100%)

  Eltooth Highly Voted  3 months, 4 weeks ago


Selected Answer: B
B is correct answer : terraform state rm

"You can use terraform state rm in the less common situation where you wish to remove a binding to an existing remote object without first
destroying it, which will effectively make Terraform "forget" the object while it continues to exist in the remote system."

https://www.terraform.io/cli/commands/state/rm
upvoted 5 times

  eduvar4 Most Recent  3 weeks, 6 days ago


Selected Answer: B
https://developer.hashicorp.com/terraform/cli/commands/state/rm
upvoted 1 times

  habbypat123 4 months ago


The answer is B for sure
upvoted 2 times

  Zam88 4 months, 1 week ago


state rm
The terraform state rm command is used to remove items from the Terraform state. This command can remove single resources, single instances of
a resource, entire modules, and more

B
upvoted 3 times
Question #83 Topic 1

Terraform can only manage resource dependencies if you set them explicitly with the depends_on argument.

A. True

B. False

Correct Answer: A
Reference:
https://learn.hashicorp.com/tutorials/terraform/dependencies?in=terraform/0-13

Community vote distribution


B (93%) 7%

  vitasac Highly Voted  5 months, 3 weeks ago


Selected Answer: B
I think it's B for sure
upvoted 10 times

  eduvar4 Most Recent  3 weeks, 6 days ago


Answer: B
"Most of the time, Terraform infers dependencies between resources based on the configuration given, so that resources are created and destroyed
in the correct order"
-> https://learn.hashicorp.com/tutorials/terraform/dependencies
upvoted 1 times

  j1809 1 month ago


Terraform automatically infers when one resource depends on another by studying the resource attributes used in interpolation expressions.
upvoted 1 times

  GopinathM 1 month, 2 weeks ago


A is correct we need pass explicitly depends_on
upvoted 1 times

  kopper2019 2 months, 2 weeks ago


Selected Answer: B
It is B
upvoted 1 times

  Ahmad_Terraform 3 months, 1 week ago


B. False
implicit = hidden dependencies Trfm can can manage.
upvoted 2 times

  Ahmad_Terraform 3 months, 3 weeks ago


B is correct
implicit decencies trfm can manage without depends on command, for example in AWS eip resource will be dependent on the Ec2 creation, so trfm
will first create the Ec2 and then eip will be allocated/created. and eip creation will be after the creation of Ec2.
https://learn.hashicorp.com/tutorials/terraform/dependencies?in=terraform/0-13
upvoted 1 times

  Eltooth 3 months, 4 weeks ago


Selected Answer: A
I believe A is the correct answer.

"Use the depends_on meta-argument to handle hidden resource or module dependencies that Terraform cannot automatically infer. You only need
to explicitly specify a dependency when a resource or module relies on another resource's behavior but does not access any of that resource's data
in its arguments."

https://www.terraform.io/language/meta-arguments/depends_on
upvoted 1 times

  RVivek 1 month ago


You voted A and the comment is in support of B ?
upvoted 1 times

  Zam88 4 months, 1 week ago


Manage explicit dependencies
Implicit dependencies are the primary way that Terraform understands the relationships between your resources. Sometimes there are
dependencies between resources that are not visible to Terraform, however. The depends_on argument is accepted by any resource or module
block and accepts a list of resources to create explicit dependencies for.

B
upvoted 1 times

  Zam88 4 months ago


I was wrong i have checked it again - Terraform cannot infer dependencies between different parts of your infrastructure, and you will need to
create an explicit dependency with the depends_on argument.
A is correct answer
upvoted 1 times

  rfd 4 months, 2 weeks ago


Selected Answer: B
Terraform is smart enough to manage resource dependencies to an extent, without any explicit instructions.
upvoted 3 times

  Sunrayk 5 months, 2 weeks ago


B is the right answer. Mostly Terraform can manage dependencies inherently; depends_on is used for hidden dependencies that Terraform cannot
automatically infer
upvoted 4 times

Question #84 Topic 1

A terraform apply can not _________ infrastructure.

A. change

B. destroy

C. provision

D. import

Correct Answer: D

Community vote distribution


D (100%)

  root_i_am 3 weeks, 4 days ago


Selected Answer: D
The answer is D.

While terraform allows you import existing infrastructure, it is not through the apply command.
upvoted 1 times

  dnscloud02 1 month ago


Not sure --> Terraform can import existing infrastructure resources. This functionality allows you take resources you created by some other means
and bring them under Terraform management.
upvoted 1 times

  antivrillee 2 weeks, 5 days ago


The question is about the command "terraform apply" and not terraform
upvoted 1 times

  antivrillee 1 month, 3 weeks ago


Selected Answer: D
https://www.educative.io/answers/what-is-the-command-to-destroy-infrastructure-in-terraform
upvoted 3 times
Question #85 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 con�guration's provider block?

A. version >= 2.1

B. version ~> 2.1

C. version = ‫ג‬2.1 =>€‫ג‬€

D. version = ‫ג‬2.1 =<€‫ג‬€

Correct Answer: B
Reference:
https://github.com/hashicorp/terraform-provider-null/issues/31

Community vote distribution


D (75%) A (25%)

  19kilo Highly Voted  3 months, 1 week ago


Selected Answer: D
I found cleaner version of the multiple choices.

A- version >= 2.1


B- version ~> 2.1
C- version = "<= 2.1"
D- version = ">= 2.1"

The answer is D ">= 2.1". Requires quotes I believe.


upvoted 14 times

  yaza Most Recent  3 weeks, 2 days ago


A is false you should have version = ....
upvoted 1 times

  eduvar4 3 weeks, 6 days ago


Selected Answer: D
https://developer.hashicorp.com/terraform/language/expressions/version-constraints
upvoted 2 times

  geekneek 2 months, 1 week ago


Selected Answer: D
I vote D.

version = ">= 1.2.0, < 2.0.0"

A version constraint is a string literal containing one or more conditions, which are separated by commas.

Each condition consists of an operator and a version number.

Version numbers should be a series of numbers separated by periods (like 1.2.0), optionally with a suffix to indicate a beta release.

The following operators are valid:

= (or no operator): Allows only one exact version number. Cannot be combined with other conditions.

!=: Excludes an exact version number.

>, >=, <, <=: Comparisons against a specified version, allowing versions for which the comparison is true. "Greater-than" requests newer versions,
and "less-than" requests older versions.

~>: Allows only the rightmost version component to increment. For example, to allow new patch releases within a specific minor release, use the
full version number: ~> 1.0.4 will allow installation of 1.0.5 and 1.0.10 but not 1.1.0. This is usually called the pessimistic constraint operator.

https://www.terraform.io/language/expressions/version-constraints
upvoted 3 times

  Nani0107 2 months, 2 weeks ago


Selected Answer: D
Answer is D version = ">= 2.1"
upvoted 2 times
  kopper2019 2 months, 2 weeks ago
Dm since it needs quotes
A- version >= 2.1
B- version ~> 2.1
C- version = "<= 2.1"
D- version = ">= 2.1"
upvoted 1 times

  19kilo 3 months, 1 week ago


Answer is D version = ">= 2.1"
View the "Terraform 0.12 and earlier:" example section in the link. https://registry.terraform.io/providers/integrations/github/latest/docs

It fails if the = sign is missing, the same is true if the quotes are missing.
upvoted 3 times

  Eltooth 3 months, 4 weeks ago


Selected Answer: A
A is correct answer.

https://www.terraform.io/language/expressions/version-constraints
upvoted 2 times

  Eltooth 3 months, 2 weeks ago


version ~>2.1 would only allow versions greater than 2.1 but less than 3.0
upvoted 2 times

  stalk98 4 months, 2 weeks ago


A is the answer
upvoted 1 times

  bp339 4 months, 3 weeks ago


Selected Answer: A
A is right
upvoted 1 times

  elvancedonzy 4 months, 3 weeks ago


Selected Answer: A
A is the answer
upvoted 1 times

  habbypat123 5 months, 1 week ago


The answer is A
upvoted 2 times

  Roro_Brother 5 months, 1 week ago


Selected Answer: A
https://www.terraform.io/language/expressions/version-constraints
upvoted 1 times

  bigboi23 5 months, 1 week ago


Selected Answer: A
>, >=, <, <=: Comparisons against a specified version, allowing versions for which the comparison is true. "Greater-than" requests newer versions,
and "less-than" requests older versions.
upvoted 2 times
Question #86 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 con�guration?

A. Run an apply and con�rm the planned changes

B. Inspect your Terraform state because you want to change it

C. Reinitialize because your con�guration has changed

D. Inspect all Terraform outputs to make sure they are correct

Correct Answer: A

Community vote distribution


A (90%) 10%

  vitasac Highly Voted  5 months, 3 weeks ago


Selected Answer: A
I'm aggree it's A
upvoted 12 times

  RVivek Most Recent  4 weeks, 1 day ago


Selected Answer: A
A-- is required to deploy the the changed count
B- Not required
C-- checked in my Lab for the count change it worked with out init
D Not required
upvoted 1 times

  Eltooth 3 months, 4 weeks ago


Selected Answer: A
A is correct answer : apply

You need your deployment to match your config, so only way to implement changes is through terraform apply.
upvoted 1 times

  leonelferrari 4 months ago


A is correct
upvoted 1 times

  stalk98 4 months, 2 weeks ago


A is the answer
upvoted 1 times

  wangchung 5 months ago


D? Its like throughout all these questions for this exam the answers are often not just wrong, but the obvious wrong one.

A
upvoted 1 times

  Sunrayk 5 months, 2 weeks ago


It should be A as the plan will show you what will change and then you can confirm the apply
upvoted 2 times

  Sunrayk 5 months, 2 weeks ago


Actually no, it should be C as the config has changed.
https://www.terraform.io/cli/commands/init
upvoted 1 times

  Parthasarathi 5 months, 2 weeks ago


Selected Answer: C
It should be C as the configuration file is changed
upvoted 2 times

  Maaran07 5 months, 1 week ago


Configuration change don't require init
upvoted 2 times

  nez15 5 months, 4 weeks ago


Selected Answer: A
Not sure why D. Should be A
upvoted 4 times

Question #87 Topic 1

Terraform provisioners that require authentication can use the ______ block.

A. connection

B. credentials

C. secrets

D. ssh

Correct Answer: B

Community vote distribution


A (100%)

  asudhin 3 weeks ago


Selected Answer: A
It is A
upvoted 1 times

  Burakko 1 month, 3 weeks ago


Selected Answer: A
Must be the connection block.
upvoted 1 times

  aadi1121 3 months ago


Selected Answer: A
https://www.terraform.io/language/resources/provisioners/connection
upvoted 3 times

  Eltooth 3 months, 4 weeks ago


Selected Answer: A
A is correct answer : connection.

"Most provisioners require access to the remote resource via SSH or WinRM and expect a nested connection block with details about how to
connect."

"Connection blocks don't take a block label and can be nested within either a resource or a provisioner."

https://www.terraform.io/language/resources/provisioners/connection
upvoted 2 times

  Zam88 4 months, 1 week ago


Most provisioners require access to the remote resource via SSH or WinRM and expect a nested connection block with details about how to
connect.

A
upvoted 2 times
Question #88 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 �les does not match the current infrastructure

D. None of the above

Correct Answer: B
Reference:
http://man.hubwiz.com/docset/Terraform.docset/Contents/Resources/Documents/docs/commands/validate.html

Community vote distribution


B (83%) D (17%)

  Eltooth Highly Voted  3 months, 2 weeks ago


Selected Answer: B
B is correct answer.

The terraform validate command is used to validate the syntax of the terraform files. Terraform performs a syntax check on all the terraform files in
the directory, and will display an error if any of the files doesn't validate.

This command does not check formatting (e.g. tabs vs spaces, newlines, comments etc.).

The following can be reported:


invalid HCL syntax (e.g. missing trailing quote or equal sign)
invalid HCL references (e.g. variable name or attribute which doesn't exist)
same provider declared multiple times
same module declared multiple times
same resource declared multiple times
invalid module name
interpolation used in places where it's unsupported (e.g. variable, depends_on, module.source, provider)
missing value for a variable (none of -var foo=... flag, -var-file=foo.vars flag, TF_VAR_foo environment variable, terraform.tfvars, or default value in
the configuration)

https://www.typeerror.org/docs/terraform/commands/validate
https://learning-ocean.com/tutorials/terraform/terraform-validate
upvoted 5 times

  ali�e Most Recent  1 week, 3 days ago


Selected Answer: D
D is correct.
validate does not check for uninitialized values of vars, only for undeclared vars!
#terraform validate
Success! The configuration is valid.
#terraform plan
var.my_ip
Enter a value:

You can specify a value for a var with -var in cli or terraform prompts you for a value.
upvoted 1 times
  yaza 3 weeks, 2 days ago
B is false. Validate runs checks that verify whether a configuration is syntactically
valid and internally consistent, regardless of any provided variables or
existing state. It is thus primarily useful for general verification of
reusable modules, including correctness of attribute names and value types.
upvoted 2 times

  yaza 2 weeks, 5 days ago


Selected Answer: D
upvoted 1 times

  Zam88 4 months, 1 week ago


The following can be reported:

invalid HCL syntax (e.g. missing trailing quote or equal sign)


invalid HCL references (e.g. variable name or attribute which doesn't exist)
same provider declared multiple times
same module declared multiple times
same resource declared multiple times
invalid module name
interpolation used in places where it's unsupported (e.g. variable, depends_on, module.source, provider)
missing value for a variable (none of -var foo=... flag, -var-file=foo.vars flag, TF_VAR_foo environment variable, terraform.tfvars, or default value in
the configuration)

B
upvoted 4 times
Question #89 Topic 1

Which of the following is allowed as a Terraform variable name?

A. count

B. name

C. source

D. version

Correct Answer: B
Reference:
https://www.terraform.io/docs/language/values/variables.html

Community vote distribution


B (100%)

  kopper2019 2 months, 2 weeks ago


Selected Answer: B
name is OK
upvoted 4 times

  Ahmad_Terraform 3 months, 1 week ago


name is right
upvoted 2 times

  Eltooth 3 months, 4 weeks ago


Selected Answer: B
B is correct answer : name

"The name of a variable can be any valid identifier except the following: source, version, providers, count, for_each, lifecycle, depends_on, locals."

https://www.terraform.io/language/values/variables
upvoted 2 times

  Zam88 4 months, 1 week ago


The name of a variable can be any valid identifier except the following: source , version , providers , count , for_each , lifecycle , depends_on , locals .
These names are reserved for meta-arguments in module configuration blocks, and cannot be declared as variable names.

B
upvoted 4 times
Question #90 Topic 1

What type of block is used to construct a collection of nested con�guration blocks?

A. for_each

B. repeated

C. nesting

D. dynamic

Correct Answer: D
Reference:
https://www.hashicorp.com/blog/hashicorp-terraform-0-12-preview-for-and-for-each

Community vote distribution


D (100%)

  bp339 Highly Voted  4 months, 3 weeks ago


Selected Answer: D
Dynamic is true...
upvoted 5 times

  eduvar4 Most Recent  3 weeks, 6 days ago


Selected Answer: D
https://developer.hashicorp.com/terraform/language/expressions/dynamic-blocks
upvoted 1 times

  Eltooth 3 months, 4 weeks ago


Selected Answer: D
D is correct answer : dynamic

https://www.terraform.io/language/expressions/dynamic-blocks
upvoted 2 times
Question #91 Topic 1

Module variable assignments are inherited from the parent module and do not need to be explicitly set.

A. True

B. False

Correct Answer: B
Reference:
https://github.com/hashicorp/terraform/issues/15818

Community vote distribution


B (100%)

  Eltooth 3 months, 2 weeks ago


Selected Answer: B
B is correct answer : false.
upvoted 4 times

  amrith501 4 months, 2 weeks ago


Selected Answer: B
Modules do not inherit variables from the parent module
upvoted 2 times

  stalk98 4 months, 2 weeks ago


Modules do not inherit variables from the parent module. All modules are self-contained units. So you have to explicitly define variables in the
child module, and then explicit set these variables in the parent module, when you instantiate the child module.
upvoted 2 times
Question #92 Topic 1

If writing Terraform code that adheres to the Terraform style conventions, how would you properly indent each nesting level compared to the one
above it?

A. With four spaces

B. With a tab

C. With three spaces

D. With two spaces

Correct Answer: D
Reference:
https://www.terraform.io/docs/language/syntax/style.html

Community vote distribution


D (100%)

  Eltooth Highly Voted  3 months, 2 weeks ago


Selected Answer: D
D is correct answer: Indent two spaces for each nesting level.

https://www.terraform.io/language/syntax/style#style-conventions
upvoted 6 times
Question #93 Topic 1

Which of the following is not an action performed by terraform init?

A. Create a sample main.tf �le

B. Initialize a con�gured backend

C. Retrieve the source code for all referenced modules

D. Load required provider plugins

Correct Answer: A
Reference:
https://www.terraform.io/docs/cli/init/index.html

Community vote distribution


A (100%)

  Eltooth Highly Voted  3 months, 2 weeks ago


Selected Answer: A
Of options, only A is correct answer : Create a sample main.tf file

B. Initialize a configured backend : https://www.terraform.io/cli/commands/init#backend-initialization


C. Retrieve the source code for all referenced modules : https://www.terraform.io/cli/commands/init#child-module-installation
D. Load required provider plugins : https://www.terraform.io/cli/commands/init#plugin-installation
upvoted 5 times

  keiffo2 Most Recent  1 month, 2 weeks ago


init doen't create an main.tf file.
upvoted 1 times
Question #94 Topic 1

HashiCorp Con�guration Language (HCL) supports user-de�ned functions.

A. True

B. False

Correct Answer: B
Reference:
https://www.packer.io/docs/templates/hcl_templates/functions

Community vote distribution


B (100%)

  aiya 2 months, 2 weeks ago


B - false
The HCL language does not support user-defined functions, and so only the functions built in to the language are available for use.
upvoted 2 times

  kopper2019 2 months, 2 weeks ago


Selected Answer: B
False
https://www.terraform.io/language/functions
The Terraform language does not support user-defined functions, and so only the functions built into the language are available for use
upvoted 3 times
Question #95 Topic 1

How can you trigger a run in a Terraform Cloud workspace that is connected to a Version Control System (VCS) repository?

A. Only Terraform Cloud organization owners can set workspace variables on VCS connected workspaces

B. Commit a change to the VCS working directory and branch that the Terraform Cloud workspace is connected to

C. Only members of a VCS organization can open a pull request against repositories that are connected to Terraform Cloud workspaces

D. Only Terraform Cloud organization owners can approve plans in VCS connected workspaces

Correct Answer: B
Reference:
https://www.terraform.io/docs/cloud/vcs/index.html

Community vote distribution


B (100%)

  Ahmad_Terraform 3 months, 1 week ago


commit mean saving code into the VSC, it will trigger run in the terraform
upvoted 1 times

  Eltooth 3 months, 2 weeks ago


Selected Answer: B
B is correct answer.

"In a workspace linked to a VCS repository, runs start automatically when you merge or commit changes to version control.

A workspace is linked to one branch of a VCS repository and ignores changes to other branches. You can specify which files and directories within
your repository trigger runs. "

https://www.terraform.io/cloud-docs/run/ui#automatically-starting-runs
upvoted 3 times
Question #96 Topic 1

Terraform and Terraform providers must use the same major version number in a single con�guration.

A. True

B. False

Correct Answer: B
Reference:
https://www.terraform.io/docs/language/expressions/version-constraints.html

Community vote distribution


B (100%)

  Eltooth 3 months, 2 weeks ago


Selected Answer: B
I think B is correct answer : false.

https://www.terraform.io/language/expressions/version-constraints#terraform-core-and-provider-versions
upvoted 4 times

  Zam88 4 months, 1 week ago


B is correct
upvoted 2 times
Question #97 Topic 1

Which statement describes a goal of infrastructure as code?

A. An abstraction from vendor speci�c APIs

B. Write once, run anywhere

C. A pipeline process to test and deliver software

D. The programmatic con�guration of resources

Correct Answer: D

Community vote distribution


D (80%) B (20%)

  amrith501 Highly Voted  4 months, 1 week ago


Selected Answer: D
Looks like D
upvoted 8 times

  Eltooth Most Recent  3 months, 3 weeks ago


Selected Answer: D
D is correct answer.
upvoted 4 times

  mifune 4 months ago


I think that is B because one of the main features of Terraform is being a "Cloud agnostic" solution which best matches with: "Write once, run
anywhere".
upvoted 1 times

  mifune 4 months ago


Sorry, I misunderstood the question... it's D, true.
upvoted 3 times

  Zam88 4 months ago


The purpose of infrastructure as code is to enable developers or operations teams to automatically manage, monitor and provision resources,
rather than manually configure discrete hardware devices and operating systems. Infrastructure as code is sometimes referred to as programmable
or software-defined infrastructure.

D
upvoted 2 times

  stalk98 4 months, 2 weeks ago


maybe is B?
upvoted 2 times

  Roro_Brother 5 months, 1 week ago


Selected Answer: B
Sure, it's B
upvoted 3 times

  bigboi23 5 months, 1 week ago


I think it is B.
The purpose of infrastructure as code is to enable developers or operations teams to automatically manage, monitor and provision resources,
rather than manually configure discrete hardware devices and operating systems.
upvoted 2 times

  tbhtp 2 months, 1 week ago


So you're argument is supporting Answer D

B states "run anywhere". Like any cloud provider. That is just not the case. Still, migrating to another cloud provider may be less of an headache
with IAC.
upvoted 1 times
Question #98 Topic 1

When using Terraform to deploy resources into Azure, which scenarios are true regarding state �les? (Choose two.)

A. When a change is made to the resources via the Azure Cloud Console, the changes are recorded in a new state �le

B. When a change is made to the resources via the Azure Cloud Console, Terraform will update the state �le to re�ect them during the next
plan or apply

C. When a change is made to the resources via the Azure Cloud Console, the current state �le will not be updated

D. When a change is made to the resources via the Azure Cloud Console, the changes are recorded in the current state �le

Correct Answer: AC

Community vote distribution


C (50%) B (45%) 5%

  AzureGurl Highly Voted  4 months, 2 weeks ago


IT should be B and C, however the wording is incorrect, Terraform Refresh will only update the state file for new changes via Az Console

Terraform Plan does not change the State file, It will however say the diff in the state.

The Terraform apply will make the changes to the state file to keep it consistent.

So the wording of Option B is bit ambiguous.


upvoted 8 times

  Bobby1977 Most Recent  2 weeks, 6 days ago


B and C
upvoted 1 times

  Nikita74 3 weeks, 2 days ago


Selected Answer: C
Only C
upvoted 2 times

  asudhin 3 weeks, 2 days ago


Selected Answer: C
one of the option is C for sure
upvoted 2 times

  RVivek 1 month ago


Selected Answer: BC
A & D are wrong.
A -- new state file is absudr
D - After manaula resource upadte , outside Terraform, the sate file will be upadted only in next plan/refresh/apply
upvoted 1 times

  sudaraka 1 month ago


Selected Answer: C
Only C is correct. Terraform plan doesn't make any changes in state file.
upvoted 1 times

  PBSH56 1 month, 1 week ago


Option B and C are correct. When I make cahnges in console then nothing is happen in state file and after next plan or apply state file will update
So option B and C correct.
upvoted 2 times

  dinesh198728 1 month, 2 weeks ago


Selected Answer: C
only C
upvoted 1 times

  keiffo2 1 month, 2 weeks ago


When making changes via the GUI - the console - the state file dosn't get updated. The Console is ignorant of the state file. So C is the only
answer. When a change is made to the resources via the Azure Cloud Console, the current state file will not be updated
upvoted 2 times

  kopper2019 2 months ago


if only one answer is accepted C is correct and the only one
upvoted 2 times
  bukake 2 months ago
Selected Answer: C
Well C seems correct, am doubting B but when you look that A is 100% not correct along with D then we are left with BC
upvoted 1 times

  tbhtp 2 months, 1 week ago


Selected Answer: B
B is correct in terms of "Does tf offer any functionality to update state, and if so, how do you achieve it?"
C can be interpreted as "tf will never update state, no matter what"
upvoted 1 times

  donathon 2 months, 1 week ago


Selected Answer: B
BC is the correct answer
upvoted 3 times

  Eltooth 3 months, 2 weeks ago


Selected Answer: C
B and C are correct answers.
Could not select more than one answer.
upvoted 3 times

  tbhtp 2 months, 1 week ago


If you think about C like "tf will NEVER update state" it is easy to pick B instead.
Still both are correct depending what precisely was asked. B still is a little more true than C as if you want tf to update state it can.
upvoted 1 times

  Oskar_Madin 3 months, 3 weeks ago


B is wrong cause terraform plan doesn't reflect the state file at all. a, d are wrong. choose two looks like wrong.
upvoted 1 times

  Eltooth 3 months, 3 weeks ago


Selected Answer: B
B and C are correct answers.
upvoted 1 times

  bigboi23 5 months, 1 week ago


Selected Answer: B
Yes B & C
upvoted 1 times
Question #99 Topic 1

You need to deploy resources into two different cloud regions in the same Terraform con�guration. To do that, you declare multiple provider
con�gurations as follows:

What meta-argument do you need to con�gure in a resource block to deploy the resource to the `us-west-2` AWS region?

A. alias = west

B. provider = west

C. provider = aws.west

D. alias = aws.west

Correct Answer: C
Reference:
https://github.com/hashicorp/terraform/issues/451

Community vote distribution


C (100%)

  Eltooth 3 months, 3 weeks ago


Selected Answer: C
C is correct answer.
upvoted 1 times

  Zam88 4 months, 1 week ago


alias is not meta-argument
c is correct
upvoted 1 times

  bp339 4 months, 3 weeks ago


Selected Answer: C
https://www.terraform.io/language/providers/configuration
upvoted 4 times

  elvancedonzy 4 months, 3 weeks ago


Selected Answer: C
C is Correct
upvoted 2 times

  concepts015 5 months, 1 week ago


I think the right answer is D alias is used in the argument and AWS.WEST is the
right way to write the argument
upvoted 2 times

  CHRIS12722222 4 months, 1 week ago


No, C is correct
upvoted 2 times

  Roro_Brother 5 months, 1 week ago


Selected Answer: C
C is correct
upvoted 3 times

  bigboi23 5 months, 1 week ago


Selected Answer: C
Confirmed. C is correct.
upvoted 2 times

  Orpheus123 5 months, 2 weeks ago


C - is the correct answer
upvoted 4 times
  traceme 5 months, 2 weeks ago
answer is C
upvoted 1 times
Question #100 Topic 1

You have declared an input variable called environment in your parent module. What must you do to pass the value to a child module in the
con�guration?

A. Add node_count = var.node_count

B. Declare the variable in a terraform.tfvars �le

C. Declare a node_count input variable for child module

D. Nothing, child modules inherit variables of parent module

Correct Answer: C

Community vote distribution


C (57%) B (43%)

  tbhtp Highly Voted  2 months, 1 week ago


Selected Answer: C
C is correct as the question is about passing a variable. So if you want the parent to pass its output to its child you need to configure an input
variable for that.
The name of the input variable makes no sense but maybe that is to emphasize on the fact that the name of the input variable is arbitrary.

"That module may call other modules and connect them together by passing output values from one to input values of another."
https://www.terraform.io/language/modules/develop
upvoted 7 times

  yogishrb2020 Most Recent  2 weeks, 3 days ago


Selected Answer: C
Declare the variable in a terraform.tfvars file --> doesnot apply to child module
-->https://www.terraform.io/language/values/variables
upvoted 1 times

  nani1709 2 weeks, 4 days ago


A is the correct answer.
upvoted 1 times

  Linus11 3 weeks, 2 days ago


Searched in google " terraform node_count"
no result.
What is this node_count do?
upvoted 2 times

  donathon 2 months, 1 week ago


Selected Answer: B
The answer is B. TFVARS is like a global variable.
upvoted 2 times

  tbhtp 2 months, 1 week ago


B is not correct. Reading something from the same place is not passing a variable.
Imagine what happens if the parent gets its value passed with -var.
upvoted 2 times

  mjadach 2 months, 2 weeks ago


Selected Answer: B
B it is
upvoted 4 times

  tbhtp 2 months, 1 week ago


B is not correct. Reading something from the same place is not passing a variable.
Imagine what happens if the parent gets its value passed with -var.
upvoted 1 times

  Maurice_cool 3 months ago


I'm thinking B as well, but I am not sure. Because modules do not inherit variables from the parent module and variabels need to be explicitly
defined in the child module. Not sure what node_count would have anything to do with the question.
upvoted 2 times

  Ahmad_Terraform 3 months, 1 week ago


B any one ?
or explain some one why otherwise
upvoted 1 times
Question #101 Topic 1

If a module declares a variable with a default, that variable must also be de�ned within the module.

A. True

B. False

Correct Answer: A

Community vote distribution


B (100%)

  Eltooth Highly Voted  3 months, 3 weeks ago


Selected Answer: B
B is correct answer.
upvoted 5 times

  bukake Most Recent  2 months ago


Where are 102-103-104 Questions?
upvoted 3 times

  kopper2019 2 months ago


no idea, I am taking exam tomorrow
upvoted 2 times

  hello2022 1 month, 1 week ago


How did you do? How relevant were these questions.
upvoted 1 times

  gsx 4 months, 3 weeks ago


Selected Answer: B
when no value is passed, default value will be automatically be taken.
upvoted 4 times

  Maaran07 5 months, 1 week ago


It is not mandatory to define inside module. default can be in module itself.
upvoted 1 times

  traceme 5 months, 2 weeks ago


Why not A . When we define the variable as default , we need to pass tha value for the variables right
upvoted 1 times

  habros 4 months, 3 weeks ago


It already had a variable. Worse case it knows where to get if it’s not manually defined
upvoted 1 times
Question #102 Topic 1

Which option cannot be used to keep secrets out of Terraform con�guration �les?

A. Environment Variables

B. Mark the variable as sensitive

C. A Terraform provider

D. A -var �ag

Correct Answer: D

Community vote distribution


B (60%) D (20%) C (20%)

  RVivek 4 weeks, 1 day ago


Selected Answer: B
Question is "cannot be used" , marking sensitive only prevent the information from being displayed, however the screts are to be store in the
configurtaion
upvoted 3 times

  waldonuts 1 month, 1 week ago


Selected Answer: D
Making a var as sensitive in the file, doesn't remove it from the config, only restricts the output of that variable. I believe for these answer options D
to be the choice.
upvoted 2 times

  waldonuts 1 month, 1 week ago


Lol, I just re-read the question......'cannot'....so the answer is B :)
upvoted 2 times

  omodara 1 month, 2 weeks ago


I believe the answer is B. Marking variables as sensitive is not sufficient to secure them. You must also keep them secure while passing them into
Terraform configuration, and protect them in your state file. https://learn.hashicorp.com/tutorials/terraform/sensitive-variables
upvoted 1 times

  keiffo2 1 month, 2 weeks ago


If you mark as sensitive , the variable will not be displayed on run time i.e. if it's an output. However it will still be in the state file and the config. So
B I think.
upvoted 2 times

  donathon 1 month, 2 weeks ago


Selected Answer: C
You cannot use a provider in this case.
upvoted 2 times

  Burakko 1 month, 3 weeks ago


Selected Answer: B
I think the correct answer is B. Even if you mark it as sensible, it will still be in the configuration file.
upvoted 3 times
Question #103 Topic 1

Which of the following arguments are required when declaring a Terraform output?

A. sensitive

B. description

C. default

D. value

Correct Answer: D

Community vote distribution


D (100%)

  Gaby999 1 month, 2 weeks ago


yes, correct answer is D
upvoted 1 times

  Burakko 1 month, 3 weeks ago


Selected Answer: D
There has to be a value for sure.
upvoted 2 times
Question #104 Topic 1

Your risk management organization requires that new AWS S3 buckets must be private and encrypted at rest. How can Terraform Enterprise
automatically and proactively enforce this security control?

A. With a Sentinel policy, which runs before every apply

B. By adding variables to each TFE workspace to ensure these settings are always enabled

C. With an S3 module with proper settings for buckets

D. Auditing cloud storage buckets with a vulnerability scanning tool

Correct Answer: B

Community vote distribution


A (100%)

  RVivek 4 weeks, 1 day ago


Selected Answer: A
Sentinel policy is the best way to manage multiple workspaces
upvoted 1 times

  bora4motion 1 month, 3 weeks ago


Selected Answer: A
I go with A.
upvoted 2 times

  Burakko 1 month, 3 weeks ago


Selected Answer: A
With a Sentinel policy for sure.
upvoted 2 times

  mav3r1ck 1 month, 3 weeks ago


A.

Reference:
https://docs.hashicorp.com/sentinel/intro/what
https://medium.com/hashicorp-engineering/enforcing-aws-s3-security-best-practice-using-terraform-sentinel-ddcd181ff4b7
upvoted 4 times
Question #105 Topic 1

Most Terraform providers interact with ____________.

A. API

B. VCS Systems

C. Shell scripts

D. None of the above

Correct Answer: A

Community vote distribution


A (100%)

  donathon 1 month, 2 weeks ago


Selected Answer: A
A is the answer
upvoted 1 times

  Hizumi 1 month, 3 weeks ago


Answer is A.
Terraform relies on plugins called "providers" to interact with cloud providers, SaaS providers, and other APIs, as per: https://www.terraform.io
/language/providers
upvoted 1 times
Question #106 Topic 1

terraform validate validates that your infrastructure matches the Terraform state �le.

A. True

B. False

Correct Answer: A

Community vote distribution


B (100%)

  RVivek 4 weeks, 1 day ago


Selected Answer: B
Validate only checks the syntax
http://man.hubwiz.com/docset/Terraform.docset/Contents/Resources/Documents/docs/commands/validate.html
upvoted 2 times

  0ptimus 1 month, 2 weeks ago


Selected Answer: B
B because Terraform validate only checks for syntax error or so
upvoted 2 times

  bora4motion 1 month, 3 weeks ago


Selected Answer: B
It's more of a syntax thing.
upvoted 2 times

  Burakko 1 month, 3 weeks ago


Selected Answer: B
False, terraform validate has nothing to do with the state file.
upvoted 2 times

  Uma10 1 month, 3 weeks ago


Selected Answer: B
The terraform validate command validates the configuration files in a directory, referring only to the configuration and not accessing any remote
services such as remote state, provider APIs, etc.

Validate runs checks that verify whether a configuration is syntactically valid and internally consistent, regardless of any provided variables or
existing state. It is thus primarily useful for general verification of reusable modules, including correctness of attribute names and value types.

Source: https://www.terraform.io/cli/commands/validate
upvoted 2 times
Question #107 Topic 1

What does terraform import allow you to do?

A. Import a new Terraform module

B. Use a state �le to import infrastructure to the cloud

C. Import provisioned infrastructure to your state �le

D. Import an existing state �le to a new Terraform workspace

Correct Answer: C

Community vote distribution


C (100%)

  bora4motion 1 month, 3 weeks ago


Selected Answer: C
I go with C
upvoted 2 times

  Burakko 1 month, 3 weeks ago


Selected Answer: C
%100 true
upvoted 2 times

Question #108 Topic 1

FILL BLANK -
In the below con�guration, how would you reference the module output vpc_id?

Type your answer in the �eld provided. The text �eld is not case sensitive and all variations of the correct answer are accepted.

Correct Answer: output "outvpc_id"

  Hizumi Highly Voted  1 month, 3 weeks ago


module.vpc.vpc_id
Reference: https://cloudcasts.io/course/terraform/community-vpc-module
upvoted 14 times

  shopkitty Highly Voted  1 month, 2 weeks ago


it should be module.vpc.vpc_id
upvoted 5 times

  RVivek Most Recent  4 weeks, 1 day ago


It should be module.vpc.vpc_id
upvoted 1 times

  keiffo2 1 month, 2 weeks ago


module.vpc.id
upvoted 2 times

  Burakko 1 month, 3 weeks ago


it has to be something like: module.vpc.outvpcid
upvoted 3 times
Question #109 Topic 1

How would you reference the Volume IDs associated with the ebs_block_device blocks in this con�guration?

A. aws_instance.example.ebs_block_device.[*].volume_id

B. aws_instance.example.ebs_block_device.volume_id

C. aws_instance.example.ebs_block_device[sda2,sda3].volume_id

D. aws_instance.example.ebs_block_device.*.volume_id

Correct Answer: C

Community vote distribution


A (57%) D (43%)

  ali�e 1 week, 3 days ago


Selected Answer: D
It is D indeed, for A to work you need to remove the . in front of [*]
upvoted 2 times

  yogishrb2020 2 weeks, 3 days ago


Selected Answer: D
Tested out in cloud acadmy lab
upvoted 2 times

  H4des 2 weeks, 5 days ago


Selected Answer: D
A is wrong because there is a dot "." in front of the open square brackets "[",
if A was aws_instance.example.ebs_block_device[*].volume_id, then it is correct
upvoted 1 times

  RVivek 4 weeks, 1 day ago


Selected Answer: D
checked all the values in my lab.
D is the only one which worked
A has a . befoe [ , if that . is removed then it works
upvoted 1 times

  yaza 4 weeks, 1 day ago


D. A is wrong because there is a dot before [*]. to be correct it should be aws_instance.example.ebs_block_device[*].volume_id
upvoted 2 times

  yaza 2 weeks, 5 days ago


Selected Answer: D
upvoted 1 times

  shopkitty 1 month, 2 weeks ago


Selected Answer: A
Should be A, for further information go to https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html
upvoted 4 times

  zyxphreez 1 month, 3 weeks ago


Selected Answer: A
What a problem, i just tested both:
aws_instance.example.ebs_block_device.[*].volume_id
and
aws_instance.example.ebs_block_device.*.volume_id

and both worked for me...

this is the output


ids = tolist([
"vol-0a108f108a3f8b14a",
"vol-06d606c5904d12c70",
])

i think something is missing within the description... i think we need to choose two...
upvoted 4 times

  RVivek 3 weeks, 5 days ago


aws_instance.example.ebs_block_device.[*].volume_id does not work unless you remove the . before [
upvoted 1 times

  RVivek 4 weeks, 1 day ago


checked all the values in my lab.
D is the only one which worked
A has a . befoe [ , if that . is removed then it works
upvoted 2 times
Question #110 Topic 1

What does state locking accomplish?

A. Copies the state �le from memory to disk

B. Encrypts any credentials stored within the state �le

C. Blocks Terraform commands from modifying the state �le

D. Prevents accidental deletion of the state �le

Correct Answer: B

Community vote distribution


C (100%)

  barracouto 1 week, 5 days ago


Selected Answer: C
I really wonder if exam topics needs to display the incorrect answers for legality purposes.
It's C.
upvoted 1 times

  asudhin 3 weeks, 2 days ago


Selected Answer: C
It's C
upvoted 1 times

  legendary7 3 weeks, 4 days ago


C-is the correct answer
https://www.terraform.io/language/state/locking
upvoted 1 times

  RVivek 4 weeks, 1 day ago


Selected Answer: C
Blocks Terraform commands from modifying the state file. Since already one command is doing a modification and mutiple simultaneous writes
can make it inconsistant
upvoted 1 times

  bora4motion 1 month, 3 weeks ago


Selected Answer: C
I go with C
upvoted 3 times

  Burakko 1 month, 3 weeks ago


Selected Answer: C
It just locks the state file not to be modified.
upvoted 4 times

  Uma10 1 month, 3 weeks ago


Selected Answer: C
If supported by your backend, Terraform will lock your state for all operations that could write state. This prevents others from acquiring the lock
and potentially corrupting your state.

Source: https://www.terraform.io/language/state/locking
upvoted 4 times
Question #111 Topic 1

You just upgraded the version of a provider in an existing Terraform project. What do you need to do to install the new provider?

A. Run terraform apply -upgrade

B. Run terraform init -upgrade

C. Run terraform refresh

D. Upgrade your version of Terraform

Correct Answer: B

Community vote distribution


B (100%)

  Hizumi Highly Voted  1 month, 3 weeks ago


Answer is B.
[-upgrade] - Opt to upgrade modules and plugins as part of their respective installation steps. See the sections below for more details.
Reference: https://www.terraform.io/cli/commands/init#upgrade
upvoted 8 times

  Bortoloto Most Recent  2 weeks, 4 days ago


Selected Answer: B
Answer is B.
upvoted 1 times

Question #112 Topic 1

A module can always refer to all variables declared in its parent module.

A. True

B. False

Correct Answer: A

Community vote distribution


B (100%)

  Burakko Highly Voted  1 month, 3 weeks ago


Selected Answer: B
Modules do not inherit variables from the parent module. All modules are self-contained units. So you have to explicitly define variables in the
child module, and then explicit set these variables in the parent module, when you instantiate the child module.
upvoted 8 times

  Burakko 1 month, 3 weeks ago


However you can refer them from the parent module, I guess it is A. The question is asking for referring not inheriting.
upvoted 4 times
Question #113 Topic 1

When you use a remote backend that needs authentication, HashiCorp recommends that you:

A. Use partial con�guration to load the authentication credentials outside of the Terraform code

B. Push your Terraform con�guration to an encrypted git repository

C. Write the authentication credentials in the Terraform con�guration �les

D. Keep the Terraform con�guration �les in a secret store

Correct Answer: B

Community vote distribution


A (100%)

  legendary7 3 weeks, 4 days ago


A is the correct answer
upvoted 1 times

  RVivek 4 weeks, 1 day ago


Selected Answer: A
https://www.terraform.io/language/settings/backends/configuration#credentials-and-sensitive-data
upvoted 2 times

  jjkcoins 1 month, 1 week ago


https://www.terraform.io/language/settings/backends/configuration#credentials-and-sensitive-data
upvoted 2 times

  jjkcoins 1 month, 1 week ago


Warning: We recommend using environment variables to supply credentials and other sensitive data. If you use -backend-config or hardcode these
values directly in your configuration, Terraform will include these values in both the .terraform subdirectory and in plan files. This can leak sensitive
credentials.
upvoted 2 times

  hkacholiya 1 month, 2 weeks ago


Answer is A
upvoted 1 times

  shopkitty 1 month, 2 weeks ago


Selected Answer: A
vote for A
upvoted 1 times

  Hizumi 1 month, 2 weeks ago


Answer is A.
Note: We recommend omitting the token from the configuration, and instead using terraform login or manually configuring credentials in the CLI
config file.
Reference: https://www.terraform.io/language/settings/backends/remote
upvoted 4 times

  Burakko 1 month, 3 weeks ago


Selected Answer: A
It should be A.
upvoted 3 times
Question #114 Topic 1

You have a simple Terraform con�guration containing one virtual machine (VM) in a cloud provider. You run terraform apply and the VM is created
successfully.
What will happen if you terraform apply again immediately afterwards without changing any Terraform code?

A. Terraform will terminate and recreate the VM

B. Terraform will create another duplicate VM

C. Terraform will apply the VM to the state �le

D. Nothing

Correct Answer: C

Community vote distribution


D (100%)

  legendary7 3 weeks, 4 days ago


D is the correct answer. Terraform would refresh and see that the current state and the desired state are the-same and hence would do nothing
upvoted 1 times

  shopkitty 1 month, 2 weeks ago


Selected Answer: D
nothing change hence do nothing
upvoted 1 times

  amanp 1 month, 2 weeks ago


Selected Answer: D
Nothing.
If the desired state in state file is same as current state, no changes will happen
upvoted 3 times

  Burakko 1 month, 3 weeks ago


Selected Answer: D
Nothing without changing the configuration file, the state file or desired state.
upvoted 3 times
Question #115 Topic 1

A junior admin accidentally deleted some of your cloud instances. What does Terraform do when you run terraform apply?

A. Build a completely brand new set of infrastructure

B. Tear down the entire workspace infrastructure and rebuild it

C. Rebuild only the instances that were deleted

D. Stop and generate an error message about the missing instances

Correct Answer: D

Community vote distribution


C (100%)

  legendary7 3 weeks, 4 days ago


C
Terraform would refresh and check that the Current State in the state file is not thesame as the Desired State.
Terraform will check its configuration resource files and if it finds a resource that is present in the state file but not in the Desired state, it will create
it
upvoted 1 times

  shopkitty 1 month, 2 weeks ago


Selected Answer: C
vote for C
upvoted 1 times

  amanp 1 month, 2 weeks ago


Selected Answer: C
Answer is C.
upvoted 2 times

  Burakko 1 month, 3 weeks ago


Selected Answer: C
the correct answer is C.
upvoted 2 times

  duffyduck 1 month, 3 weeks ago


The Answer is C
upvoted 1 times
Question #116 Topic 1

You have created a main.tr Terraform con�guration consisting of an application server, a database, and a load balancer. You ran terraform apply
and all resources were created successfully. Now you realize that you do not actually need the load balancer so you run terraform destroy without
any �ags What will happen?

A. Terraform will destroy the application server because it is listed �rst in the code

B. Terraform will prompt you to con�rm that you want to destroy all the infrastructure

C. Terraform will destroy the main.tf �le

D. Terraform will prompt you to pick which resource you want to destroy

E. Terraform will immediately destroy all the infrastructure

Correct Answer: B

Community vote distribution


B (100%)

  bora4motion 1 month, 3 weeks ago


Selected Answer: B
I go with B
upvoted 3 times

  Burakko 1 month, 3 weeks ago


Selected Answer: B
The answer is B.
upvoted 3 times

Question #117 Topic 1

Which type of block fetches or computes information for use elsewhere in a Terraform con�guration?

A. provider

B. resource

C. local

D. data

Correct Answer: A

Community vote distribution


D (100%)

  Burakko Highly Voted  1 month, 3 weeks ago


Selected Answer: D
Data sources allow data to be fetched or computed for use elsewhere in Terraform configuration. Use of data sources allows a Terraform
configuration to build on information defined outside of Terraform, or defined by another separate Terraform configuration.
upvoted 5 times

  kprod Most Recent  1 month, 2 weeks ago


Selected Answer: D
D - data
upvoted 3 times

  bora4motion 1 month, 3 weeks ago


Selected Answer: D
it's D as you're using infrastructure already created - that's when you use "data". With "resource" you create new infrastructure.
upvoted 4 times
Question #118 Topic 1

You have just developed a new Terraform con�guration for two virtual machines with a cloud provider. You would like to create the infrastructure
for the �rst time.
Which Terraform command should you run �rst?

A. terraform apply

B. terraform plan

C. terraform show

D. terraform init

Correct Answer: C

Community vote distribution


D (100%)

  Burakko Highly Voted  1 month, 3 weeks ago


Selected Answer: D
terraform init if you want to run it for the first time.
upvoted 5 times

  legendary7 Most Recent  3 weeks, 4 days ago


D
You need to initialize so all the provider plugin and configurations dependencies get initialized
upvoted 1 times

  kprod 1 month, 2 weeks ago


Selected Answer: D
D - init
upvoted 3 times

  bora4motion 1 month, 3 weeks ago


Selected Answer: D
I go with D. init
upvoted 4 times
Question #119 Topic 1

All modules published on the o�cial Terraform Module Registry have been veri�ed by HashiCorp.

A. True

B. False

Correct Answer: B

Community vote distribution


B (75%) A (25%)

  Bobby1977 2 weeks, 6 days ago


https://www.terraform.io/registry/modules/verified
A is the right answer
upvoted 1 times

  RVivek 4 weeks, 1 day ago


Terraform public regstry has community modules, which are not verified by Hashicorp
upvoted 1 times

  Pinky0289 1 month, 1 week ago


B. Not all modules published are verified by HashiCorp.
upvoted 2 times

  donathon 1 month, 2 weeks ago


Selected Answer: B
False. Needs to have the verified sign.
upvoted 2 times

  dinesh198728 1 month, 2 weeks ago


Selected Answer: B
false : See this : https://registry.terraform.io/
upvoted 1 times

  kprod 1 month, 2 weeks ago


Selected Answer: A
True ...
upvoted 1 times

  Hizumi 1 month, 2 weeks ago


Answer is False.
Only modules considered "Verified Modules" are reviewed by Hashicorp, otherwise anyone can publish modules on the Terraform Registry.
Reference: https://www.terraform.io/registry/modules/verified
https://www.terraform.io/registry/modules/publish
upvoted 3 times
Question #120 Topic 1

You have to initialize a Terraform backend before it can be con�gured.

A. True

B. False

Correct Answer: B

Community vote distribution


A (63%) B (38%)

  ali�e 1 week, 3 days ago


Selected Answer: A
During init, the root configuration directory is consulted for backend configuration and the chosen backend is initialized using the given
configuration settings.
upvoted 1 times

  yaza 2 weeks, 5 days ago


Selected Answer: B
you cannot initialize something that does not exist, so obviously you have to configure it first
upvoted 2 times

  RVivek 3 weeks, 5 days ago


Selected Answer: A
A - You have to initialize the backend
upvoted 1 times

  Pinky0289 1 month, 1 week ago


Option A. True
Before proceeding to configuration, the backend needs to be initialized.
upvoted 1 times

  dinesh198728 1 month, 2 weeks ago


Selected Answer: A
Initialization
Whenever a configuration's backend changes, you must run terraform init again to validate and configure the backend before you can perform any
plans, applies, or state operations.

When changing backends, Terraform will give you the option to migrate your state to the new backend. This lets you adopt backends without
losing any existing state.

To be extra careful, we always recommend manually backing up your state as well. You can do this by simply copying your terraform.tfstate file to
another location. The initialization process should create a backup as well, but it never hurts to be safe!

https://www.terraform.io/language/settings/backends/configuration
upvoted 1 times

  vichu0308 1 month, 2 weeks ago


Backends are configured directly in Terraform files in the terraform section. After configuring a backend, it has to be initialized. Therefore its B
upvoted 3 times

  dinesh198728 1 month, 2 weeks ago


Selected Answer: A
It should be A. Backend should be initialized for the first time.
upvoted 1 times

  zyxphreez 1 month, 2 weeks ago


Selected Answer: B
you first configure the backed and then initialize ....therefore should be B
upvoted 3 times

  keiffo2 1 month, 2 weeks ago


Whenever a configuration's backend changes, you must run terraform init again to validate and configure the backend before you can perform any
plans, applies, or state operations. TRUE
upvoted 2 times

  amanp 1 month, 2 weeks ago


Selected Answer: A
It is true.
upvoted 1 times
  Hizumi 1 month, 2 weeks ago
Answer is True
Whenever a configuration's backend changes, you must run terraform init again to validate and configure the backend before you can perform any
plans, applies, or state operations.
Reference: https://www.terraform.io/language/settings/backends/configuration
upvoted 1 times
Question #121 Topic 1

Which of the following does terraform apply change after you approve the execution plan? (Choose two.)

A. Cloud infrastructure

B. The .terraform directory

C. The execution plan

D. State �le

E. Terraform code

Correct Answer: C

Community vote distribution


A (80%) D (20%)

  ali�e 1 week, 3 days ago


Selected Answer: D
A and D
upvoted 2 times

  legendary7 3 weeks, 4 days ago


D. State file
After apply, the state file is changed to match the created resources
upvoted 2 times

  faltu1985 4 weeks ago


Selected Answer: A
A and D
upvoted 4 times

  Pinky0289 1 month, 1 week ago


A and D
upvoted 2 times

  dinesh198728 1 month, 2 weeks ago


Selected Answer: A
A and D
upvoted 2 times

  geekneek 1 month, 2 weeks ago


A and D.
upvoted 2 times

  donathon 1 month, 2 weeks ago


Selected Answer: A
It should be AD.
upvoted 2 times

  amanp 1 month, 2 weeks ago


Selected Answer: A
Answer is A and D
upvoted 2 times

  kprod 1 month, 2 weeks ago


Selected Answer: A
AD is the answer
upvoted 2 times

  bora4motion 1 month, 3 weeks ago


Selected Answer: D
I go with a and d but this site is useless and you can't even check two checkboxes, apart of the fact that most of the answers are wrong.
upvoted 2 times

  Burakko 1 month, 3 weeks ago


Selected Answer: A
It has to be AD
upvoted 4 times
Question #122 Topic 1

A Terraform backend determines how Terraform loads state and stores updates when you execute ___________.

A. apply

B. taint

C. destroy

D. All of the above

E. None of the above

Correct Answer: E

Community vote distribution


D (100%)

  Pinky0289 1 month, 1 week ago


D is the answer
upvoted 1 times

  harshit101 1 month, 2 weeks ago


Selected Answer: D
D is correct
upvoted 1 times

  amanp 1 month, 2 weeks ago


Selected Answer: D
D is right
upvoted 4 times

  bora4motion 1 month, 3 weeks ago


Selected Answer: D
D looks OK
upvoted 3 times

  dc_98 1 month, 3 weeks ago


Selected Answer: D
Thats when state is used so the backend should be looked at
upvoted 4 times
Question #123 Topic 1

What does Terraform use .terraform.lock.hcl �le for?

A. Tracking provider dependencies

B. There is no such �le

C. Preventing Terraform runs from occurring

D. Storing references to workspaces which are locked

Correct Answer: D

Community vote distribution


A (93%) 7%

  Tigur Highly Voted  1 month, 3 weeks ago


Selected Answer: A
A is correct
https://www.terraform.io/language/files/dependency-lock
upvoted 6 times

  Anderson01 Most Recent  22 hours, 21 minutes ago


"Terraform has made some changes to the "provider dependency" selections recorded
in the .terraform.lock.hcl file. Review those changes and commit them to your
version control system if they represent changes you intended to make."

-> I will go with A


upvoted 1 times

  Atta33 2 weeks, 4 days ago


Selected Answer: A
A is correct
upvoted 1 times

  shopkitty 1 month, 2 weeks ago


Selected Answer: D
I voted for D, this file for the purpose that now allow other user to perform init again the from different machine (workspace) if you work as a team.
upvoted 1 times

  bora4motion 1 month, 3 weeks ago


Selected Answer: A
so if you google the first thing that shows up is A
upvoted 4 times

  Burakko 1 month, 3 weeks ago


Selected Answer: A
I guess it is A.
"hcl , and this name is intended to signify that it is a lock file for various items that Terraform caches in the . terraform subdirectory of your working
directory. Terraform automatically creates or updates the dependency lock file each time you run the terraform init command."
upvoted 2 times
Question #124 Topic 1

You've used Terraform to deploy a virtual machine and a database. You want to replace this virtual machine instance with an identical one without
affecting the database. What is the best way to achieve this using Terraform?

A. Use the terraform state rm command to remove the VM from state �le

B. Use the terraform taint command targeting the VMs then run terraform plan and terraform apply

C. Use the terraform apply command targeting the VM resources only

D. Delete the Terraform VM resources from your Terraform code then run terraform plan and terraform apply

Correct Answer: B

Community vote distribution


B (100%)

  depal_dhir 1 month, 2 weeks ago


Selected Answer: B
https://www.terraform.io/cli/state/taint
upvoted 2 times

  keiffo2 1 month, 2 weeks ago


terraform apply -target - just looks at applying part of the config.
In this case we'd need to taint the resource and then run an apply. Just to note taint is now deprecated - seems like it comes up in the exam mind,
instead of using taint you should use terrform apply -replace=aws_instance.my_server
upvoted 2 times

  keiffo2 1 month, 2 weeks ago


So answer B
upvoted 2 times
Question #125 Topic 1

How do you specify a module's version when publishing it to the public Terraform Module Registry?

A. The module's con�guration page on the Terraform Module Registry

B. Terraform Module Registry does not support versioning modules

C. The release tags in the associated repo

D. The module's Terraform code

Correct Answer: C

Community vote distribution


C (100%)

  Pinky0289 1 month, 1 week ago


A module's version is specified using the release tag names. So, the right answer is C.
upvoted 2 times

  keiffo2 1 month, 2 weeks ago


x.y.z tags for releases. The registry uses tags to identify module versions. Release tag names must be a semantic version, which can optionally be
prefixed with a v. For example, v1.0.4 and 0.9.2. To publish a module initially, at least one release tag must be present. Tags that don't look like
version numbers are ignored.

ANSWER C
upvoted 2 times

  dinesh198728 1 month, 2 weeks ago


Selected Answer: C
https://www.terraform.io/registry/modules/publish
upvoted 2 times

  bora4motion 1 month, 3 weeks ago


Selected Answer: C
C makes sense to me
upvoted 2 times

  Burakko 1 month, 3 weeks ago


Selected Answer: C
The registry uses tags to identify module versions. Release tag names must be a semantic version, which can optionally be prefixed with a v . For
example, v1. 0.4 and 0.9.
upvoted 4 times
Question #126 Topic 1

Terraform plan updates your state �le.

A. True

B. False

Correct Answer: A

Community vote distribution


B (92%) 8%

  Bobby1977 2 weeks, 6 days ago


The terraform plan command creates an execution plan, which lets you preview the changes that Terraform plans to make to your infrastructure. By
default, when Terraform creates a plan it:

Reads the current state of any already-existing remote objects to make sure that the Terraform state is up-to-date.
Compares the current configuration to the prior state and noting any differences.
Proposes a set of change actions that should, if applied, make the remote objects match the configuration.
Answer is A
upvoted 1 times

  RVivek 4 weeks, 1 day ago


Selected Answer: A
Terraform plan always forst check the state of existing resources refreshes/updates that to state.
If there is configuration drift from last apply, then terraform will first refresh the state to respreset the current state of the resources, for example if
any resouce is deleted or changed that will be upadted in the state and then the chnages to be doe will be displayed
upvoted 1 times

  Pinky0289 1 month, 1 week ago


Terraform plan command lays out the execution plan, it is only the terraform apply command that makes changes to the state file since it is when
the resources are created/updated/destroyed. So, the answer is B. False
upvoted 2 times

  bora4motion 1 month, 3 weeks ago


Selected Answer: B
b 100%
upvoted 4 times

  Burakko 1 month, 3 weeks ago


Selected Answer: B
No, it does not do any changes to the state file.
upvoted 4 times

  Uma10 1 month, 3 weeks ago


Selected Answer: B
The terraform plan command creates an execution plan, which lets you preview the changes that Terraform plans to make to your infrastructure.

The plan command alone will not actually carry out the proposed changes, and so you can use this command to check whether the proposed
changes match what you expected before you apply the changes or share your changes with your team for broader review.

Source: https://www.terraform.io/cli/commands/plan
upvoted 3 times

You might also like