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

feat: Add password_policy.password_history_size arg for aws_cognito_user_pool #39043

Conversation

acwwat
Copy link
Contributor

@acwwat acwwat commented Aug 27, 2024

Description

This PR is to add a new argument password_history_size to the password_policy configuration block for the aws_cognito_user_pool to implement the Password reuse prevention feature.

Relations

Closes #39016

References

Referred to PasswordPolicyType for specs and wordings for documentation.

Output from Acceptance Testing

$ make testacc TESTS"=TestAccCognitoIDPUserPool_passwordHistorySize|TestAccCognitoIDPUserPool_basic|TestAccCognitoIDPUserPool_withAdminCreateUserAndPasswordPolicy" PKG=cognitoidp
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.6 test ./internal/service/cognitoidp/... -v -count 1 -parallel 20 -run='TestAccCognitoIDPUserPool_passwordHistorySize|TestAccCognitoIDPUserPool_basic|TestAccCognitoIDPUserPool_withAdminCreateUserAndPasswordPolicy'  -timeout 360m
=== RUN   TestAccCognitoIDPUserPool_basic
=== PAUSE TestAccCognitoIDPUserPool_basic
=== RUN   TestAccCognitoIDPUserPool_withAdminCreateUserAndPasswordPolicy
=== PAUSE TestAccCognitoIDPUserPool_withAdminCreateUserAndPasswordPolicy
=== CONT  TestAccCognitoIDPUserPool_passwordHistorySize
=== CONT  TestAccCognitoIDPUserPool_withAdminCreateUserAndPasswordPolicy     
--- PASS: TestAccCognitoIDPUserPool_basic (20.55s)
--- PASS: TestAccCognitoIDPUserPool_withAdminCreateUserAndPasswordPolicy (20.55s)
--- PASS: TestAccCognitoIDPUserPool_passwordHistorySize (31.00s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/cognitoidp 31.320s

$

@acwwat acwwat requested a review from a team as a code owner August 27, 2024 03:22
Copy link

Community Note

Voting for Prioritization

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

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/cognitoidp Issues and PRs that pertain to the cognitoidp service. needs-triage Waiting for first response or review from a maintainer. external-maintainer Contribution from a trusted external contributor. labels Aug 27, 2024
@acwwat acwwat force-pushed the f-aws_cognito_user_pool-add_password_history_size_arg branch from 998a447 to 557d1b0 Compare August 27, 2024 03:26
@ewbankkit ewbankkit removed the needs-triage Waiting for first response or review from a maintainer. label Aug 27, 2024
@ewbankkit ewbankkit self-assigned this Aug 27, 2024
@github-actions github-actions bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Aug 27, 2024
Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

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

LGTM 🚀.

% make testacc TESTARGS='-run=TestAccCognitoIDPUserPool_' PKG=cognitoidp ACCTEST_PARALLELISM=3
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.6 test ./internal/service/cognitoidp/... -v -count 1 -parallel 3  -run=TestAccCognitoIDPUserPool_ -timeout 360m
=== RUN   TestAccCognitoIDPUserPool_basic
=== PAUSE TestAccCognitoIDPUserPool_basic
=== RUN   TestAccCognitoIDPUserPool_deletionProtection
=== PAUSE TestAccCognitoIDPUserPool_deletionProtection
=== RUN   TestAccCognitoIDPUserPool_recovery
=== PAUSE TestAccCognitoIDPUserPool_recovery
=== RUN   TestAccCognitoIDPUserPool_withAdminCreateUser
=== PAUSE TestAccCognitoIDPUserPool_withAdminCreateUser
=== RUN   TestAccCognitoIDPUserPool_withAdminCreateUserAndPasswordPolicy
=== PAUSE TestAccCognitoIDPUserPool_withAdminCreateUserAndPasswordPolicy
=== RUN   TestAccCognitoIDPUserPool_withAdvancedSecurityMode
=== PAUSE TestAccCognitoIDPUserPool_withAdvancedSecurityMode
=== RUN   TestAccCognitoIDPUserPool_withDevice
=== PAUSE TestAccCognitoIDPUserPool_withDevice
=== RUN   TestAccCognitoIDPUserPool_withEmailVerificationMessage
=== PAUSE TestAccCognitoIDPUserPool_withEmailVerificationMessage
=== RUN   TestAccCognitoIDPUserPool_passwordHistorySize
=== PAUSE TestAccCognitoIDPUserPool_passwordHistorySize
=== RUN   TestAccCognitoIDPUserPool_MFA_sms
=== PAUSE TestAccCognitoIDPUserPool_MFA_sms
=== RUN   TestAccCognitoIDPUserPool_MFA_smsAndSoftwareTokenMFA
=== PAUSE TestAccCognitoIDPUserPool_MFA_smsAndSoftwareTokenMFA
=== RUN   TestAccCognitoIDPUserPool_MFA_smsToSoftwareTokenMFA
=== PAUSE TestAccCognitoIDPUserPool_MFA_smsToSoftwareTokenMFA
=== RUN   TestAccCognitoIDPUserPool_MFA_softwareTokenMFA
=== PAUSE TestAccCognitoIDPUserPool_MFA_softwareTokenMFA
=== RUN   TestAccCognitoIDPUserPool_MFA_softwareTokenMFAToSMS
=== PAUSE TestAccCognitoIDPUserPool_MFA_softwareTokenMFAToSMS
=== RUN   TestAccCognitoIDPUserPool_smsAuthenticationMessage
=== PAUSE TestAccCognitoIDPUserPool_smsAuthenticationMessage
=== RUN   TestAccCognitoIDPUserPool_sms
=== PAUSE TestAccCognitoIDPUserPool_sms
=== RUN   TestAccCognitoIDPUserPool_SMS_snsRegion
=== PAUSE TestAccCognitoIDPUserPool_SMS_snsRegion
=== RUN   TestAccCognitoIDPUserPool_SMS_externalID
=== PAUSE TestAccCognitoIDPUserPool_SMS_externalID
=== RUN   TestAccCognitoIDPUserPool_SMS_snsCallerARN
=== PAUSE TestAccCognitoIDPUserPool_SMS_snsCallerARN
=== RUN   TestAccCognitoIDPUserPool_smsVerificationMessage
=== PAUSE TestAccCognitoIDPUserPool_smsVerificationMessage
=== RUN   TestAccCognitoIDPUserPool_withEmail
=== PAUSE TestAccCognitoIDPUserPool_withEmail
=== RUN   TestAccCognitoIDPUserPool_withEmailSource
    user_pool_test.go:922: Environment variable TEST_AWS_SES_VERIFIED_EMAIL_ARN is not set, skipping test
--- SKIP: TestAccCognitoIDPUserPool_withEmailSource (0.00s)
=== RUN   TestAccCognitoIDPUserPool_tags
=== PAUSE TestAccCognitoIDPUserPool_tags
=== RUN   TestAccCognitoIDPUserPool_withAliasAttributes
=== PAUSE TestAccCognitoIDPUserPool_withAliasAttributes
=== RUN   TestAccCognitoIDPUserPool_withUsernameAttributes
=== PAUSE TestAccCognitoIDPUserPool_withUsernameAttributes
=== RUN   TestAccCognitoIDPUserPool_withPasswordPolicy
=== PAUSE TestAccCognitoIDPUserPool_withPasswordPolicy
=== RUN   TestAccCognitoIDPUserPool_withUsername
=== PAUSE TestAccCognitoIDPUserPool_withUsername
=== RUN   TestAccCognitoIDPUserPool_withLambda
=== PAUSE TestAccCognitoIDPUserPool_withLambda
=== RUN   TestAccCognitoIDPUserPool_WithLambda_email
=== PAUSE TestAccCognitoIDPUserPool_WithLambda_email
=== RUN   TestAccCognitoIDPUserPool_WithLambda_sms
=== PAUSE TestAccCognitoIDPUserPool_WithLambda_sms
=== RUN   TestAccCognitoIDPUserPool_WithLambda_preGenerationTokenConfig
=== PAUSE TestAccCognitoIDPUserPool_WithLambda_preGenerationTokenConfig
=== RUN   TestAccCognitoIDPUserPool_addLambda
=== PAUSE TestAccCognitoIDPUserPool_addLambda
=== RUN   TestAccCognitoIDPUserPool_schemaAttributes
=== PAUSE TestAccCognitoIDPUserPool_schemaAttributes
=== RUN   TestAccCognitoIDPUserPool_schemaAttributesRemoved
=== PAUSE TestAccCognitoIDPUserPool_schemaAttributesRemoved
=== RUN   TestAccCognitoIDPUserPool_schemaAttributesModified
=== PAUSE TestAccCognitoIDPUserPool_schemaAttributesModified
=== RUN   TestAccCognitoIDPUserPool_schemaAttributesStringAttributeConstraints
=== PAUSE TestAccCognitoIDPUserPool_schemaAttributesStringAttributeConstraints
=== RUN   TestAccCognitoIDPUserPool_withVerificationMessageTemplate
=== PAUSE TestAccCognitoIDPUserPool_withVerificationMessageTemplate
=== RUN   TestAccCognitoIDPUserPool_withVerificationMessageTemplateUTF8
=== PAUSE TestAccCognitoIDPUserPool_withVerificationMessageTemplateUTF8
=== RUN   TestAccCognitoIDPUserPool_update
=== PAUSE TestAccCognitoIDPUserPool_update
=== RUN   TestAccCognitoIDPUserPool_disappears
=== PAUSE TestAccCognitoIDPUserPool_disappears
=== RUN   TestAccCognitoIDPUserPool_withUserAttributeUpdateSettings
=== PAUSE TestAccCognitoIDPUserPool_withUserAttributeUpdateSettings
=== CONT  TestAccCognitoIDPUserPool_basic
=== CONT  TestAccCognitoIDPUserPool_withEmail
=== CONT  TestAccCognitoIDPUserPool_MFA_smsAndSoftwareTokenMFA
--- PASS: TestAccCognitoIDPUserPool_withEmail (12.91s)
=== CONT  TestAccCognitoIDPUserPool_addLambda
--- PASS: TestAccCognitoIDPUserPool_basic (13.32s)
=== CONT  TestAccCognitoIDPUserPool_withUserAttributeUpdateSettings
--- PASS: TestAccCognitoIDPUserPool_withUserAttributeUpdateSettings (17.12s)
=== CONT  TestAccCognitoIDPUserPool_withVerificationMessageTemplate
--- PASS: TestAccCognitoIDPUserPool_MFA_smsAndSoftwareTokenMFA (35.17s)
=== CONT  TestAccCognitoIDPUserPool_disappears
--- PASS: TestAccCognitoIDPUserPool_disappears (10.19s)
=== CONT  TestAccCognitoIDPUserPool_update
--- PASS: TestAccCognitoIDPUserPool_addLambda (36.33s)
=== CONT  TestAccCognitoIDPUserPool_withVerificationMessageTemplateUTF8
--- PASS: TestAccCognitoIDPUserPool_withVerificationMessageTemplate (19.03s)
=== CONT  TestAccCognitoIDPUserPool_withUsername
--- PASS: TestAccCognitoIDPUserPool_withVerificationMessageTemplateUTF8 (19.96s)
=== CONT  TestAccCognitoIDPUserPool_WithLambda_preGenerationTokenConfig
--- PASS: TestAccCognitoIDPUserPool_withUsername (20.30s)
=== CONT  TestAccCognitoIDPUserPool_WithLambda_sms
--- PASS: TestAccCognitoIDPUserPool_update (42.66s)
=== CONT  TestAccCognitoIDPUserPool_WithLambda_email
--- PASS: TestAccCognitoIDPUserPool_WithLambda_preGenerationTokenConfig (55.98s)
=== CONT  TestAccCognitoIDPUserPool_withLambda
--- PASS: TestAccCognitoIDPUserPool_WithLambda_sms (62.92s)
=== CONT  TestAccCognitoIDPUserPool_withAdvancedSecurityMode
--- PASS: TestAccCognitoIDPUserPool_WithLambda_email (50.65s)
=== CONT  TestAccCognitoIDPUserPool_sms
--- PASS: TestAccCognitoIDPUserPool_withAdvancedSecurityMode (26.03s)
=== CONT  TestAccCognitoIDPUserPool_MFA_sms
--- PASS: TestAccCognitoIDPUserPool_sms (36.31s)
=== CONT  TestAccCognitoIDPUserPool_smsVerificationMessage
--- PASS: TestAccCognitoIDPUserPool_withLambda (50.74s)
=== CONT  TestAccCognitoIDPUserPool_passwordHistorySize
--- PASS: TestAccCognitoIDPUserPool_smsVerificationMessage (18.71s)
=== CONT  TestAccCognitoIDPUserPool_SMS_snsCallerARN
--- PASS: TestAccCognitoIDPUserPool_passwordHistorySize (19.09s)
=== CONT  TestAccCognitoIDPUserPool_withEmailVerificationMessage
--- PASS: TestAccCognitoIDPUserPool_MFA_sms (47.69s)
=== CONT  TestAccCognitoIDPUserPool_SMS_externalID
--- PASS: TestAccCognitoIDPUserPool_withEmailVerificationMessage (19.07s)
=== CONT  TestAccCognitoIDPUserPool_withDevice
--- PASS: TestAccCognitoIDPUserPool_withDevice (19.86s)
=== CONT  TestAccCognitoIDPUserPool_SMS_snsRegion
--- PASS: TestAccCognitoIDPUserPool_SMS_snsCallerARN (40.81s)
=== CONT  TestAccCognitoIDPUserPool_withAdminCreateUser
--- PASS: TestAccCognitoIDPUserPool_SMS_externalID (39.99s)
=== CONT  TestAccCognitoIDPUserPool_schemaAttributesModified
--- PASS: TestAccCognitoIDPUserPool_withAdminCreateUser (18.84s)
=== CONT  TestAccCognitoIDPUserPool_withAdminCreateUserAndPasswordPolicy
--- PASS: TestAccCognitoIDPUserPool_SMS_snsRegion (23.15s)
=== CONT  TestAccCognitoIDPUserPool_schemaAttributes
--- PASS: TestAccCognitoIDPUserPool_schemaAttributesModified (12.36s)
=== CONT  TestAccCognitoIDPUserPool_recovery
--- PASS: TestAccCognitoIDPUserPool_withAdminCreateUserAndPasswordPolicy (12.35s)
=== CONT  TestAccCognitoIDPUserPool_withUsernameAttributes
--- PASS: TestAccCognitoIDPUserPool_schemaAttributes (19.47s)
=== CONT  TestAccCognitoIDPUserPool_MFA_softwareTokenMFAToSMS
--- PASS: TestAccCognitoIDPUserPool_withUsernameAttributes (19.59s)
=== CONT  TestAccCognitoIDPUserPool_withPasswordPolicy
--- PASS: TestAccCognitoIDPUserPool_recovery (26.85s)
=== CONT  TestAccCognitoIDPUserPool_smsAuthenticationMessage
--- PASS: TestAccCognitoIDPUserPool_withPasswordPolicy (19.26s)
=== CONT  TestAccCognitoIDPUserPool_withAliasAttributes
--- PASS: TestAccCognitoIDPUserPool_smsAuthenticationMessage (19.41s)
=== CONT  TestAccCognitoIDPUserPool_deletionProtection
--- PASS: TestAccCognitoIDPUserPool_MFA_softwareTokenMFAToSMS (30.13s)
=== CONT  TestAccCognitoIDPUserPool_MFA_smsToSoftwareTokenMFA
--- PASS: TestAccCognitoIDPUserPool_withAliasAttributes (19.70s)
=== CONT  TestAccCognitoIDPUserPool_schemaAttributesRemoved
--- PASS: TestAccCognitoIDPUserPool_deletionProtection (19.26s)
=== CONT  TestAccCognitoIDPUserPool_schemaAttributesStringAttributeConstraints
--- PASS: TestAccCognitoIDPUserPool_schemaAttributesRemoved (12.24s)
=== CONT  TestAccCognitoIDPUserPool_MFA_softwareTokenMFA
--- PASS: TestAccCognitoIDPUserPool_schemaAttributesStringAttributeConstraints (12.83s)
=== CONT  TestAccCognitoIDPUserPool_tags
--- PASS: TestAccCognitoIDPUserPool_MFA_smsToSoftwareTokenMFA (31.63s)
--- PASS: TestAccCognitoIDPUserPool_MFA_softwareTokenMFA (26.78s)
--- PASS: TestAccCognitoIDPUserPool_tags (26.23s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/cognitoidp	368.455s

@ewbankkit
Copy link
Contributor

@acwwat Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit d59bd5c into hashicorp:main Aug 27, 2024
45 checks passed
@github-actions github-actions bot added this to the v5.65.0 milestone Aug 27, 2024
@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Aug 29, 2024
Copy link

This functionality has been released in v5.65.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!

@acwwat acwwat deleted the f-aws_cognito_user_pool-add_password_history_size_arg branch September 16, 2024 00:12
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 Oct 16, 2024
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. external-maintainer Contribution from a trusted external contributor. service/cognitoidp Issues and PRs that pertain to the cognitoidp service. 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.

[Enhancement]: aws_cognito_user_pool.password_policy.Allow_reuse_of_previous_passwords
2 participants