Skip to content

Commit

Permalink
fix(assorted): Rare race condition and improved destroys (#494)
Browse files Browse the repository at this point in the history
* fix(reindex race): Fix a rarely seen race condition where reindex kicks off before mapRole finishes, which causes a failure due to lack of permissions

* Remove createLogGroup permissions so custom resources dont recreate log groups, which is a pain when deleting and recreating a stack
  • Loading branch information
mdial89f authored Apr 7, 2024
1 parent 1a06149 commit d5853b5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/services/data/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ provider:
path: /delegatedadmin/developer/
permissionsBoundary: arn:aws:iam::${aws:accountId}:policy/cms-cloud-admin/developer-boundary-policy
statements:
- Effect: Deny # Prevents delayed custom resource logs from re-creating log groups after deletion.
Action:
- logs:CreateLogGroup
Resource: "*"
- Effect: "Allow"
Action:
- cognito-idp:AdminCreateUser
Expand Down Expand Up @@ -428,6 +432,7 @@ resources:
Properties:
ServiceToken: !GetAtt RunReindexLambdaFunction.Arn
StateMachine: !Ref ReindexDataStateMachine
DependsOn: MapRole
MapRole:
Type: Custom::MapRole
Properties:
Expand Down
4 changes: 4 additions & 0 deletions src/services/ui-infra/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ provider:
path: /delegatedadmin/developer/
permissionsBoundary: arn:aws:iam::${aws:accountId}:policy/cms-cloud-admin/developer-boundary-policy
statements:
- Effect: Deny # Prevents delayed custom resource logs from re-creating log groups after deletion.
Action:
- logs:CreateLogGroup
Resource: "*"
- Effect: "Allow"
Action:
- s3:ListBucketVersions
Expand Down
4 changes: 4 additions & 0 deletions src/services/uploads/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ provider:
path: /delegatedadmin/developer/
permissionsBoundary: arn:aws:iam::${aws:accountId}:policy/cms-cloud-admin/developer-boundary-policy
statements:
- Effect: Deny # Prevents delayed custom resource logs from re-creating log groups after deletion.
Action:
- logs:CreateLogGroup
Resource: "*"
- Effect: "Allow"
Action:
- s3:GetObject
Expand Down

0 comments on commit d5853b5

Please sign in to comment.