Skip to content

Commit

Permalink
Merge branch 'master' into feature/new-ebs-types
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] committed Jan 21, 2021
2 parents 0fd879d + c01272c commit 4279fba
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 4 deletions.
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-synthetics/lib/canary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ export class Canary extends cdk.Resource {
* Returns a default role for the canary
*/
private createDefaultRole(prefix?: string): iam.IRole {
const { partition } = cdk.Stack.of(this);
// Created role will need these policies to run the Canary.
// https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-executionrolearn
const policy = new iam.PolicyDocument({
Expand All @@ -348,7 +349,7 @@ export class Canary extends cdk.Resource {
conditions: { StringEquals: { 'cloudwatch:namespace': 'CloudWatchSynthetics' } },
}),
new iam.PolicyStatement({
resources: ['arn:aws:logs:::*'],
resources: [`arn:${partition}:logs:::*`],
actions: ['logs:CreateLogStream', 'logs:CreateLogGroup', 'logs:PutLogEvents'],
}),
],
Expand Down
39 changes: 36 additions & 3 deletions packages/@aws-cdk/aws-synthetics/test/integ.canary.expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,18 @@
"logs:PutLogEvents"
],
"Effect": "Allow",
"Resource": "arn:aws:logs:::*"
"Resource": {
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":logs:::*"
]
]
}
}
],
"Version": "2012-10-17"
Expand Down Expand Up @@ -189,7 +200,18 @@
"logs:PutLogEvents"
],
"Effect": "Allow",
"Resource": "arn:aws:logs:::*"
"Resource": {
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":logs:::*"
]
]
}
}
],
"Version": "2012-10-17"
Expand Down Expand Up @@ -345,7 +367,18 @@
"logs:PutLogEvents"
],
"Effect": "Allow",
"Resource": "arn:aws:logs:::*"
"Resource": {
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":logs:::*"
]
]
}
}
],
"Version": "2012-10-17"
Expand Down

0 comments on commit 4279fba

Please sign in to comment.