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 endpoint attribute to cognito_user_pool #4718

Merged
merged 1 commit into from
Jun 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions aws/resource_aws_cognito_user_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ func resourceAwsCognitoUserPool() *schema.Resource {
ValidateFunc: validateCognitoUserPoolEmailVerificationMessage,
},

"endpoint": {
Type: schema.TypeString,
Computed: true,
},

"lambda_config": {
Type: schema.TypeList,
Optional: true,
Expand Down Expand Up @@ -655,6 +660,7 @@ func resourceAwsCognitoUserPoolRead(d *schema.ResourceData, meta interface{}) er
Resource: fmt.Sprintf("userpool/%s", d.Id()),
}
d.Set("arn", arn.String())
d.Set("endpoint", fmt.Sprintf("cognito-idp.%s.amazonaws.com/%s", meta.(*AWSClient).region, d.Id()))
d.Set("auto_verified_attributes", flattenStringList(resp.UserPool.AutoVerifiedAttributes))

if resp.UserPool.EmailVerificationSubject != nil {
Expand Down
2 changes: 2 additions & 0 deletions aws/resource_aws_cognito_user_pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ func TestAccAWSCognitoUserPool_basic(t *testing.T) {
testAccCheckAWSCognitoUserPoolExists("aws_cognito_user_pool.pool"),
resource.TestMatchResourceAttr("aws_cognito_user_pool.pool", "arn",
regexp.MustCompile("^arn:aws:cognito-idp:[^:]+:[0-9]{12}:userpool/[\\w-]+_[0-9a-zA-Z]+$")),
resource.TestMatchResourceAttr("aws_cognito_user_pool.pool", "endpoint",
regexp.MustCompile("^cognito-idp\\.[^.]+\\.amazonaws.com/[\\w-]+_[0-9a-zA-Z]+$")),
resource.TestCheckResourceAttr("aws_cognito_user_pool.pool", "name", "terraform-test-pool-"+name),
resource.TestCheckResourceAttrSet("aws_cognito_user_pool.pool", "creation_date"),
resource.TestCheckResourceAttrSet("aws_cognito_user_pool.pool", "last_modified_date"),
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/cognito_user_pool.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ The following additional attributes are exported:

* `id` - The id of the user pool.
* `arn` - The ARN of the user pool.
* `endpoint` - The endpoint name of the user pool.
Copy link
Contributor

Choose a reason for hiding this comment

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

Since the Cognito documentation does not signify what this attribute's value might be we should include an example of what is meant here, e.g. Example: cognito-idp.us-east-1.amazonaws.com/xxxx_yyyyy

* `creation_date` - The date the user pool was created.
* `last_modified_date` - The date the user pool was last modified.

Expand Down