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

r/aws_cognito_user: Fix resource recreation for pre-v5.56.0 resources imported with certain import IDs #38182

Merged
merged 5 commits into from
Jun 28, 2024

Conversation

ewbankkit
Copy link
Contributor

@ewbankkit ewbankkit commented Jun 28, 2024

Description

Prior to Terraform AWS Provider v5.56.0 the resource ID wasn't parsed during Read/Update/Delete -- the configured user_pool_id and username attributes were referenced directly.
This means that if a pre-existing resource had a resource ID that didn't match user_pool_id/username, after upgrading to v5.56.0 the resource would show as to-be-recreated in terraform plan.
This PR restores the functionality of referencing the attributes directly.

Relations

Closes #38175.
Relates #37024.

Output from Acceptance Testing

% make testacc TESTARGS='-run=TestAccCognitoIDPUser_' PKG=cognitoidp ACCTEST_PARALLELISM=3
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.4 test ./internal/service/cognitoidp/... -v -count 1 -parallel 3  -run=TestAccCognitoIDPUser_ -timeout 360m
=== RUN   TestAccCognitoIDPUser_basic
=== PAUSE TestAccCognitoIDPUser_basic
=== RUN   TestAccCognitoIDPUser_disappears
=== PAUSE TestAccCognitoIDPUser_disappears
=== RUN   TestAccCognitoIDPUser_temporaryPassword
=== PAUSE TestAccCognitoIDPUser_temporaryPassword
=== RUN   TestAccCognitoIDPUser_password
=== PAUSE TestAccCognitoIDPUser_password
=== RUN   TestAccCognitoIDPUser_attributes
=== PAUSE TestAccCognitoIDPUser_attributes
=== RUN   TestAccCognitoIDPUser_enabled
=== PAUSE TestAccCognitoIDPUser_enabled
=== RUN   TestAccCognitoIDPUser_v5560Regression
=== PAUSE TestAccCognitoIDPUser_v5560Regression
=== CONT  TestAccCognitoIDPUser_basic
=== CONT  TestAccCognitoIDPUser_attributes
=== CONT  TestAccCognitoIDPUser_v5560Regression
--- PASS: TestAccCognitoIDPUser_basic (27.75s)
=== CONT  TestAccCognitoIDPUser_temporaryPassword
--- PASS: TestAccCognitoIDPUser_attributes (35.87s)
=== CONT  TestAccCognitoIDPUser_password
--- PASS: TestAccCognitoIDPUser_v5560Regression (44.73s)
=== CONT  TestAccCognitoIDPUser_disappears
--- PASS: TestAccCognitoIDPUser_temporaryPassword (27.42s)
=== CONT  TestAccCognitoIDPUser_enabled
--- PASS: TestAccCognitoIDPUser_disappears (10.81s)
--- PASS: TestAccCognitoIDPUser_password (27.31s)
--- PASS: TestAccCognitoIDPUser_enabled (20.33s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/cognitoidp	79.931s

@ewbankkit ewbankkit requested a review from a team as a code owner June 28, 2024 13:17
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 size/M Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/cognitoidp Issues and PRs that pertain to the cognitoidp service. labels Jun 28, 2024
@terraform-aws-provider terraform-aws-provider bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Jun 28, 2024
Copy link
Contributor

@johnsonaj johnsonaj 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=TestAccCognitoIDPUser_' PKG=cognitoidp

make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.4 test ./internal/service/cognitoidp/... -v -count 1 -parallel 20  -run=TestAccCognitoIDPUser_ -timeout 360m
--- PASS: TestAccCognitoIDPUser_disappears (21.18s)
--- PASS: TestAccCognitoIDPUser_basic (23.64s)
--- PASS: TestAccCognitoIDPUser_enabled (35.49s)
--- PASS: TestAccCognitoIDPUser_attributes (36.57s)
--- PASS: TestAccCognitoIDPUser_v5560Regression (37.61s)
--- PASS: TestAccCognitoIDPUser_password (46.75s)
--- PASS: TestAccCognitoIDPUser_temporaryPassword (46.86s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/cognitoidp	52.444s

@ewbankkit ewbankkit merged commit e6b88f2 into main Jun 28, 2024
65 checks passed
@ewbankkit ewbankkit deleted the b-aws_cognito_user-regression branch June 28, 2024 14:57
@github-actions github-actions bot added this to the v5.57.0 milestone Jun 28, 2024
terraform-aws-provider bot pushed a commit that referenced this pull request Jun 28, 2024
Copy link

This functionality has been released in v5.56.1 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 github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Jun 28, 2024
Copy link

github-actions bot commented Aug 1, 2024

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 Aug 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/cognitoidp Issues and PRs that pertain to the cognitoidp service. size/M 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.

[Bug]: Cognito user must be replaced after provider upgrade
2 participants