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

command: Fix bug when using terraform login on Windows #24397

Merged
merged 1 commit into from
Mar 18, 2020

Conversation

alisdair
Copy link
Member

Restructure the credentials storing code for compatibility with Windows system calls. Fixes #24388. Changes:

  • We need to close the temporary file before moving it
  • file.Chmod is not supported, so use os.Chmod
  • os.Chmod also requires the file is closed, so move it to the end of the procedure

Note that the chmod doesn't actually do anything useful on Windows. To actually make this file user-only, we'd need to use something like go-acl. I'm open to doing that in this PR, but I thought the smallest change to fix the bug was worth looking at first.

Screenshot

Before:

image

After:
image

@alisdair alisdair requested a review from a team March 17, 2020 17:32
@codecov
Copy link

codecov bot commented Mar 17, 2020

Codecov Report

Merging #24397 into master will increase coverage by 0.00%.
The diff coverage is 33.33%.

Impacted Files Coverage Δ
command/cliconfig/credentials.go 60.49% <33.33%> (ø)
dag/marshal.go 52.27% <0.00%> (-1.14%) ⬇️
backend/remote/backend_common.go 55.63% <0.00%> (+0.70%) ⬆️

Copy link
Contributor

@mildwonkey mildwonkey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I approve both this PR and overriding codecov's objections!

@alisdair alisdair merged commit 8c7a443 into master Mar 18, 2020
@alisdair alisdair deleted the alisdair/fix-terraform-login-windows branch March 18, 2020 13:08
@ghost
Copy link

ghost commented Apr 18, 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.

@ghost ghost locked and limited conversation to collaborators Apr 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Terraform login fails to create the necessary credentials file on Windows
2 participants