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

Init force-copy is not "equivalent to providing a "yes" to all confirmation prompts." #17663

Closed
Lasering opened this issue Mar 21, 2018 · 9 comments
Labels
bug cli v0.11 Issues (primarily bugs) reported against v0.11 releases waiting-response An issue/pull request is waiting for a response from the community

Comments

@Lasering
Copy link

The setting force-copy in terraform init is not 'equivalent to providing a "yes" to all confirmation prompts.'

Terraform Version

Terraform v0.11.3

Steps to Reproduce

  1. Start with a terraform recipe without a backend.
  2. Run apply.
  3. Configure a new backend (consul in my case).
  4. Run terraform init -force-copy

Expected Behavior

Terraform should copy the state to consul without user interaction.

Actual Behavior

Initializing modules...

Initializing the backend...
Do you want to migrate all workspaces to "consul"?
  Both the existing "local" backend and the newly configured "consul" backend support
  workspaces. When migrating between backends, Terraform will copy all
  workspaces (with the same names). THIS WILL OVERWRITE any conflicting
  states in the destination.
  
  Terraform initialization doesn't currently migrate only select workspaces.
  If you want to migrate a select number of workspaces, you must manually
  pull and push those states.
  
  If you answer "yes", Terraform will migrate all states. If you answer
  "no", Terraform will abort.

  Enter a value: 

Additional Context

The following alternatives were tried:

  1. terraform init -reconfigure -force-copy same outcome as without the reconfigure.
  2. terraform init -input=false -reconfigure and terraform init -input=false -reconfigure -force-copy with the outcome Error asking for state migration action: input is disabled.
@Lasering
Copy link
Author

Lasering commented Jul 9, 2018

The obvious workaround is echo "yes" | terraform init.

This bug is especially annoying when TF_INPUT="false" in CI environments. For those cases:

echo "yes" | TF_INPUT="true" terraform

@swagatata
Copy link

swagatata commented Jan 16, 2019

Is there any update on this? We are getting "Error asking for state migration action: input is disabled" even if -force-copy option. Our command :

terraform init -input=false -force-copy -backend-config=config_file @vaibhav-si

@vaibhav-si
Copy link

Any update on this @jbardin

@zhughes3
Copy link

Hey I am also having this same issue. Any update on this?

@mildwonkey
Copy link
Contributor

Hi folks,

The terraform core team is heads-down on the terraform 0.12 release, which is currently feature-frozen. I see that there is already PR open and we will review it once 0.12 is released.

In general, the best way to influence our prioritization is by reacting to the original issue comment with 👍, which we can and do report on during prioritization.

@hashibot hashibot added the v0.11 Issues (primarily bugs) reported against v0.11 releases label Aug 29, 2019
@jeffmccollum
Copy link

This is still affecting v0.12

@danieldreier
Copy link
Contributor

@jeffmccollum @Lasering and other folks who have upvoted this: I have tried to reproduce this on 0.12.26 with Terraform Cloud ("remote" backend) and AWS S3, and in my tests when I ran init -force-copy it copied state without prompting me.

I have put together a scripted issue reproduction in https://github.com/danieldreier/terraform-issue-reproductions/tree/master/17663 to help us collaborate on this. Based on my initial attempts to reproduce it, it looks to me like this was resolved at some point, but given how many people have upvoted this, I would appreciate some help and confirmation. I know it's possible I've scripted this wrong.

If you are still seeing this behavior on 0.12.26 or an 0.13.0 beta, please make a PR against that reproduction case to show me how to trigger this behavior.

@danieldreier danieldreier added the waiting-response An issue/pull request is waiting for a response from the community label Jun 12, 2020
@mildwonkey
Copy link
Contributor

I am going to close this issue due to both inactivity and the fact that it appears to be resolved, thanks!

If there is still a question, I recommend the the community forum, where there are far more people available to help. If there is a bug or you would like to make a feature request, please open a new issue and fill out the template.
Thanks!

@ghost
Copy link

ghost commented Oct 13, 2020

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.

@hashicorp hashicorp locked as resolved and limited conversation to collaborators Oct 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug cli v0.11 Issues (primarily bugs) reported against v0.11 releases waiting-response An issue/pull request is waiting for a response from the community
Projects
None yet
Development

No branches or pull requests

9 participants