diff --git a/infrastructure/lib/stacks/auth-stack.ts b/infrastructure/lib/stacks/auth-stack.ts index e4feb53..558c390 100644 --- a/infrastructure/lib/stacks/auth-stack.ts +++ b/infrastructure/lib/stacks/auth-stack.ts @@ -93,7 +93,14 @@ export class AuthStack extends Stack { postConfirmationFn.addToRolePolicy( new PolicyStatement({ actions: ['cognito-idp:AdminAddUserToGroup'], - resources: [this.userPool.userPoolArn], + // Scoped to any user pool in this account/region rather than + // `this.userPool.userPoolArn`: referencing the pool's own ARN + // here creates a circular CloudFormation dependency, since + // addTrigger() below also makes the pool depend on this + // function's ARN (the classic "post-confirmation trigger needs a + // permission on its own pool" cycle). Only one user pool exists + // per stage, so this is pool-scoped in practice. + resources: [`arn:${this.partition}:cognito-idp:${this.region}:${this.account}:userpool/*`], }), );