Terraform state management
- Terraform always ensures desired state is equal to actual state during apply
- Terraform execution
- terraform gets the current state from provider
- compares that with desired state, difference becomes plan
- executes the plan to create resources and stores the creation details in the state file
- Note: Never manually edit/change state files
- If you want to force recreation of a resource
- taint: marking a resource as taint will force replacement during next apply
- If you want to stop managing a resource from terraform and still want the resource to exist
- delete from state
- delete from template
Terraform Importing Resources
- Refer Here for official docs
- Watch classroom recording for example
