I can't find examples or documentation about how to use cdk to attach a waf to a cognito userpool.
There is no API in Cognito Userpool. You will need to create CfnWebACLAssociation and provide the Userpool ARN for the resource ARN.
import { aws_wafv2 as wafv2 } from 'aws-cdk-lib';
const cfnWebACLAssociation = new wafv2.CfnWebACLAssociation(this, 'MyCfnWebACLAssociation', {
resourceArn: 'arn: *partition* :cognito-idp: *region* : *account-id* :userpool/ *user-pool-id*',
webAclArn: 'webAclArn',
});