Allow terraform state migration blocks per stack/workspace
- Dominant language
- Go
- Stars
- 1.4k
- Forks
- 175
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 134
Description
### Describe the Feature
I'd like to migrate existing terraform into atmos, without having to run terraform commands, by taking advantage of import blocks.
Usually this can be done easily without workspaces by adding a migrations.tf file in a terraform directory and applying.
This is impossible to do with atmos without manually copying and pasting a file into the directory, then apply, and then remove the migrations file. This works but prevents us from keeping the migration file in git and gives more incentive to running the import commands instead of using import blocks.
### Expected Behavior
A method to allow a migrations file per stack.
Perhaps an optional migrations directory within each component terraform with the following convention.
`/migrations////*.tf`
or
`/migrations/--.tf`
or
`/migraions/.tf`
---
Could be a directory of migration files.
### Use Case
I recall having issues once with the eks component if there was a partial apply failure which resulted in 8 resources created without it stored in state. These had to be reimported manually. I used a script at the time. Using a method like this would also ease developer frustration.
### Describe Ideal Solution
A migrations directory would need to pull a file or directory of files into the base component directory before the terraform workflow began.
At this point, you could also rename this to be a mixin directory which would allow users to change the terraform code per workspace if needed. The migrations would be one use case of that.
### Alternatives Considered
_No response_
### Additional Context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.