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

CognitoIDP[UserPoolClient]: Avoid underlying provider validation failure #762

Merged
merged 1 commit into from
Jun 29, 2023

Commits on Jun 29, 2023

  1. CognitoIDP[UserPoolClient]: Avoid underlying provider validation failure

    * In a current state the instantiation of `UserPoolClient` fails with
    ```
    cannot run refresh: refresh failed: reading Amazon Cognito IDP (Identity Provider) User Pool Client (): InvalidParameter: 1 validation error(s) found.
    - minimum field size of 1, DescribeUserPoolClientInput.ClientId.
    ```
    unless we explicitly set the `external-name` annotation. See crossplane-contrib#752 for more debugging data
    
    * This change will preset the `id` with `spec.forProvider.name` to avoid
    the validation failure. The `id` will be populated eventually with the
    dynamic value from the cloud provider
    
    * I also tried to follow the doc at https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cognito_user_pool_client#import
    but it seems to be wrong in practice:
    
    If we use smth like
    
    ```
    TemplatedStringAsIdentifierWithNoName("{{ .parameters.user_pool_id }}/{{ .parameters.name }}"),
    ```
    
    it will fail with
    ```
    cannot run refresh: refresh failed: reading Amazon Cognito IDP (Identity Provider) User Pool Client (us-west-1_dMnICLKVB/): InvalidParameterException: 1 validation error detected: Value 'us-west-1_dMnICLKVB/' at 'clientId' failed to satisfy constraint: Member must satisfy regular expression pattern: [\w+]+
    ```
    
    It proves that the import doc deviates from reality and fails its own
    provider validation.
    
    * It is possible that we observe the bug in the underlying terraform aws
    provider.
    
    * This fix provides best possible solution without the fix of underlying
    provider and associated costs.
    
    * Fixes crossplane-contrib#752
    
    Signed-off-by: Yury Tsarev <yury@upbound.io>
    ytsarev committed Jun 29, 2023
    Configuration menu
    Copy the full SHA
    94eb136 View commit details
    Browse the repository at this point in the history