Repository navigation
fix: break circular CFN dependency in AuthStack - #4
Merged
Merged
Conversation
…gger The post-confirmation Lambda's IAM policy referenced this.userPool.userPoolArn for the AdminAddUserToGroup grant, which combined with addTrigger() wiring the same function into the pool's LambdaConfig, formed a cycle CloudFormation rejected at changeset creation (Function -> Policy -> UserPool -> Function). Scoping the grant to a wildcard userpool/* ARN in this account/region drops the Policy -> UserPool edge and breaks the cycle; only one pool exists per stage so it's pool-scoped in practice. Confirmed first deploy to eu-west-1: Database/Notifications/Budget/Frontend created fine, Auth failed here. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Hi @ezekielelvis! 👋
Your private repo does not have access to Sourcery.
Please upgrade to continue using Sourcery ✨
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
deploy.ymlrun failed onEventTicketing-dev-Authat changeset creation:Circular dependency between resources: [PostConfirmationTriggerB3C0710B, UserPoolWebClient4C9370B0, PostConfirmationTriggerServiceRoleDefaultPolicyFA0B8BFF, UserPoolORGANIZERGroupD373D8EB, UserPoolPostConfirmationCognito0E6001F8, UserPoolADMINGroupDA4BEA2B, PostConfirmationTriggerLogRetention846ACD84, UserPool6BA7E5F2, UserPoolUSERGroupAFC002D4]this.userPool.userPoolArnfor itscognito-idp:AdminAddUserToGroupgrant. Combined withaddTrigger()wiring that same function into the pool'sLambdaConfig, this formsFunction -> Policy -> UserPool -> Function— CloudFormation rejects the cycle before creating anything.arn:<partition>:cognito-idp:<region>:<account>:userpool/*instead of the pool's own ARN token, which drops thePolicy -> UserPooledge. Only one user pool exists per stage, so this is pool-scoped in practice.Verification
pnpm run typecheck,pnpm run lint,pnpm run synthall pass.EventTicketing-dev-Authtemplate: the policy document now only referencesAWS::AccountId(pseudo-parameter, no dependency edge) plus a literal wildcard — confirmed noRef/Fn::GetAttback to theUserPoolresource remains in that statement.Database,Notifications,Budget, andFrontendstacks already deployed successfully toeu-west-1in the failed run and are unaffected;Auth(and downstreamApi/Monitoring, which never got created) will deploy on the nextdeploy.ymlrun once this merges.Test plan
main, letCIpass, confirmdeploy.yml→deploy-infrastructurecreatesEventTicketing-dev-Authsuccessfully this timedeploy-frontendthen runs and the site is reachable at theFrontendstack's CloudFront URL🤖 Generated with Claude Code