-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
New Resource: aws_cognito_user_group #3010
Conversation
d25709b
to
18c2091
Compare
|
18c2091
to
8c14196
Compare
Hi, thanks for adding cognito groups! I was preparing similar pull request (#3025). Please consider possibility to apply the following changes to your PR:
Please check my PR for example of all points, except the very last one. |
@GreenSmile Hey, sorry, I had added the docs and validation during the week but while I was on the train without internet and apparently forgot to push until I just saw your comment. I'll go through your review comments now, thanks for the comments, particularly on the Id which is a good catch that I didn't think about clearly enough because the API docs states that it has to be unique but in hindsight it clearly means unique for the user pool. |
Also added debug output as per pull request feedback.
b2faf82
to
abf8f48
Compare
@GreenSmile I think I've covered everything you talked about but some in slightly different ways to how you approached things by the looks of it, especially around the import. I'm unsure about changing from Tests seem okay and I've done a bit of manual testing as well:
I've seen the merge conflict on the validators but will leave it for now until there's been a review and then I'll fix that merge conflict. |
e905bb6
to
5888299
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @tomelliff
thanks for this PR.
This is looking pretty good! Just a few comments, two of which (about names used in tests) I'd certainly want to be addressed prior to merging.
func TestAccAWSCognitoUserGroup_basic(t *testing.T) { | ||
poolName := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum) | ||
groupName := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum) | ||
updatedGroupName := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mind prepending a unique fixed prefix to each name? e.g. tf_acc_
? This is to make it easy/possible to cleanup any potentially leaked resources from the test and make it easier to identify those leaks in general.
func TestAccAWSCognitoUserGroup_complex(t *testing.T) { | ||
poolName := fmt.Sprintf("%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)) | ||
groupName := fmt.Sprintf("%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)) | ||
updatedGroupName := fmt.Sprintf("%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^ likewise
} | ||
|
||
resource "aws_cognito_user_group" "main" { | ||
name = "user-group-%s" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: It's usually better to keep the whole name (incl. the prefix like user-group-
here) in the test body as we may then reference it in checks, instead of rebuilding it again. 😉
|
||
"github.com/aws/aws-sdk-go/aws" | ||
"github.com/aws/aws-sdk-go/service/cognitoidentityprovider" | ||
"github.com/hashicorp/errwrap" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: I know it's used all over the AWS provider at the moment, but in most places for no particular reason. The library is intended to address the problem of wrapping errors into errors so that we can retain all data about the original error. Here we're just wrapping errors to print them out later. In other words I think we don't need this library unless we use Contains()
or ContainsType()
per https://github.com/hashicorp/errwrap#usage
Conflicts: aws/validators_test.go
@radeksimko Thanks for the review. Think I've covered those points now and I've fixed the merge conflict on the validators_test as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks.
This has been released in terraform-provider-aws version 1.9.0. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
https://www.terraform.io/docs/providers/aws/r/cognito_user_group.html - the documentation page looks a bit messed up for this feature. It isn't rendering the index sidebar and has some raw text at the top. |
@jayanderson Thanks for noticing. See #3411 |
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! |
Added support for AWS Cognito User Groups.
Should close #2865 and I think might be the last thing left on #232