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

(synthetics): Default role breaks in non aws partitions #12094

Closed
Khufu-I opened this issue Dec 15, 2020 · 1 comment · Fixed by #12096
Closed

(synthetics): Default role breaks in non aws partitions #12094

Khufu-I opened this issue Dec 15, 2020 · 1 comment · Fixed by #12096
Assignees
Labels
@aws-cdk/aws-synthetics Related to Amazon CloudWatch Synthetics bug This issue is a bug. effort/small Small work item – less than a day of effort p1

Comments

@Khufu-I
Copy link
Contributor

Khufu-I commented Dec 15, 2020

Synthetics Canary default execution role hard codes 'arn:aws:logs:::*' in the IAM policy which does not work in non AWS partitions (i.e aws-cn or aws-us-gov)

Reproduction Steps

Synthesize the following code (cdk synth) for cn-north-1

import * as synthetics from '@aws-cdk/aws-synthetics';

const canary = new synthetics.Canary(this, 'MyCanary', {
  schedule: synthetics.Schedule.rate(Duration.minutes(5)),
  test: Test.custom({
    code: synthetics.Code.fromAsset(path.join(__dirname, 'canary')),
    handler: 'index.handler',
  }),
  runtime: synthetics.Runtime.SYNTHETICS_NODEJS_2_0,
});

What did you expect to happen?

The default execution role IAM policy should contain a partition aware log access policy

{
  "Action": [
    "logs:CreateLogStream",
    "logs:CreateLogGroup",
    "logs:PutLogEvents"
  ],
  "Effect": "Allow",
  "Resource": { "Fn::Join": ["", ["arn:", {"Ref": "AWS::Partition"}, ":logs:::*"]] }
}

What actually happened?

The default execution role contains an IAM policy which has aws hardcoded and isn't partition aware

{
  "Action": [
    "logs:CreateLogStream",
    "logs:CreateLogGroup",
    "logs:PutLogEvents"
  ],
  "Effect": "Allow",
  "Resource": "arn:aws:logs:::*"
}

Environment

  • CDK CLI Version : 1.76.0
  • Framework Version: Version: monocdk 1.77.0
  • Node.js Version: 12.9.1
  • OS : macOS 10.15.7
  • Language (Version): JavaScript 2020

Other


This is 🐛 Bug Report

@Khufu-I Khufu-I added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Dec 15, 2020
@SomayaB SomayaB changed the title [synthetics] Default role breaks in non aws partitions (synthetics): Default role breaks in non aws partitions Dec 16, 2020
@github-actions github-actions bot added the @aws-cdk/aws-synthetics Related to Amazon CloudWatch Synthetics label Dec 16, 2020
@NetaNir NetaNir added p1 effort/small Small work item – less than a day of effort and removed needs-triage This issue or PR still needs to be triaged. labels Dec 16, 2020
@mergify mergify bot closed this as completed in #12096 Jan 21, 2021
mergify bot pushed a commit that referenced this issue Jan 21, 2021
…12096)

Canary default execution role should be partition aware instead of hardcoding aws.

Fixes #12094


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

mohanrajendran pushed a commit to mohanrajendran/aws-cdk that referenced this issue Jan 24, 2021
…ws#12096)

Canary default execution role should be partition aware instead of hardcoding aws.

Fixes aws#12094


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-synthetics Related to Amazon CloudWatch Synthetics bug This issue is a bug. effort/small Small work item – less than a day of effort p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants