-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
remove extra backend migration prompts #16939
Conversation
The duplicate prompts can be confusing when the user confirms that a migration should happen and we immediately prompt a second time for the same thing with slightly different wording. The extra hand-holding that this provides for legacy remote states is less critical now, since it's been 2 major release cycles since those were removed.
There were two tests that had the duplicate confirmations hard-coded in the input stream.
b6a8bd6
to
22e3426
Compare
Make sure the init inputFalse test actually errors from missing input, since skipping input will still fail later during provider initialization. We need to make sure there are two different states that aren't a noop for migration, and reset the command struct for each run. Also verify that we don't go into an infinite loop if there is no input.
Only check for input twice in the meta.confirm method. This prevents an errant newline from aborting the run while allowing Terraform to exit if there is no input available. We don't just check for a tty, since we still rely on being able to pipe input in for testing. Remove the redundant confirmation loops in the migration code, and only use the confirm method.
22e3426
to
885e4cd
Compare
9cd03f2
to
bdb7001
Compare
command/meta_backend.go
Outdated
Terraform can copy the existing state in your legacy remote state | ||
backend to your newly configured backend. Please answer "yes" or "no". | ||
const outputBackendMigrateChange = ` | ||
Terraform detected the backend type changed from %q to %q. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think "Terraform detected that the..." would be clearer here. On first read my mental parser was confused by trying to read it as "Terraform detected the backend type".
The existing prompts were worded as if backend configurations were named, but they can only really be referenced by their type. Change the wording to reference them as type "X backend". When migrating state, refer to the backends as the "previously configured" and "newly configured", since they will often have the same type.
bdb7001
to
f45205f
Compare
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. |
The duplicate prompts can be confusing when the user confirms that a
migration should happen and we immediately prompt a second time for the
same thing with slightly different wording. The extra hand-holding that
this provides for legacy remote states is less critical now, since it's
been 2 major release cycles since those were removed.
Only check for input twice in the meta.confirm method. This prevents an
errant newline from aborting the run while allowing Terraform to exit if
there is no input available. We don't just check for a tty, since we
still rely on being able to pipe input in for testing.
Remove the redundant confirmation loops in the migration code, and only
use the confirm method.
fixes #16922