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 Transfer SSH Public Key Resource Support #6932

Merged

Conversation

teraken0509
Copy link
Contributor

Fixes #6584

Changes proposed in this pull request:

  • Add Transfer SSH Public Key Support

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccAWSTransferSshKey_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAWSTransferSshKey_basic -timeout 120m
?   	github.com/terraform-providers/terraform-provider-aws	[no test files]
=== RUN   TestAccAWSTransferSshKey_basic
=== PAUSE TestAccAWSTransferSshKey_basic
=== CONT  TestAccAWSTransferSshKey_basic
--- PASS: TestAccAWSTransferSshKey_basic (37.65s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	37.871s
...

@ghost ghost added size/XL Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. provider Pertains to the provider itself, rather than any interaction with AWS. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Dec 20, 2018
@bflad bflad added new-resource Introduces a new resource. service/transfer Issues and PRs that pertain to the transfer service. labels Dec 20, 2018
@bflad bflad added this to the v1.53.0 milestone Dec 20, 2018
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

Great work, @kterada0509! 🚀 I'll make the very minor documentation updates on merge so this can get released tomorrow.

--- PASS: TestAccAWSTransferSshKey_basic (8.04s)


if body == "" {
log.Printf("[WARN] No such ssh public key found for User (%s) in Server (%s)", userName, serverID)
d.SetId("")
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Its safe in this case to be omitted, but generally we should immediately call return nil after d.SetId("") 👍


var body string
for _, s := range resp.User.SshPublicKeys {
if sshKeyID == *s.SshPublicKeyId {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: To prevent potential panics, we prefer to dereference API response values using the AWS Go SDK functions, e.g. if sshKeyID == aws.StringValue(s.SshPublicKeyId)


# aws_transfer_ssh_key

Provides a AWS Transfer User resource.
Copy link
Contributor

Choose a reason for hiding this comment

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

This should mention SSH Key here 😄

resource "aws_transfer_ssh_key" "foo" {
server_id = "${aws_transfer_server.foo.id}"
user_name = "${aws_transfer_user.foo.user_name}"
body = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 phodgson@thoughtworks.com"
Copy link
Contributor

Choose a reason for hiding this comment

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

While its admittedly present in the acceptance testing files, I'm going to at least change the email address here in the public facing documentation to a fake email.

@bflad bflad merged commit a789e20 into hashicorp:master Dec 20, 2018
bflad added a commit that referenced this pull request Dec 20, 2018
@bflad bflad mentioned this pull request Dec 20, 2018
2 tasks
@bflad
Copy link
Contributor

bflad commented Dec 20, 2018

This has been released in version 1.53.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@teraken0509 teraken0509 deleted the feature/add-support-for-sftp-ssh-key branch March 5, 2020 14:03
@ghost
Copy link

ghost commented Mar 5, 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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. new-resource Introduces a new resource. provider Pertains to the provider itself, rather than any interaction with AWS. service/transfer Issues and PRs that pertain to the transfer service. size/XL Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: AWS Transfer for SFTP service
2 participants