Skip to content

Commit

Permalink
Allow more actions in the role
Browse files Browse the repository at this point in the history
  • Loading branch information
ScriptSmith committed Oct 4, 2023
1 parent 5601548 commit 79843b2
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions deployment/lib/github-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const appResourcePolicies = (tagKey: string, tagValue: string, stacks: string[])
"ec2:CreateSecurityGroup",
"ec2:DescribeSecurityGroups",
"ec2:DeleteSecurityGroup",
"ec2:CreateTags",
"iam:*",
"events:*",
"route53:*",
Expand Down Expand Up @@ -53,12 +54,27 @@ export class GitHubStack extends cdk.Stack {
autoDeleteObjects: true
});

// To read the account id
const readAccountPolicy = new iam.PolicyStatement({
effect: iam.Effect.ALLOW,
actions: ["sts:GetCallerIdentity"],
resources: ["*"]
});

// To create the cdk.context.json file
const cdkPolicy = new iam.PolicyStatement({
effect: iam.Effect.ALLOW,
actions: [
"ec2:DescribeAvailabilityZones",
"ec2:DescribeRouteTables",
"ec2:DescribeVpcs",
"ec2:DescribeVpnGateways",
"ec2:DescribeSubnets",
],
resources: ["*"],
})

// To manage the stacks
const cloudformationPolicy = new iam.PolicyStatement({
effect: iam.Effect.ALLOW,
actions: [
Expand All @@ -79,6 +95,7 @@ export class GitHubStack extends cdk.Stack {
resources: props.stacks.map(stack => `arn:aws:cloudformation:${cdk.Aws.REGION}:${cdk.Aws.ACCOUNT_ID}:stack/${stack}/*`)
});

// To read the config
const ssmPolicy = new iam.PolicyStatement({
effect: iam.Effect.ALLOW,
actions: ["ssm:GetParameter"],
Expand All @@ -93,6 +110,7 @@ export class GitHubStack extends cdk.Stack {
statements: [
readAccountPolicy,
cloudformationPolicy,
cdkPolicy,
ssmPolicy,
...appResourcePolicies("EresCdkApp", "transcription", props.stacks)
]
Expand Down

0 comments on commit 79843b2

Please sign in to comment.