diff --git a/aws/resource_aws_cognito_user_pool.go b/aws/resource_aws_cognito_user_pool.go index ba9891b93d7..2d7f28e9fdb 100644 --- a/aws/resource_aws_cognito_user_pool.go +++ b/aws/resource_aws_cognito_user_pool.go @@ -163,6 +163,11 @@ func resourceAwsCognitoUserPool() *schema.Resource { ValidateFunc: validateCognitoUserPoolEmailVerificationMessage, }, + "endpoint": { + Type: schema.TypeString, + Computed: true, + }, + "lambda_config": { Type: schema.TypeList, Optional: true, @@ -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 { diff --git a/aws/resource_aws_cognito_user_pool_test.go b/aws/resource_aws_cognito_user_pool_test.go index 63f30501b0f..e5a94fc00c2 100644 --- a/aws/resource_aws_cognito_user_pool_test.go +++ b/aws/resource_aws_cognito_user_pool_test.go @@ -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"), diff --git a/website/docs/r/cognito_user_pool.markdown b/website/docs/r/cognito_user_pool.markdown index 4a4d395c97b..74b1bd0fd89 100644 --- a/website/docs/r/cognito_user_pool.markdown +++ b/website/docs/r/cognito_user_pool.markdown @@ -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. * `creation_date` - The date the user pool was created. * `last_modified_date` - The date the user pool was last modified.