Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow terraform state migration blocks per stack/workspace #673

Open
nitrocode opened this issue Aug 16, 2024 · 0 comments
Open

Allow terraform state migration blocks per stack/workspace #673

nitrocode opened this issue Aug 16, 2024 · 0 comments

Comments

@nitrocode
Copy link
Member

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.

<base component>/migrations/<stage>/<region>/<component>/*.tf

or

<base component>/migrations/<stage>-<region>-<component>.tf

or

<base component>/migraions/<workspace>.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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant