-
Notifications
You must be signed in to change notification settings - Fork 4k
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
cognito: Remove custom resource from UserPoolDomain to get CloudFrontDistribution
attribute
#31342
Comments
Yes, it makes sense to remove usage of custom resource given that CloudFrontDistribution could be obtained from The following code works: import * as cdk from 'aws-cdk-lib';
import * as cognito from 'aws-cdk-lib/aws-cognito';
export class CdktestStack extends cdk.Stack {
constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const userPool = cognito.UserPool.fromUserPoolId(this, 'userpool', 'us-east-2_G27QXonjy');
const resource = new cognito.CfnUserPoolDomain(this, 'Resource', {
userPoolId: userPool.userPoolId,
domain: 'myexampledomain'
});
const cloudFrontDistribution = resource.getAtt('CloudFrontDistribution');
new cdk.CfnOutput(this, 'CloudFrontDistribution', { value: cloudFrontDistribution.toString()});
}
} produces the below output during
|
Comments on closed issues and PRs are hard for our team to see. |
1 similar comment
Comments on closed issues and PRs are hard for our team to see. |
Describe the feature
Currently we use an AwsCutstomResource to get
cloudFrontDomainName
attribute for a UserPoolDomain resource.aws-cdk/packages/aws-cdk-lib/aws-cognito/lib/user-pool-domain.ts
Lines 129 to 136 in 4b9643f
But actually CFn exposes the attribute natively. We can remove the unnecessary custom resource usage.
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpooldomain.html#aws-resource-cognito-userpooldomain-return-values
Use Case
To get a CloudFront domain for a user pool domain without using a custom resource. c.f. https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-add-custom-domain.html
Proposed Solution
We can just replace it with a
getAtt
call.Other Information
No response
Acknowledgements
CDK version used
2.155.0
Environment details (OS name and version, etc.)
macOS
The text was updated successfully, but these errors were encountered: