Skip to content

Commit

Permalink
Merge pull request #41188 from acwwat/d-aws_cognito_managed_user_pool…
Browse files Browse the repository at this point in the history
…_client-clarify_name_args

docs: Clarify usage of name_pattern and name_prefix args for aws_cognito_managed_user_pool_client
  • Loading branch information
ewbankkit authored Feb 3, 2025
2 parents 4dcdcdd + 80ff30b commit a5dd2b0
Showing 1 changed file with 30 additions and 6 deletions.
36 changes: 30 additions & 6 deletions website/docs/r/cognito_managed_user_pool_client.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,28 @@ Use the [`aws_cognito_user_pool_client`](cognito_user_pool_client.html) resource

## Example Usage

### Using Name Prefix

```terraform
resource "aws_cognito_managed_user_pool_client" "example" {
name_prefix = "AmazonOpenSearchService-example"
# Generated client name example: AmazonOpenSearchService-example-abcde-us-east-1-2ni6nt4id5tg25yde3pztiqkd4
name_prefix = "AmazonOpenSearchService-example-"
user_pool_id = aws_cognito_user_pool.example.id
depends_on = [
aws_opensearch_domain.example,
aws_opensearch_domain.example
]
}
resource "aws_cognito_user_pool" "example" {
name = "example"
}
resource "aws_cognito_user_pool_domain" "example" {
domain = "example"
user_pool_id = aws_cognito_user_pool.example.id
}
resource "aws_cognito_identity_pool" "example" {
identity_pool_name = "example"
Expand All @@ -57,7 +65,7 @@ resource "aws_opensearch_domain" "example" {
depends_on = [
aws_cognito_user_pool_domain.example,
aws_iam_role_policy_attachment.example,
aws_iam_role_policy_attachment.example
]
}
Expand All @@ -76,7 +84,7 @@ data "aws_iam_policy_document" "example" {
principals {
type = "Service"
identifiers = [
"es.${data.aws_partition.current.dns_suffix}",
"es.${data.aws_partition.current.dns_suffix}"
]
}
}
Expand All @@ -85,18 +93,34 @@ data "aws_iam_policy_document" "example" {
resource "aws_iam_role_policy_attachment" "example" {
role = aws_iam_role.example.name
policy_arn = "arn:${data.aws_partition.current.partition}:iam::aws:policy/AmazonESCognitoAccess"
depends_on = [
aws_opensearch_domain.example
]
}
data "aws_partition" "current" {}
```

### Using Name Pattern

```terraform
resource "aws_cognito_managed_user_pool_client" "example" {
# Generated client name example: AmazonOpenSearchService-example-abcde-us-east-1-2ni6nt4id5tg25yde3pztiqkd4
name_pattern = "^AmazonOpenSearchService-example-(\\w+)$"
user_pool_id = aws_cognito_user_pool.example.id
}
# ... other configuration ...
```

## Argument Reference

The following arguments are required:

* `user_pool_id` - (Required) User pool that the client belongs to.
* `name_pattern` - (Required, one of `name_pattern` or `name_prefix`) Regular expression that matches the name of the desired User Pool Client. It must only match one User Pool Client.
* `name_prefix` - (Required, one of `name_prefix` or `name_pattern`) String that matches the beginning of the name of the desired User Pool Client. It must match only one User Pool Client.
* `name_pattern` - (Required, one of `name_pattern` or `name_prefix`) Regular expression that matches the name of the existing User Pool Client to be managed. It must only match one User Pool Client.
* `name_prefix` - (Required, one of `name_prefix` or `name_pattern`) String that matches the beginning of the name of the existing User Pool Client to be managed. It must match only one User Pool Client.

The following arguments are optional:

Expand Down

0 comments on commit a5dd2b0

Please sign in to comment.