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 aws_cognito_user resource #19919

Merged
merged 39 commits into from
Feb 2, 2022
Merged

Conversation

rtim75
Copy link
Contributor

@rtim75 rtim75 commented Jun 22, 2021

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Closes #4542

Output from acceptance testing:

make testacc PKG_NAME=internal/service/cognitoidp TESTARGS='-run=TestAccCognitoUser'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/cognitoidp/... -v -count 1 -parallel 20 -run=TestAccCognitoUser -timeout 180m
=== RUN   TestAccCognitoUser_basic
=== PAUSE TestAccCognitoUser_basic
=== RUN   TestAccCognitoUser_disappears
=== PAUSE TestAccCognitoUser_disappears
=== RUN   TestAccCognitoUser_temporaryPassword
=== PAUSE TestAccCognitoUser_temporaryPassword
=== RUN   TestAccCognitoUser_password
=== PAUSE TestAccCognitoUser_password
=== RUN   TestAccCognitoUser_attributes
=== PAUSE TestAccCognitoUser_attributes
=== RUN   TestAccCognitoUser_enabled
=== PAUSE TestAccCognitoUser_enabled
=== CONT  TestAccCognitoUser_basic
=== CONT  TestAccCognitoUser_attributes
=== CONT  TestAccCognitoUser_password
=== CONT  TestAccCognitoUser_disappears
=== CONT  TestAccCognitoUser_enabled
=== CONT  TestAccCognitoUser_temporaryPassword
--- PASS: TestAccCognitoUser_disappears (51.18s)
--- PASS: TestAccCognitoUser_basic (61.03s)
--- PASS: TestAccCognitoUser_enabled (99.19s)
--- PASS: TestAccCognitoUser_attributes (99.97s)
--- PASS: TestAccCognitoUser_temporaryPassword (137.58s)
--- PASS: TestAccCognitoUser_password (138.89s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/cognitoidp 140.789s

Only user-attributes are currently supported
@github-actions github-actions bot added provider Pertains to the provider itself, rather than any interaction with AWS. service/cognito size/L Managed by automation to categorize the size of a PR. needs-triage Waiting for first response or review from a maintainer. labels Jun 22, 2021
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Welcome @rtim75 👋

It looks like this is your first Pull Request submission to the Terraform AWS Provider! If you haven’t already done so please make sure you have checked out our CONTRIBUTING guide and FAQ to make sure your contribution is adhering to best practice and has all the necessary elements in place for a successful approval.

Also take a look at our FAQ which details how we prioritize Pull Requests for inclusion.

Thanks again, and welcome to the community! 😃

@rtim75
Copy link
Contributor Author

rtim75 commented Jun 22, 2021

Another thing I'm not sure about is client_metadata attribute in the inputs.

I'm thinking about adding it with ForceNew attribute.

@github-actions github-actions bot added size/XL Managed by automation to categorize the size of a PR. and removed size/L Managed by automation to categorize the size of a PR. labels Aug 14, 2021
@tomelliot16
Copy link

Any status update on this?

@breathingdust breathingdust added new-resource Introduces a new resource. and removed needs-triage Waiting for first response or review from a maintainer. labels Sep 3, 2021
@rtim75
Copy link
Contributor Author

rtim75 commented Sep 3, 2021

Any status update on this?

Hey, as you probably have noticed I've been working very slowly on this one. I will try to finish at least the main resource(aws_cognito_user) in the near future. From there things should go quicker.

aws/provider.go Outdated Show resolved Hide resolved
pjroth pushed a commit to pjroth/terraform-provider-aws that referenced this pull request Oct 11, 2021
Renamed resource to aws_cognito_user_pool_user

PR: hashicorp#19919
Issue: hashicorp#4542
@rtim75
Copy link
Contributor Author

rtim75 commented Oct 12, 2021

TODO:

  • User password
  • MFA Preferences
  • User settings the action in the link is deprecated
  • Handle custom user attributes to allow not specifying custom: prefix (cognitoUserPoolSchemaAttributeMatchesStandardAttribute in aws_cognito_user_pool)
  • Data source if it should be implemented, a separate PR might be the better option, I think
  • Acceptance tests
  • Documentation

@pjroth
Copy link

pjroth commented Oct 13, 2021

@rtim75 in case you were unaware, it looks like updating the changelog is required per PR guidelines changelog process. Just in case you were unaware of this I wanted to point it out since I didn't see it explicitly on the TODO list.

Thanks for all your work on this!

@github-actions github-actions bot removed the waiting-response Maintainers are waiting on response from community or contributor. label Dec 9, 2021
@gdavison
Copy link
Contributor

gdavison commented Dec 9, 2021

Testing of the client-side arguments can get challenging, since many of them are handled by a Lambda function that's a part of an authentication/authorization system, and it could be implementation-dependent. For the most part, we rely on the AWS API catching major errors.

For implementation in Terraform, in general we try to match the AWS API structures. Sometimes this can end up looking a little strange, like the MFA information. However, it makes dealing with changes on the AWS side easier, for example if they added another MFA contact method, they could just add an item to the list, instead of needing to add another Boolean parameter.

@gdavison
Copy link
Contributor

gdavison commented Dec 9, 2021

For the timestamp fields, I would include them for consistency with the other resources.

This ensures that the attributes array is fully saved in state while
suppressing changes to delete the "sub" attribute, which all cognito
users have.
@rtim75 rtim75 requested a review from gdavison December 15, 2021 08:42
@rtim75
Copy link
Contributor Author

rtim75 commented Jan 20, 2022

@gdavison The PR is ready for the second review. All the discussions have been resolved. The only failing action is caused by resources unrelated to this PR.

@cemo
Copy link

cemo commented Feb 2, 2022

Gentle ping @gdavison :) We desperately need this PR

Copy link
Contributor

@gdavison gdavison left a comment

Choose a reason for hiding this comment

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

Looks good! 🚀

--- PASS: TestAccCognitoUser_disappears (40.50s)
--- PASS: TestAccCognitoUser_basic (46.74s)
--- PASS: TestAccCognitoUser_enabled (68.43s)
--- PASS: TestAccCognitoUser_attributes (69.27s)
--- PASS: TestAccCognitoUser_password (86.09s)
--- PASS: TestAccCognitoUser_temporaryPassword (86.16s)

@gdavison gdavison merged commit de950a3 into hashicorp:main Feb 2, 2022
@github-actions github-actions bot modified the milestones: Roadmap, v4.0.0 Feb 2, 2022
@pjroth
Copy link

pjroth commented Feb 3, 2022

Thanks so much @rtim75 for adding this! I'm looking forward to being able to use this soon!

@github-actions
Copy link

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

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 20, 2022
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. 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.

Add aws_cognito_user resource
7 participants