-
Notifications
You must be signed in to change notification settings - Fork 59
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
Handle partial backend config #15
Comments
Hi @pyranja, Thank you for sharing your use-case. For a workaround, I came up with a dirty hack. 😉 When switching a remote backend to local, the tfmigrate generates an override file named |
@minamijoyo I see, thanks. So I could check for the presence of the override in a wrapper to decide whether backend config has to be provided or not? What is your general feeling about accepting pass-through |
It's ok to add support for the partial backend config. I think it should be a new migration block attribute rather than a new CLI flag, because a backend config is related to a working directory. It will cause the following problems if it's a CLI flag: (1) The |
Update: The workaround with a terraform wrapper worked very well, thanks for the suggestion. For our use case adding the backend config to the migration block would not work as is:
If the backend config reference is part of the migration, we would have to edit the migrations depending on the target environment or duplicate them for each target with a different backend config. Your concerns with the multi_state and history mode are very relevant too though. Thanks a lot for your explanation! |
I understood the cli flag would be useful your use-case. Not all requirements must be met at the same time. In your case the multi_state migration doesn't make sense across environments. If you apply migrations per environment, you can assume all pending migrations have the same backend config override. There is no single solution for meeting all use-cases. It's ok to add it as the cli flag. If someone want to use it as the migration attribute, then we can support both individually. |
Hi! I'm looking for ideas/help in using tfmigrate with partial backend configuration for remote state.
We are storing terraform state in S3 and use a shared backend config file to reduce duplication (specifying bucket name, dynamodb table for locking, role names to assume for access, etc.).
When executing
tfmigrate plan
, the initialization of the workspace for planning fails, as the backend config is not specified.I can fix this by providing the required backend-config via environment variable
TF_CLI_ARGS_init=...
, which allows tfmigrate to initialize, fetch remote state and do an initial plan.Unfortunately there is strict validation of the backend config and when tfmigrate switches to a local backend override, the reconfiguration fails, as the backend-config is still set through environment variables.
Do you see a workaround for this?
I'm afraid
tfmigrate
might have to acceptbackend-config
to pass through to support this use case, but maybe there is a more lightweight solution?The text was updated successfully, but these errors were encountered: