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 User Resource Support #6850

Merged
merged 10 commits into from
Dec 19, 2018

Conversation

teraken0509
Copy link
Contributor

@teraken0509 teraken0509 commented Dec 14, 2018

Reference: #6584

Changes proposed in this pull request:

  • Add aws_transfer_user reource support

Output from acceptance testing:

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

TODO

  • Add tests for aws_transfer_user
  • Add documents for aws_transfer_user

@ghost ghost added size/L Managed by automation to categorize the size of a PR. provider Pertains to the provider itself, rather than any interaction with AWS. labels Dec 14, 2018
@teraken0509 teraken0509 force-pushed the feature/add-support-for-sftp-user branch 4 times, most recently from cbbf69e to 345d4dd Compare December 14, 2018 17:46
@ghost ghost added size/XL Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. and removed size/L Managed by automation to categorize the size of a PR. labels Dec 14, 2018
@teraken0509 teraken0509 force-pushed the feature/add-support-for-sftp-user branch from 345d4dd to 43d4079 Compare December 15, 2018 12:29
@ghost ghost added the documentation Introduces or discusses updates to documentation. label Dec 15, 2018
@teraken0509 teraken0509 changed the title [WIP]Add Transfer User Resource Support Add Transfer User Resource Support Dec 15, 2018
@bflad bflad added the new-resource Introduces a new resource. label Dec 18, 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.

Hi @kterada0509 👋 Thanks for submitting this. Please see the initial feedback below and let us know if you have any questions or do not have time to implement the items.

aws/resource_aws_transfer_user.go Outdated Show resolved Hide resolved
aws/resource_aws_transfer_user.go Show resolved Hide resolved
aws/resource_aws_transfer_user.go Outdated Show resolved Hide resolved
aws/resource_aws_transfer_user.go Outdated Show resolved Hide resolved
aws/resource_aws_transfer_user.go Outdated Show resolved Hide resolved
aws/resource_aws_transfer_user_test.go Outdated Show resolved Hide resolved
website/docs/r/transfer_user.html.markdown Outdated Show resolved Hide resolved
website/docs/r/transfer_user.html.markdown Outdated Show resolved Hide resolved
website/docs/r/transfer_user.html.markdown Outdated Show resolved Hide resolved

func testAccAWSTransferUserConfig_update(rName string) string {
return fmt.Sprintf(`
resource "aws_transfer_server" "foo" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I would recommend moving the common server and IAM role related resources to a "base" configuration function that can be included in the other test configuration functions to simplify the setup.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I split test for option params.
But IAM Role is Requirement param, so left on base configuration.
https://docs.aws.amazon.com/transfer/latest/userguide/API_CreateUser.html#API_CreateUser_RequestSyntax

@bflad bflad added the waiting-response Maintainers are waiting on response from community or contributor. label Dec 18, 2018
@ghost ghost added size/XXL Managed by automation to categorize the size of a PR. and removed size/XL Managed by automation to categorize the size of a PR. labels Dec 19, 2018
@teraken0509 teraken0509 force-pushed the feature/add-support-for-sftp-user branch from 2066149 to 098682c Compare December 19, 2018 04:11
@ghost ghost added size/XL Managed by automation to categorize the size of a PR. and removed size/XXL Managed by automation to categorize the size of a PR. labels Dec 19, 2018
@teraken0509
Copy link
Contributor Author

make testacc TESTARGS='-run=TestAccAWSTransferUser_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAWSTransferUser_ -timeout 120m
?   	github.com/terraform-providers/terraform-provider-aws	[no test files]
=== RUN   TestAccAWSTransferUser_basic
=== PAUSE TestAccAWSTransferUser_basic
=== RUN   TestAccAWSTransferUser_modifyWithOptions
=== PAUSE TestAccAWSTransferUser_modifyWithOptions
=== RUN   TestAccAWSTransferUser_disappears
=== PAUSE TestAccAWSTransferUser_disappears
=== CONT  TestAccAWSTransferUser_basic
=== CONT  TestAccAWSTransferUser_disappears
=== CONT  TestAccAWSTransferUser_modifyWithOptions
--- PASS: TestAccAWSTransferUser_disappears (32.18s)
--- PASS: TestAccAWSTransferUser_basic (36.11s)
--- PASS: TestAccAWSTransferUser_modifyWithOptions (81.40s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	81.510s

@ghost ghost removed the waiting-response Maintainers are waiting on response from community or contributor. label Dec 19, 2018
@bflad bflad added this to the v1.53.0 milestone Dec 19, 2018
@bflad bflad added the service/transfer Issues and PRs that pertain to the transfer service. label Dec 19, 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.

LGTM, thanks @kterada0509! 🚀

--- PASS: TestAccAWSTransferUser_basic (7.69s)
--- PASS: TestAccAWSTransferUser_disappears (7.83s)
--- PASS: TestAccAWSTransferUser_modifyWithOptions (18.41s)

@@ -82,6 +82,34 @@ func validateTypeStringNullableFloat(v interface{}, k string) (ws []string, es [
return
}

func validateTransferServerID(v interface{}, k string) (ws []string, errors []error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: These custom validation functions can be replaced with ValidateFunc: validation.StringMatch(regexp.MustCompile(), "message"). We'll be doing a passthrough of cleaning up all the extraneous custom validation functions after the Terraform 0.12 provider SDK is merged as it contains some very helpful new functionality in this regard. 👍

@bflad bflad merged commit b6a6494 into hashicorp:master Dec 19, 2018
bflad added a commit that referenced this pull request Dec 19, 2018
@walterheck
Copy link

Is there a reason the ssh pub key property is not exposed? It's standard for the API: https://docs.aws.amazon.com/transfer/latest/userguide/API_CreateUser.html

@bflad
Copy link
Contributor

bflad commented Dec 20, 2018

@walterheck its implemented as a separate aws_transfer_ssh_key resource (see also #6932). This allows additional Terraform configurations such as allowing users to update their own SSH keys, but not necessarily have permissions to create/delete users as would be required with implementing the SSH key support in this resource.

@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-user 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.

3 participants