hashicorp / hashicorp/terraform
Automatically add all existing resources to the state
- Dominant language
- Go
- Stars
- 49.7k
- Forks
- 10.6k
- Avg merge
- 21h 30m
- Merged PRs (30d)
- 100
Description
### Use-cases
When creating new infrastructure but terraform is suddenly crashed or killed and doesn't save the intermediate state. A lot of resources may be created with an empty state. That requires manually deleting or importing all of them. In many cases, users will be 100% sure there are no resources belonging to other TF states.
### Proposal
Add an option to the apply command to import all existing resources assuming they were created by the previously crashed apply command.
Show an alert that this operation is dangerous and the user is fully responsible for possible issues caused by simultaneous resource manipulation by multiple TF states.
### References
A possible workaround for #24276
Contributor guide
Research direction
Start with Terraform's apply command and the workaround referenced in #24276. Work out how an option could identify and import resources after an interrupted apply, while warning about the dangerous operation and simultaneous manipulation by multiple states. Done means the proposal's behavior and safety warning are defined and implemented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, terraform
- Domain
- infrastructure
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100