Consider a Terraform configuration where a resource is created and then manually deleted outside Terraform (e.g., via cloud console). What will Terraform's local state file reflect after this manual deletion?
Think about how Terraform tracks resources and when it updates its local state file.
Terraform's local state file keeps track of resources it manages. If a resource is deleted outside Terraform, the local state still shows it as existing until you run 'terraform refresh' or 'terraform apply', which updates the state to match reality.
Two team members run Terraform commands independently on the same infrastructure but on their own local machines using local state files. What is the likely outcome?
Consider how local state files are stored and shared.
Local state files are stored on each user's machine and are not shared. Running Terraform independently can cause state drift and conflicts because each user has their own view of the infrastructure.
After a failed Terraform operation, the local state file becomes corrupted. What error message will Terraform most likely show when you try to run 'terraform plan'?
Think about what happens if the state file content is unreadable or malformed JSON.
If the local state file is corrupted or contains invalid JSON, Terraform will fail to parse it and show an error indicating invalid characters or failure to load state.
Storing Terraform local state files on a shared network drive accessible by multiple users can cause which security risk?
Consider what kind of data Terraform state files contain.
Terraform state files often contain sensitive information such as resource IDs, IP addresses, and sometimes secrets. Storing them on a shared drive without proper access controls risks unauthorized data exposure.
Your team manages infrastructure with Terraform. To avoid local state conflicts and ensure consistent state, which approach is best?
Think about how to share state safely and avoid conflicts.
Using a remote state backend with locking ensures only one user can modify state at a time, preventing conflicts and keeping state consistent across the team.