Skip to content

aws-cognito: Add PCRE Regex Validation #28667

@IkeNefcy

Description

@IkeNefcy

Describe the feature

When creating a userpool using an OICD identity provider, UserPoolIdentityProviderOidc(), The provider name must follow a PCRE convention, which can throw an error in CFN if not matched. CFN displays: /[^_\p{Z}][\p{L}\p{M}\p{S}\p{N}\p{P}][^_\p{Z}]+/ (basically anything, but no spaces, no underscores).
Feature would be to add a type check, or a check during a local build, that shows if the name matches this.

Use Case

Saves time, if a name is passed with "_" or " " (In my case _) then you need to wait for rollback, and depending on how much of the other cognito portions were created, may have to manually delete the user pool that was half created after rollback.

Proposed Solution

Add a Type check, maybe something like

type RegexString<P extends RegExp> = string extends P ? string : string;
const provrule = /[^_\p{Z}][\p{L}\p{M}\p{S}\p{N}\p{P}][^_\p{Z}]+/;
type provname = RegexString<typeof provrule>;

//from cdk /aws-cdk-lib/aws-cognito/lib/user-pool-idps/oidc.d.ts
export interface UserPoolIdentityProviderOidcProps extends UserPoolIdentityProviderProps {
//
// ...
//
     * @default - the unique ID of the construct
     */
    readonly name?: provname;

But this doesn't work with PCRE, if I have time later to get something working I will try, but opening this anyways.

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.117.0

Environment details (OS name and version, etc.)

Linux / Centos 7, x86_64

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-cognitoRelated to Amazon Cognitoeffort/smallSmall work item – less than a day of effortfeature-requestA feature should be added or improved.p2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions