When using Terraform to deploy resources into Azure, which scenarios are true regarding state files? (Choose two.)
When using Terraform to deploy resources into Azure, which scenarios are true regarding state files? (Choose two.)
When changes are made to Azure resources outside of Terraform (for example, through the Azure Cloud Console), the state file that Terraform maintains will not be automatically updated. During the next execution of 'terraform plan' or 'terraform apply', Terraform will detect differences between the state file and the actual infrastructure state. While the 'terraform plan' command will highlight these discrepancies, it does not update the state file itself. The 'terraform apply' command, on the other hand, will try to reconcile these differences and update the state file to reflect the current state of the infrastructure, ensuring consistency with the defined configuration.
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.
Option B's wording is too fuzzy.
Terraform plan / apply runs a terraform refresh to update the state with infrastructure so B makes sense.
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
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
Only C
Yes Band C
B and C are correct answers. Could not select more than one answer.
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.
BC is the correct answer
if only one answer is accepted C is correct and the only one
Only C is correct. Terraform plan doesn't make any changes in state file.
one of the option is C for sure
correct answers are B & C
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
only C
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.
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
B and C are both correct. Terraform plan DOES refresh the state file. extract from documentation . You don't need the (deprecated) refresh command to update state file. Newer option terraform plan -refresh lets you review changes to state file before modifying it. terraform refresh (deprecated) https://developer.hashicorp.com/terraform/cli/commands/refresh 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.
I think is B and D
B and C are the correct scenarios when using Terraform to deploy resources into Azure. B is true because Terraform tracks the desired state of the resources defined in the configuration file in the state file. When a change is made to the resources via the Azure Cloud Console, Terraform will detect the difference between the desired state and the actual state of the resources during the next plan or apply, and will update the state file to reflect the changes. C is also true because the current state file will not be updated if changes are made outside of Terraform, and Terraform will not be aware of those changes until the next plan or apply is run. Therefore, it is important to avoid making changes directly in the Azure Cloud Console if Terraform is being used to manage those resources. A and D are not true scenarios because changes made outside of Terraform will not be recorded in the current state file until the next plan or apply is run, and the changes made in the Azure Cloud Console will not be automatically recorded in the state file.
B and C are the correct scenarios when using Terraform to deploy resources into Azure.
B and C are the correct answers
BC for sure
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.
B and C
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.
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
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.......
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....
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....
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.......
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....
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....
Yes B & C
B and C are correct answers.
B is wrong cause terraform plan doesn't reflect the state file at all. a, d are wrong. choose two looks like wrong.
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"
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
B and C
B and C
In answer B, spanish languague should have a ',' between them and during stopping the reading, so no changes in state file until the next apply or plan that produces a auto-refresh marking changes for being updated
The correct answers are: 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. D. When a change is made to the resources via the Azure Cloud Console, the changes are recorded in the current state file.
Option B is correct because Terraform is designed to be idempotent, meaning that it will always attempt to bring the current infrastructure state into the desired state defined in the configuration file. Therefore, it will update the state file to reflect any changes made outside of Terraform. Option D is correct because any changes made through the Azure Cloud Console will be recorded in the current state file, as the state file is used to keep track of the current state of the infrastructure. Option A is incorrect because changes made through the Azure Cloud Console will not create a new state file. The state file is specific to the Terraform configuration and is used to keep track of the current state of the infrastructure. Option C is incorrect because changes made through the Azure Cloud Console will be reflected in the state file during the next plan or apply. The state file is used to keep track of the current state of the infrastructure, regardless of how changes are made.
B and C
according to Chat GPT is B and D
B & C are the correct answer.
b and c
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
The right answer is B & C
The correct answer is B&C
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.
the correct answer are B and C
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
should be B and C
B, C are correct answers
Answer: B and C if you make a change outside of Terraform, then the state file will not get updated until you run apply/plan in terraform to pull the latest infrastructure info and then save it to the state file.
that state file needs to be updated as per the changes made in the console or terraform refresh to update