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

add support for managing ssh keys #47

Merged
merged 1 commit into from
Mar 15, 2018
Merged

add support for managing ssh keys #47

merged 1 commit into from
Mar 15, 2018

Conversation

nicolai86
Copy link
Contributor

@nicolai86 nicolai86 commented Mar 15, 2018

this PR adds support for managing user ssh keys on scaleway.

the new resource looks like this:

resource "scaleway_ssh_key" "awesome_key" {
	key = "ssh-rsa <your key>"
}

The implementation relies on golang.org/x/crypto/ssh to parse the SSH key to retrieve the correct fingerprint; also included are docs.

SSH keys can be imported like this:

terraform import scaleway_ssh_key.id d1:4c:45:59:a8:ee:e6:41:10:fb:3c:3e:54:98:5b:6f

closes #45

@nicolai86 nicolai86 force-pushed the ssh-keys branch 3 times, most recently from 1bdec44 to 941242d Compare March 15, 2018 03:08
Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

a couple of minor 🤔 otherwise LGTM 👍

return nil
}

mu.Lock()
Copy link
Contributor

Choose a reason for hiding this comment

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

do you want to move this lock up / re-retrieve the list post-lock, in-case a secondary key gets added in the meantime?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done!

})
}
}
mu.Lock()
Copy link
Contributor

Choose a reason for hiding this comment

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

again - do we want to move this lock up?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done :)

var testAccCheckScalewaySSHKeyConfig = `
resource "scaleway_ssh_key" "test" {
key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDYpDmIzRs5c+xs0jmljMbNYVcgV8fRruMCRDA4HKjGN2lqLTZhngGDXsdt/2kTNQQPAq2sR4N8mfX5wMRT/+jNb+8esPyY5WlElni0zmD7oLoPW4lYRES6f7EeAv6NttLfkDO42r15OtMnglcgWk1u4o3lOXuLbhzJT1qdicpDja22X3uR/xUy1AYhKBOoiSlQbkb7NhL0lA1xQNwerdaJJS8tFB+wViVDyP0f1HaIRxViFlTGuTbTuIJNR/7VJ9VBBuTnYXaRkPxz64sUXrtdVK8U0+4KsisyXwmgQKnvZBDj91wxz12OOzFSQ52iFprIj1JbkzuBmNWXUGKYzXJZ test"
}
Copy link
Contributor

Choose a reason for hiding this comment

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

given the comments above, it might be worth a test adding multiple keys?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added testcases for multiple keys including removal.

},
{
"checksumSHA1": "hfABw6DX9B4Ma+88qDDGz9qY45s=",
"path": "golang.org/x/crypto/internal/chacha20",
Copy link
Contributor

Choose a reason for hiding this comment

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

assuming go build is happy with the internal vendors :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 it is

@nicolai86 nicolai86 force-pushed the ssh-keys branch 2 times, most recently from 1bdb2f5 to ac04d5d Compare March 15, 2018 03:16
@nicolai86 nicolai86 merged commit b70b863 into master Mar 15, 2018
@nicolai86 nicolai86 deleted the ssh-keys branch March 15, 2018 03:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: allow adding ssh keys via the API
2 participants