Terraform Associate Exam QuestionsBrowse all questions from this exam

Terraform Associate Exam - Question 1


The terraform.tfstate file always matches your currently built infrastructure.

Show Answer
Correct Answer: B

The terraform.tfstate file does not always match your currently built infrastructure. This is because changes can be made to the infrastructure outside of Terraform, leading to a drift between the actual state and the state recorded in terraform.tfstate. Additionally, the state file represents the last known state from when Terraform was last run. If any changes are made outside of Terraform, they won't be reflected until a refresh or a new plan is run to update the state file.

Discussion

38 comments
Sign in to comment
fabiomlop
Jun 18, 2022

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.

gargaditya
Mar 14, 2023

Incorrect,your next terraform plan or terraform refresh will inform you that there is change(provided the deployment was initially done via terraform). tfstate reflects values from actual infrastructure deployed, and it picks drift from actual tf files.

Nunyabiznes
Apr 3, 2023

Incorrect, question does not mention about "your so called " terraform plan or refresh commands

Nunyabiznes
Apr 3, 2023

Incorrect, question does not mention about "your so called " terraform plan or refresh commands

amrith501
Jun 14, 2022

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

Zam88
Jun 19, 2022

B is correct

Zam88Option: B
Jun 19, 2022

B is correct

EltoothOption: B
Jun 30, 2022

B is correct answer : false.

happychi
Dec 22, 2022

B IS CORRECT

jvuosoOption: B
Apr 19, 2023

Not necessarily

0kwameOption: B
Apr 5, 2025

No it doesn't. This is because; terraform doesn't necessarily reconcile infrastructure automatically. It is only after you run a terraform command like terraform plan does it reconcile your actual state with your desired state.

bicycle
Jun 12, 2022

should be A

bicycleOption: A
Jun 12, 2022

should be A

Eltooth
Jun 30, 2022

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.

gargaditya
Mar 14, 2023

This is the one of 2 edge cases that makes me want to choose False. Surprised other comments saying terraform will not pick up drift-tfstate does reflect the drift post a terraform plan/terraform refresh. Other being config itself being done outside terraform-those items will not be tracked.

gargaditya
Mar 14, 2023

This is the one of 2 edge cases that makes me want to choose False. Surprised other comments saying terraform will not pick up drift-tfstate does reflect the drift post a terraform plan/terraform refresh. Other being config itself being done outside terraform-those items will not be tracked.

darovero
Jun 17, 2022

Should be A

Cedhulk
Jun 17, 2022

in what case ?

Cedhulk
Jun 17, 2022

ah "always" mb

LaureatulOption: B
Aug 8, 2022

B is the correct answer.

alemtzc
Aug 12, 2022

Definitely B

babuappnet
Sep 19, 2022

B is the right.

stalosOption: B
Nov 25, 2022

Not always

Amanraj041995
Dec 4, 2022

B is correct

kennynelconOption: B
Dec 21, 2022

No because you can configure outside the tfstate file

happychi
Dec 22, 2022

B TEST

Prasad28
Feb 8, 2023

Answer - False, because state file doesn't matches the current infrastructure unwantedly.

gargaditya
Mar 14, 2023

Question is a bit ambiguous-technically tfstate file reflects any deployments done VIA TERRAFORM. Even if manual changes were made to a deployment done by terraform,a terraform refresh would actually update the tfstate file to reflect actual infrastructure.(this lets terraform know that there is a mismatch betweeh tfstate and actual tf file).

connecttozee
Apr 3, 2023

After deployment, we can change change configuration by manual. So terraform.tfstate may be different with current infra. B is correct

Chandru1988
May 10, 2023

B is the correct answer

Busi57Option: B
Jul 23, 2023

B is the correct answer

Jayanth
Jul 28, 2023

B. False

hajurbauOption: B
Sep 10, 2023

Question is a bit ambiguous.it says currently built, does it mean to say right after Terraform apply? Anyways feel like B is the answer

maze_Option: B
Sep 21, 2023

The actual provisioned resources may drift, the state represents a snapshot of their status from *the last time* Terraform was run.

luxdolorosaOption: B
Nov 15, 2023

Of course, it's B. For example, when you perform tasks in the AWS web console, you cannot see the .tfstate file. Additionally, if we add that, you can update it to the latest state through 'tf refresh.

sccamposOption: B
Jan 26, 2024

B is the correct

Hanu1Option: A
Feb 13, 2024

The terraform.tfstate file maintains the state of your infrastructure as managed by Terraform. It keeps track of the resources that Terraform has provisioned and their current state.

hrajkuma
Jul 12, 2024

Selected Answer: B

Deyemzy
Oct 5, 2024

B. False The terraform.tfstate file reflects the infrastructure as it was last known to Terraform, but changes made outside of Terraform (manually or through other tools) may not be reflected in the state file until a terraform refresh or terraform plan is run to reconcile the differences.

erifOption: B
Oct 7, 2024

The terraform.tfstate file reflects Terraform's understanding of the infrastructure, but it may not always match the actual state of the infrastructure if changes have been made manually (outside of Terraform) or if the state file hasn't been updated after such changes. In those cases, the state file would be outdated or inaccurate.

clouddevnoobOption: B
Oct 22, 2024

The correct answer is false because Terraform performs a refresh operation before any operation to update the state with the real infrastructure. This means the state file might not always perfectly match the current infrastructure if there are discrepancies between the state and the actual resources.

Sergiuss95Option: B
Jan 9, 2025

ITS B. YOUR INFRA COULD BE CHANGE

didistars13Option: B
Jan 15, 2025

Agree with others that it is B

SoubiOption: B
Jan 24, 2025

Answer is B

eLJoudiOption: B
Mar 3, 2025

Answer is B : Terraform has no way to know or track changes made outside of it.