Skip to content

feat(logs): add support for cloudwatch logs resource policy - #17015

Merged
mergify[bot] merged 3 commits into
aws:masterfrom
nom3ad:issue-5343-support-cloudwatch-resource-policy
Nov 1, 2021
Merged

mergify[bot] merged 3 commits into
aws:masterfrom
nom3ad:issue-5343-support-cloudwatch-resource-policy

Conversation

@nom3ad

@nom3ad nom3ad commented Oct 16, 2021

Copy link
Copy Markdown
Contributor

CloudFormation now supports Cloudwatch logs Resource policies
This PR adds L2 support for it.

And now its possible to grant access to service principals as follows. Previously this was throwing an error - see #5343

const eventsTargetLogs = new logs.LogGroup(this, 'EventsTargetLogGroup');
eventsTargetLogs.grantWrite(new iam.ServicePrincipal('events.amazonaws.com')).assertSuccess();

In future, following custom resource implementation of LogGroupResourcePolicy could be replaced.

export class LogGroupResourcePolicy extends cr.AwsCustomResource {

export class LogGroupResourcePolicy extends cr.AwsCustomResource {

export class LogGroupResourcePolicy extends cr.AwsCustomResource {

closes #5343


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@gitpod-io

gitpod-io Bot commented Oct 16, 2021

Copy link
Copy Markdown

@nom3ad

nom3ad commented Oct 19, 2021

Copy link
Copy Markdown
Contributor Author

@rix0rrr Hey, Would you mind taking a look at this?

@peterwoodworth peterwoodworth changed the title feat(logs): add support for cloudwatch logs resource policy feat(logs): add support for cloudwatch logs resource policy Oct 21, 2021
@github-actions github-actions Bot added the @aws-cdk/aws-logs Related to Amazon CloudWatch Logs label Oct 21, 2021
rix0rrr
rix0rrr previously approved these changes Oct 27, 2021
@mergify
mergify Bot dismissed rix0rrr’s stale review October 30, 2021 08:44

Pull request has been modified.

@nom3ad

nom3ad commented Oct 30, 2021

Copy link
Copy Markdown
Contributor Author

Oops! Forgot to add documentation to README. Sorry @rix0rrr, could you please reapprove?

@nom3ad
nom3ad requested a review from rix0rrr October 30, 2021 11:00
@mergify

mergify Bot commented Nov 1, 2021

Copy link
Copy Markdown
Contributor

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation

Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: 99e0fb0
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
mergify Bot merged commit e9a461d into aws:master Nov 1, 2021
@mergify

mergify Bot commented Nov 1, 2021

Copy link
Copy Markdown
Contributor

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

mergify Bot pushed a commit that referenced this pull request Nov 9, 2021
…17403)

## Summary

This PR modifies the aws-logs `index.ts` file to also forward the exports from `policy.ts` ([a newly created file](#17015) that implements the `ResourcePolicy` class).

Fixes: #17402
----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this pull request Feb 21, 2022
CloudFormation now supports [Cloudwatch logs Resource policies](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-resourcepolicy.html)
This PR adds L2 support for it.

And now its possible to grant access to service principals as follows. Previously this was throwing an error - see aws#5343

```ts
const eventsTargetLogs = new logs.LogGroup(this, 'EventsTargetLogGroup');
eventsTargetLogs.grantWrite(new iam.ServicePrincipal('events.amazonaws.com')).assertSuccess();
```

In future, following custom resource implementation of `LogGroupResourcePolicy` could be replaced.

https://github.com/aws/aws-cdk/blob/83b8df8c390a27e10bf362f49babfb24ee425506/packages/@aws-cdk/aws-elasticsearch/lib/log-group-resource-policy.ts#L25
https://github.com/aws/aws-cdk/blob/a872e672f8990fc3879413e5d797533d3916e1fd/packages/@aws-cdk/aws-events-targets/lib/log-group-resource-policy.ts#L26
https://github.com/aws/aws-cdk/blob/a872e672f8990fc3879413e5d797533d3916e1fd/packages/@aws-cdk/aws-events-targets/lib/log-group-resource-policy.ts#L26

closes aws#5343

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this pull request Feb 21, 2022
…ws#17403)

## Summary

This PR modifies the aws-logs `index.ts` file to also forward the exports from `policy.ts` ([a newly created file](aws#17015) that implements the `ResourcePolicy` class).

Fixes: aws#17402
----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@seyeong seyeong mentioned this pull request Jun 24, 2022
2 tasks done
ali-n4i pushed a commit to ali-n4i/aws-cdk that referenced this pull request Jul 29, 2026
CloudFormation now supports [Cloudwatch logs Resource policies](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-resourcepolicy.html)
This PR adds L2 support for it.

And now its possible to grant access to service principals as follows. Previously this was throwing an error - see aws#5343

```ts
const eventsTargetLogs = new logs.LogGroup(this, 'EventsTargetLogGroup');
eventsTargetLogs.grantWrite(new iam.ServicePrincipal('events.amazonaws.com')).assertSuccess();
```

In future, following custom resource implementation of `LogGroupResourcePolicy` could be replaced.

https://github.com/aws/aws-cdk/blob/83b8df8c390a27e10bf362f49babfb24ee425506/packages/@aws-cdk/aws-elasticsearch/lib/log-group-resource-policy.ts#L25
https://github.com/aws/aws-cdk/blob/a872e672f8990fc3879413e5d797533d3916e1fd/packages/@aws-cdk/aws-events-targets/lib/log-group-resource-policy.ts#L26
https://github.com/aws/aws-cdk/blob/a872e672f8990fc3879413e5d797533d3916e1fd/packages/@aws-cdk/aws-events-targets/lib/log-group-resource-policy.ts#L26

closes aws#5343

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
ali-n4i pushed a commit to ali-n4i/aws-cdk that referenced this pull request Jul 29, 2026
…ws#17403)

## Summary

This PR modifies the aws-logs `index.ts` file to also forward the exports from `policy.ts` ([a newly created file](aws#17015) that implements the `ResourcePolicy` class).

Fixes: aws#17402
----

*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-logs Related to Amazon CloudWatch Logs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

logs: Support Resource policies

3 participants