Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/additional serverless deploy permissions #31

Merged
merged 14 commits into from
Dec 5, 2023
Merged
4 changes: 2 additions & 2 deletions .github/workflows/cdk-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.release.target_commitish }}
- name: Use Node.js 16
- name: Use Node.js 18
uses: actions/setup-node@v1
with:
node-version: 16
node-version: 18
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm run test --workspaces
53 changes: 53 additions & 0 deletions packages/serverless-deploy-iam/bin/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,51 @@ export class ServiceDeployIAM extends cdk.Stack {
"cognito-identity:CreateIdentityPool",
"cognito-identity:SetIdentityPoolRoles"
]
},
{
name: 'CLOUDFRONT-OAI',
resources: [
`arn:aws:cloudfront::${accountId}:origin-access-identity/*`
],
actions: [
"cloudfront:CreateCloudFrontOriginAccessIdentity",
"cloudfront:GetCloudFrontOriginAccessIdentity",
"cloudfront:DeleteCloudFrontOriginAccessIdentity"
]
},
{
name: 'CLOUDFRONT-FUNCTION',
resources: [
`arn:aws:cloudfront::${accountId}:function/*`
],
actions: [
"cloudfront:CreateFunction"
]
},
{
name: 'CLOUDFRONT-FUNCTION',
resources: [
`arn:aws:cloudfront::${accountId}:function/${serviceName}*`
],
actions: [
"cloudfront:CreateFunction",
"cloudfront:DescribeFunction",
"cloudfront:DeleteFunction",
"cloudfront:PublishFunction",
"cloudfront:GetFunction"
]
},
{
name: 'CLOUDFRONT-DISTRIBUTION',
resources: [ `arn:aws:cloudfront::${accountId}:distribution/*` ],
actions: [
"cloudfront:CreateDistribution",
"cloudfront:DeleteDistribution",
"cloudfront:GetDistribution",
"cloudfront:ListDistributions",
"cloudfront:UpdateDistribution",
"cloudfront:TagResource"
]
}
]
}
Expand Down Expand Up @@ -437,6 +482,7 @@ export class ServiceDeployIAM extends cdk.Stack {
resources: [`*`],
actions: [
"cloudformation:ValidateTemplate",
"cloudformation:ListExports"
]
},
{
Expand Down Expand Up @@ -514,6 +560,13 @@ export class ServiceDeployIAM extends cdk.Stack {
"apigateway:PATCH",
"apigateway:POST"
]
},
{
name: 'DISTRIBUTION',
resources: [ `arn:aws:cloudfront::${accountId}:distribution/*` ],
actions: [
"cloudfront:CreateInvalidation"
]
}
]
}
Expand Down
5 changes: 4 additions & 1 deletion packages/serverless-deploy-iam/test/deploy-role.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ describe('Deploy user policy', () => {
PolicyDocument: {
Statement: arrayWith(
objectLike({
Action: "cloudformation:ValidateTemplate",
Action: [
"cloudformation:ValidateTemplate",
"cloudformation:ListExports"
],
Effect: "Allow",
Resource: "*"
}),
Expand Down
Loading