Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

Exam Terraform Associate topic 1 question 98 discussion

Actual exam question from HashiCorp's Terraform Associate
Question #: 98
Topic #: 1
[All Terraform Associate Questions]

When using Terraform to deploy resources into Azure, which scenarios are true regarding state files? (Choose two.)

  • A. When a change is made to the resources via the Azure Cloud Console, the changes are recorded in a new state file
  • B. When a change is made to the resources via the Azure Cloud Console, Terraform will update the state file to reflect them during the next plan or apply
  • C. When a change is made to the resources via the Azure Cloud Console, the current state file 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 file
Show Suggested Answer Hide Answer
Suggested Answer: AC 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
AzureGurl
Highly Voted 1 year, 11 months 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 22 times
alirasouli
1 year, 5 months ago
Option B's wording is too fuzzy.
upvoted 1 times
...
msingh20
9 months, 2 weeks ago
Terraform plan / apply runs a terraform refresh to update the state with infrastructure so B makes sense.
upvoted 2 times
Tyler2023
6 months, 2 weeks ago
I don't think so, terraform will not generate the configuration changes you've maid manually, terraform apply will remove the configuration you've made that is not included in your tf files
upvoted 1 times
...
...
...
Nikita74
Highly Voted 1 year, 7 months ago
Selected Answer: C
Only C
upvoted 11 times
...
vibzr2023
Most Recent 1 month, 2 weeks ago
I believe only option C is correct. I tested this by spinning up an EC2 instance in AWS using Terraform and then manually updating the "Name" tag in the AWS console. Immediately after that, when I ran terraform plan, it indicated that the tag would be changed from the Terraform-assigned value ("TerraformCI") to the manually applied value ("Rajesh"). This demonstrates that Terraform detects changes made outside of its management and plans to update the infrastructure accordingly.
upvoted 1 times
vibzr2023
1 month, 2 weeks ago
terraform plan output # aws_instance.ec2_example will be updated in-place  ~ resource "aws_instance" "ec2_example" {     id                  = "i-037feb3cac6a58f05"    ~ tags                 = {      ~ "Name" = "TerraformCI" -> "Rajesh"     }    ~ tags_all               = {      ~ "Name" = "TerraformCI" -> "Rajesh"     } terraform apply output update tag from TerraformCI to Rajesh
upvoted 1 times
vibzr2023
1 month, 2 weeks ago
While prevailing sentiment leans towards options B and C, as evidenced by the popularity of ChatGPT's response, I posit that only option C is accurate. Definitive proof of option B's validity hinges on the demonstration of program output reflecting a successful state drift reconciliation. Here is the chatgpt answer when i demonstrated only C is correct. Thank you for providing detailed information about your test and findings. Based on your description, it seems there was a misunderstanding regarding how Terraform interacts with external changes. continued.......
upvoted 1 times
vibzr2023
1 month, 2 weeks ago
When you manually changed the "Name" tag in the AWS console and then ran terraform plan, Terraform compared the actual infrastructure state (with the "Name" tag set to "Rajesh") against what's defined in your Terraform configuration (where the tag might be set to "TerraformCI"). Seeing the discrepancy, Terraform planned to update the resource to match the configuration—changing the tag back to "TerraformCI". This behavior is expected and demonstrates Terraform's goal to ensure the infrastructure matches the configuration specified in your .tf files. continued....
upvoted 1 times
...
...
...
...
Absence379
2 months, 2 weeks ago
Selected Answer: BC
B and C
upvoted 1 times
...
mattuyghur
3 months, 2 weeks ago
Selected Answer: BC
should be B and C
upvoted 1 times
...
Tyler2023
6 months, 2 weeks ago
I don't think B is an answer here When you change any configuration manually outside your terraform configuration The next time your run terraform apply, terraform will revert your manual changes and follow what is defined in your configuration files So answer i C
upvoted 1 times
...
brax404
7 months ago
Selected Answer: BC
B. This is true, but with an important distinction. Terraform doesn't automatically detect changes made outside of it. If you modify resources directly in Azure (outside of Terraform), during the next terraform plan or terraform apply, there might be a discrepancy between the state file and the actual infrastructure. Terraform will then propose to reconcile this difference, which could involve changing or recreating the affected resources. C. This is true. The Terraform state file isn't automatically updated when changes are made outside of Terraform, such as directly in the Azure Cloud Console.
upvoted 2 times
...
Pikopo
7 months, 2 weeks ago
the correct answer are B and C
upvoted 1 times
...
gofavad926
7 months, 3 weeks ago
Selected Answer: BC
BC When a change is made to the resources via the Azure Cloud Console, the current state file will not be updated. Terraform will update the state file to reflect the changes made to the resources via the Azure Cloud Console during the next plan or apply.
upvoted 1 times
...
debabrata6983
8 months, 3 weeks ago
Selected Answer: BC
The correct answer is B&C
upvoted 1 times
...
Rajmane
9 months, 2 weeks ago
Selected Answer: BC
The right answer is B & C
upvoted 1 times
...
modarov
9 months, 2 weeks ago
B. When a change is made to the resources via the Azure Cloud Console, Terraform will update the state file to reflect them during the next plan or apply C. When a change is made to the resources via the Azure Cloud Console, the current state file will not be updated
upvoted 1 times
...
March2023
11 months, 1 week ago
Selected Answer: BC
b and c
upvoted 1 times
...
milan92stankovic
11 months, 1 week ago
Selected Answer: BC
B & C are the correct answer.
upvoted 1 times
...
Taalai
12 months ago
according to Chat GPT is B and D
upvoted 1 times
...
sdm13168
1 year ago
Selected Answer: BC
BC for sure
upvoted 2 times
...
Ni33
1 year ago
Selected Answer: BC
B and C are the correct answers
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...