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

Tool not working on windows #89

Open
Olgoetz opened this issue May 27, 2022 · 5 comments
Open

Tool not working on windows #89

Olgoetz opened this issue May 27, 2022 · 5 comments

Comments

@Olgoetz
Copy link

Olgoetz commented May 27, 2022

I have built tfmigrate from source for windows.

However, I receive:

failed to run command (exited 1): terraform state mv -state=C:\Users\i016249\AppData\Local\Temp\tmp3995434150 -state-out=C:\Users\i016249\AppData\Local\Temp\tmp3354553505 -backup=/dev/null module.network.data.aws_availability_zones.available module.network.data.aws_availability_zones.available
stdout:
Move "module.network.data.aws_availability_zones.available" to "module.network.data.aws_availability_zones.available"

stderr:
Error saving the state: failed to create local state backup file: open /dev/null: The system cannot find the path specified.

The state was not saved. No items were removed from the persisted
state. No backup was created since no modification occurred. Please
resolve the issue above and try again.

How can I make it work for windows as it does not have /dev/null ?

@minamijoyo
Copy link
Owner

Hi @Olgoetz, Thank you for reporting this!

The current implementation specifies /dev/null directly, but the os.DevNull constant points to the NUL device on Windows. I don't have a Windows device for testing; would it be possible for you to try it? If you are not familiar to Go, please let me know.
https://pkg.go.dev/os#pkg-constants

@Olgoetz
Copy link
Author

Olgoetz commented Jun 3, 2022

I will try it

@Olgoetz
Copy link
Author

Olgoetz commented Jun 3, 2022

I just cloned the repo and encountering now this:

2022/06/03 13:43:24 [INFO] [executor@C:\Users\i016249\DEVELOPMENT\tfmigrate] create an override file
2022/06/03 13:43:24 [INFO] [migrator@C:\Users\i016249\DEVELOPMENT\tfmigrate] creating local workspace folder in: C:\Users\i016249\DEVELOPMENT\tfmigrate\terraform.tfstate.d\default
2022/06/03 13:43:24 [INFO] [executor@C:\Users\i016249\DEVELOPMENT\tfmigrate] switch backend to local
2022/06/03 13:43:24 [DEBUG] [executor@C:\Users\i016249\DEVELOPMENT\tfmigrate]$ terraform init -input=false -no-color -reconfigure
2022/06/03 13:43:26 [DEBUG] [executor@C:\Users\i016249\DEVELOPMENT\tfmigrate] failed to run command: (*exec.ExitError)(0x12cba0c0)(exit status 1)
failed to switch backend to local: failed to run command (exited 1): terraform init -input=false -no-color -reconfigure
stdout:

Initializing the backend...

stderr:

Error: Error asking for state migration action: input is disabled

@minamijoyo
Copy link
Owner

It's maybe related to #45.
The tfmigrate doesn't work with the local backend. It requires a remote state backend.

@Tzrlk
Copy link

Tzrlk commented Jun 14, 2022

FYI, I've got 0.3.3 working great on my Windows 10 machine.

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

3 participants