Skip to content

Commit 7ae4bf1

Browse files
authored
fix(aws): complete drift detection access (#191)
## Summary - add the stack-scoped `cloudformation:DetectStackResourceDrift` permission required by full-stack drift detection - add region-scoped `cloudformation:BatchDescribeTypeConfigurations`, also required by AWS for drift detection - preserve the operator/data-plane separation ## Evidence - `npm run check` - `npm test` (630 passed, 6 skipped) - `npm run build` - `sam validate --lint --template-file template.yaml` - live CloudFormation template validation - focused Access Analyzer validation: zero errors/security warnings ## Live failure reproduced After the least-privilege stack reached `CREATE_COMPLETE` with termination protection and the retained-resource stack policy enabled, `status aws --detect-drift` failed specifically on `cloudformation:DetectStackResourceDrift`. AWS documents that action and `BatchDescribeTypeConfigurations` as required companions to `DetectStackDrift`. Part of #174.
1 parent c2d2f86 commit 7ae4bf1

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

deploy/aws-cloudformation-bootstrap.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,13 @@ Resources:
429429
Condition:
430430
StringEquals:
431431
aws:RequestedRegion: !Ref AWS::Region
432+
- Sid: ReadRegionalDriftTypeConfigurations
433+
Effect: Allow
434+
Action: cloudformation:BatchDescribeTypeConfigurations
435+
Resource: "*"
436+
Condition:
437+
StringEquals:
438+
aws:RequestedRegion: !Ref AWS::Region
432439
- Sid: ReadAndPlanExactHayaSendStacks
433440
Effect: Allow
434441
Action:
@@ -439,6 +446,7 @@ Resources:
439446
- cloudformation:DescribeStackResources
440447
- cloudformation:DescribeStacks
441448
- cloudformation:DetectStackDrift
449+
- cloudformation:DetectStackResourceDrift
442450
- cloudformation:GetStackPolicy
443451
- cloudformation:GetTemplate
444452
- cloudformation:GetTemplateSummary

tests/aws-cloudformation-bootstrap-template.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ describe("AWS CloudFormation deployment bootstrap template", () => {
8383
expect(operatorSection).toContain("sts:GetCallerIdentity");
8484
expect(operatorSection).toContain("ses:GetAccount");
8585
expect(operatorSection).toContain("cloudwatch:DescribeAlarms");
86+
expect(operatorSection).toContain(
87+
"cloudformation:BatchDescribeTypeConfigurations",
88+
);
89+
expect(operatorSection).toContain(
90+
"cloudformation:DetectStackResourceDrift",
91+
);
8692
expect(operatorSection).toContain("aws:RequestedRegion: !Ref AWS::Region");
8793
expect(operatorSection).not.toContain("changeSet/*/*");
8894
expect(operatorSection).not.toMatch(

0 commit comments

Comments
 (0)