Terraform uses a state file to track resources it manages. What is the main risk of manually editing this state file?
Think about what happens if Terraform's record of resources does not match reality.
Manual edits can cause Terraform to have incorrect information about resources. This mismatch can lead to Terraform deleting or changing resources unexpectedly during the next apply.
Imagine the Terraform state file is corrupted or inconsistent. What is the likely outcome when you run terraform apply?
Consider how Terraform relies on the state file to know what exists.
If the state file is corrupted, Terraform's understanding of the infrastructure is wrong. It may delete or recreate resources unnecessarily, causing outages.
Which security risk is most associated with manually editing Terraform state files?
Think about what kind of information Terraform state files contain.
Terraform state files often contain sensitive information. Manual edits can accidentally expose or leak this data if not handled carefully.
If you find an error in your Terraform state, what is the best practice to fix it without manual editing?
Terraform provides commands to manage state safely.
Terraform commands like terraform state rm and terraform import allow you to modify state safely without corrupting it.
You manually edit the Terraform state file to remove a resource entry but do not delete the actual resource in the cloud. What will terraform plan show?
Think about how Terraform compares state to actual resources.
Removing a resource from state makes Terraform think it does not exist. It will plan to create it again, causing duplication or conflicts.