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 for sftp service support only server #6639

Merged

Conversation

teraken0509
Copy link
Contributor

@teraken0509 teraken0509 commented Nov 29, 2018

Reference #6584

Changes proposed in this pull request:

  • Add resource aws_transfer_server for create AWS Transfer for SFTP Service's server.

Output from acceptance testing:

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

TODO

  • Add Tests
  • Add Documentation file

@ghost ghost added size/XL Managed by automation to categorize the size of a PR. provider Pertains to the provider itself, rather than any interaction with AWS. labels Nov 29, 2018
@teraken0509 teraken0509 force-pushed the feature/add-support-transfer-for-sftp-service branch 6 times, most recently from 0e592b5 to 3e4d0f1 Compare November 30, 2018 09:06
@ghost ghost added documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Nov 30, 2018
@teraken0509 teraken0509 changed the title [WIP] Add transfer for sftp service support Add transfer for sftp service support Nov 30, 2018
@teraken0509 teraken0509 changed the title Add transfer for sftp service support Add transfer for sftp service support only server Dec 1, 2018
@bflad bflad added new-resource Introduces a new resource. service/transfer Issues and PRs that pertain to the transfer service. labels Dec 2, 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.

This is off to a great start, @kterada0509! Thanks so much for the contribution. Please see the initial comments below and let us know if you have any questions or do not have time to implement the feedback.

aws/resource_aws_transfer_server.go Outdated Show resolved Hide resolved
aws/resource_aws_transfer_server.go Show resolved Hide resolved
aws/resource_aws_transfer_server.go Outdated Show resolved Hide resolved
aws/resource_aws_transfer_server.go Outdated Show resolved Hide resolved
aws/resource_aws_transfer_server_test.go Outdated Show resolved Hide resolved
// First, we're creating everything we have
create := make(map[string]interface{})
for _, t := range newTags {
create[*t.Key] = *t.Value
Copy link
Contributor

Choose a reason for hiding this comment

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

To prevent potential panics, we should use the AWS Go SDK provided functions for dereferencing here, e.g.

Suggested change
create[*t.Key] = *t.Value
create[aws.StringValue(t.Key)] = aws.StringValue(t.Value)

Same with the * dereferences below. 👍

aws/tagsTransferServer_test.go Show resolved Hide resolved
website/aws.erb Outdated Show resolved Hide resolved
website/docs/r/transfer_server.html.markdown Outdated Show resolved Hide resolved
aws/resource_aws_transfer_server.go Show resolved Hide resolved
@bflad bflad added the waiting-response Maintainers are waiting on response from community or contributor. label Dec 2, 2018
@teraken0509
Copy link
Contributor Author

@bflad
Thank you very much for review!
I will fix in this week.

@ghost ghost removed the waiting-response Maintainers are waiting on response from community or contributor. label Dec 3, 2018
@bflad bflad added the waiting-response Maintainers are waiting on response from community or contributor. label Dec 3, 2018
@teraken0509 teraken0509 force-pushed the feature/add-support-transfer-for-sftp-service branch from 3e4d0f1 to 98927a3 Compare December 10, 2018 03:02
@teraken0509
Copy link
Contributor Author

Test Result

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

@bflad bflad added this to the v1.52.0 milestone Dec 13, 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.

Let's get this in so folks can get started with this today. Thanks, @kterada0509! 🚀

--- PASS: TestAccAWSTransferServer_disappears (8.49s)
--- PASS: TestAccAWSTransferServer_apigateway (21.58s)
--- PASS: TestAccAWSTransferServer_basic (22.16s)

@bflad bflad merged commit c9ccde0 into hashicorp:master Dec 13, 2018
bflad added a commit that referenced this pull request Dec 13, 2018
@bflad
Copy link
Contributor

bflad commented Dec 13, 2018

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

* `url` - (Optional) - URL of the service endpoint used to authenticate users with an `identity_provider_type` of `API_GATEWAY`.
* `identity_provider_type` - (Optional) The mode of authentication enabled for this service. The default value is `SERVICE_MANAGED`, which allows you to store and access SFTP user credentials within the service. `API_GATEWAY` indicates that user authentication requires a call to an API Gateway endpoint URL provided by you to integrate an identity provider of your choice.
* `logging_role` - (Optional) Amazon Resource Name (ARN) of an IAM role that allows the service to write your SFTP users’ activity to your Amazon CloudWatch logs for monitoring and auditing purposes.
* `tags` - (Optional) A mapping of tags to assign to the resource.
Copy link
Contributor

Choose a reason for hiding this comment

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

these docs say that the tags are optional, but applying a resource without tags doesn't work:

Error: Error applying plan:

1 error(s) occurred:

* aws_transfer_server.sftp_server: 1 error(s) occurred:

* aws_transfer_server.sftp_server: Error creating Transfer Server: InvalidParameter: 1 validation error(s) found.
- minimum field size of 1, CreateServerInput.Tags.

i'm happy to open a PR to fix, but i guess i wanna verify that these are meant to be optional. i know that the AWS API doesn't require the tags, but i don't know if terraform wants them to be required?

tags := tagsFromMapTransferServer(d.Get("tags").(map[string]interface{}))

createOpts := &transfer.CreateServerInput{
Tags: tags,
Copy link
Contributor

Choose a reason for hiding this comment

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

i think that this is the line that's causing the tags to be "required" when they're supposed to be optional. if we provide the Tags attribute in the CreateServerInput call, they cannot be empty.

@dbuzolin-nfl
Copy link

dbuzolin-nfl commented Dec 21, 2018

Is there way to add hostname property to transfer service, and/or also integrate it with Route53? Current implementation creates service with empty hostname: "-"
#6956

@ghost ghost removed the waiting-response Maintainers are waiting on response from community or contributor. label Dec 21, 2018
@samandmoore
Copy link
Contributor

samandmoore commented Dec 21, 2018 via email

@dbuzolin-nfl
Copy link

That is correct, but the issue is different. AWS assigns this link via two tags:

aws:transfer:route53HostedZoneId | /hostedzone/ABCDEFGHIGFK
aws:transfer:customHostname | mysftphost.myco.com

and there is now way to create those in terraform, they are simply ignored. Because of this current implementation is not really usable.

@teraken0509 teraken0509 deleted the feature/add-support-transfer-for-sftp-service branch March 5, 2020 14:05
@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.

4 participants