-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
How to handle state migrations as code during module upgrades ? #1101
Comments
In general I like your plan. Questions/comments are:
On another side as those refactors will be really breaking changes maybe it is worth establishing an additional dev branch for some time (let say 2-3 months) to cover those changes and refactor (replace counts, break tf0.12 support for tf0.13 new features) with breaking compatibility. After some clarification and getting Offcourse second approach has sense only if there will be engagement from community to work on that in reasonable time (from my side I am able to provide my 10-20% time for this initiative) |
In relation to: I think you should add the new worker groups as submodule, in parallel to any form of older worker groups, in at least 1 version of the module. This way, we can replicate the same worker groups using submodules, and slowly scale down to zero the old workers (i.e. worker_groups_launch_template=), before upgrading to a version where old worker groups are not supported. Or at least that is what I had in mind. But if the state migration just works well, then it might be better, don't have experience with that, but looks complex in the scenario of worker groups |
That was my original idea but after some suggestions that it might be not needed I have dropped this way: |
I don't know precisely, because even if the for_each for module is great, I don't see for now what will be the real benefit of using it over the for_each in resources (just replace actual count with for_each). I'm still open to discussion. But with that said, we decided recently in a terraform-aws-modules office hours, that we can now use TF 0.13 features if we need them. We can use them if needed.
Good point. In every cases, we should provide a good docs for that. Maybe, we can just generate
The main point is that we don't want to support multiple branches. It'll introduce lot of works for maintainers (features backporting, conflict resolving, code cleaning, etc.). So we can create a temporary branch (by example
Thanks, we'll keep that in mind. @jaimehrubiks @grzegorzlisowski
As I mentioned in #858 (comment) we'll still need to move other resources (cluster, configmap, iam policies, etc.), so I think we can move them all at once and document how to do it correctly. Generally speaking, state migration is a Terraform Core issue. To me, it should provide something to help migrations. But until we get something in the Hashicorp lands (maybe with this hashicorp/terraform#19354), Terraform users and module developers will handle state manipulations themselves. For now, if we're not ready to do this, I think if we should stop using Terraform (at least until there is an elegant way to tackle this kind of issue). |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically closed because it has not had recent activity since being marked as stale. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
this seems be future solution hashicorp/terraform#29126 to observe |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically closed because it has not had recent activity since being marked as stale. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
I have issues
I'm submitting a...
Discussion
I'm opening this issue to start discussion about migrations and state manipulations during upgrades, for #858 and for the next migrations ?
Today there is no an easy way to upgrade. As this module is getting more complex, we took the decision to split the module into small submodules. We discussed it in #635 and #774.
We now support Fargate and Managed Node Groups as submodules. The next step will be :
Those moves will add a lot of breaking changes and will break all clusters and workloads, so your production environement.
To avoid that, we're actually looking for a way to ease that migration.
One of the solution I've in mind is to use https://github.com/minamijoyo/tfmigrate and create a submodule to generate a
tfmigrate.hcl
file to help users in their migrations.The workflow should be:
terraform apply
before upgrade to ensure that your code is in sync with your statesterraform apply
withvar.eks_tfmigrate=true
to generate thetfmigrate.hcl
tfmigrate plan
tfmigrate apply
terraform plan
to see if there are some changecc @terraform-aws-modules/triage-supporters @grzegorzlisowski @sc250024 @js-timbirkett
Additional infos
The text was updated successfully, but these errors were encountered: