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

elasticache: Add new user_group_association resource #24204

Merged
merged 9 commits into from
Apr 13, 2022

Conversation

YakDriver
Copy link
Member

@YakDriver YakDriver commented Apr 12, 2022

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 #22870

Output from acceptance testing:

% make testacc TESTS=TestAccElastiCacheUserGroupAssociation_ PKG=elasticache
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/elasticache/... -v -count 1 -parallel 20 -run='TestAccElastiCacheUserGroupAssociation_'  -timeout 180m
--- PASS: TestAccElastiCacheUserGroupAssociation_disappears (317.57s)
--- PASS: TestAccElastiCacheUserGroupAssociation_basic (319.27s)
--- PASS: TestAccElastiCacheUserGroupAssociation_update (440.51s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/elasticache	441.786s

@github-actions github-actions bot added size/XL Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. provider Pertains to the provider itself, rather than any interaction with AWS. service/elasticache Issues and PRs that pertain to the elasticache service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Apr 12, 2022
@github-actions github-actions bot added github_actions Pull requests that update Github_actions code repository Repository modifications; GitHub Actions, developer docs, issue templates, codeowners, changelog. labels Apr 12, 2022
@github-actions github-actions bot added the linter Pertains to changes to or issues with the various linters. label Apr 12, 2022
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.

A couple comments, but looks good 🚀

--- PASS: TestAccElastiCacheUserGroupAssociation_basic (283.63s)
--- PASS: TestAccElastiCacheUserGroupAssociation_disappears (287.29s)
--- PASS: TestAccElastiCacheUserGroupAssociation_update (414.01s)

Comment on lines +97 to +103
gotUserID := ""
for _, v := range output.UserIds {
if aws.StringValue(v) == userID {
gotUserID = aws.StringValue(v)
break
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

We should handle the unlikely case where the user ID isn't included

Timeout: d.Timeout(schema.TimeoutCreate),
MinTimeout: 10 * time.Second,
NotFoundChecks: 5,
Delay: 30 * time.Second, // Wait 30 secs before starting
Copy link
Contributor

Choose a reason for hiding this comment

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

Waiting 30 seconds for the first check and 10 seconds between checks seems like a long delay

id := userGroupAssociationID(d.Get("user_group_id").(string), d.Get("user_id").(string))

_, err := tfresource.RetryWhenNotFound(d.Timeout(schema.TimeoutCreate), func() (interface{}, error) {
return conn.ModifyUserGroup(input)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a risk of a race condition if we're creating or deleting many users at the same time?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hopefully it will be lessened by the user group existing first. Maybe modifying is more race resilient? I lowered the timeout which should help it not race for as long if it does.

@github-actions github-actions bot removed github_actions Pull requests that update Github_actions code linter Pertains to changes to or issues with the various linters. repository Repository modifications; GitHub Actions, developer docs, issue templates, codeowners, changelog. labels Apr 13, 2022
@github-actions github-actions bot added github_actions Pull requests that update Github_actions code linter Pertains to changes to or issues with the various linters. repository Repository modifications; GitHub Actions, developer docs, issue templates, codeowners, changelog. labels Apr 13, 2022
@YakDriver YakDriver merged commit b4b1ed1 into main Apr 13, 2022
@YakDriver YakDriver deleted the f-add-usergroupid-elasticache-user branch April 13, 2022 02:06
@github-actions github-actions bot added this to the v4.10.0 milestone Apr 13, 2022
github-actions bot pushed a commit that referenced this pull request Apr 13, 2022
@github-actions
Copy link

This functionality has been released in v4.10.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 17, 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. github_actions Pull requests that update Github_actions code linter Pertains to changes to or issues with the various linters. provider Pertains to the provider itself, rather than any interaction with AWS. repository Repository modifications; GitHub Actions, developer docs, issue templates, codeowners, changelog. service/elasticache Issues and PRs that pertain to the elasticache 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.

Add user_group_id to aws_elasticache_user
2 participants