Skip to content

Commit

Permalink
Create org resource policy to make StqckSets account a delegated admin
Browse files Browse the repository at this point in the history
  • Loading branch information
tmclaugh committed Sep 1, 2024
1 parent 284394b commit 131e1ba
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ jobs:
deploy_stackset:
needs:
- build
- deploy
runs-on: ubuntu-latest
permissions:
id-token: write
Expand Down
3 changes: 2 additions & 1 deletion cfn-parameters.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"TargetOuIds": "r-c834"
"TargetOuIds": "r-c834",
"StackSetsAccountId": $secrets.STACKSETS_ACCOUNT_ID,
}
31 changes: 31 additions & 0 deletions template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ Parameters:
Description: List of OUs
Default: r-c834

StackSetsAccountId:
Type: String
Description: Account Id to deploy stacksets

Resources:
BillingStackManagement:
Type: AWS::Serverless::Application
Expand All @@ -20,3 +24,30 @@ Resources:
Location: "./stacksets/org-ou/template.yaml"
Parameters:
RootOuId: !Ref TargetOuIds

DelegatedAdminResourcePolicy:
Type: AWS::Organizations::ResourcePolicy
Properties:
Content: !Sub >-
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "StackSetsAccount",
"Principal": {
"AWS": "arn:aws:iam::${StackSetsAccountId}:root"
},
"Effect": "Allow",
"Action": [
"organizations:DescribeOrganization",
"organizations:ListRoots",
"organizations:ListOrganizationalUnitsForParent",
"organizations:ListAccountsForParent",
"organizations:ListAWSServiceAccessForOrganization",
"organizations:ListPolicies",
"organizations:ListTargetsForPolicy",
"organizations:ListPoliciesForTarget
]
}
]
}

0 comments on commit 131e1ba

Please sign in to comment.