Terraform-provider-aws: Wrong aws_transfer_user user_name validation

Created on 25 Mar 2019  ·  6Comments  ·  Source: hashicorp/terraform-provider-aws

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

Terraform v0.11.7
+ provider.aws v2.3.0

Affected Resource(s)

  • aws_transfer_user

Terraform Configuration Files

resource "aws_transfer_user" "user" {
  server_id      = "s-0123456789abcdef0"
  user_name      = "user_name"
  role           = "arn:aws:iam::123456789012:role/transfer"
  home_directory = "/bucket/path"
}

Debug Output

Panic Output

Expected Behavior

Terraform creates the user

 + aws_transfer_user.user
      id:             <computed>
      arn:            <computed>
      home_directory: "/bucket/path"
      role:           "arn:aws:iam::123456789012:role/transfer"
      server_id:      "s-0123456789abcdef0"
      user_name:      "user_name"

Actual Behavior

Terraform fails to create users containing an underscore in the name

Error: aws_transfer_user.user: "user_name" isn't a valid transfer user name (only lowercase alphanumeric characters are allowed): "user_name"

Steps to Reproduce

  1. terraform plan

Important Factoids

References

AWS updated their user_name validation. Users with hypens and underscores are valid now.
2019-03-25_11:10:21

enhancement good first issue servictransfer

All 6 comments

Hi @Skardian thanks for reporting this issue. It looks like we just need to update the ValidateFunc for the username attribute. I’m going to mark this as an enhancement request. Please keep an eye on the issue for updates.

https://github.com/terraform-providers/terraform-provider-aws/blob/06544e694b50c3d98060e50ecb009b17146ed289/aws/validators.go#L99

AWS SDK v1.19.3:

This release also relaxes the SFTP user name requirements to allow underscores and hyphens.

PR opened #8304

Support for uppercase letter, hyphens, and underscores in aws_transfer_user user names to match the new AWS support has been merged and will release with version 2.8.0 of the Terraform AWS Provider, likely later this week.

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

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!

Was this page helpful?
0 / 5 - 0 ratings