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

fix(custom-resources): cannot set logging for state machine generated in CompleteHandler #27310

Merged
merged 64 commits into from Dec 20, 2023

Conversation

go-to-k
Copy link
Contributor

@go-to-k go-to-k commented Sep 27, 2023

This PR fixes the case that StateMachine generated for CompleteHandler in Provider cannot set logging.

Closes #27283.


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

@github-actions github-actions bot added bug This issue is a bug. effort/medium Medium work item – several days of effort p2 labels Sep 27, 2023
@aws-cdk-automation aws-cdk-automation requested a review from a team September 27, 2023 07:21
@github-actions github-actions bot added the admired-contributor [Pilot] contributed between 13-24 PRs to the CDK label Sep 27, 2023
@go-to-k go-to-k changed the title fix(custom-resources): StateMachine in Provider cannot set logging fix(custom-resources): StateMachine for isCompleteHandler in Provider cannot set logging Sep 27, 2023
@go-to-k go-to-k changed the title fix(custom-resources): StateMachine for isCompleteHandler in Provider cannot set logging fix(custom-resources): StateMachine for CompleteHandler in Provider cannot set logging Sep 27, 2023
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@aws-cdk-automation aws-cdk-automation dismissed their stale review September 27, 2023 10:17

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@aws-cdk-automation aws-cdk-automation dismissed their stale review September 27, 2023 11:54

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@kaizencc kaizencc changed the title fix(custom-resources): StateMachine for CompleteHandler in Provider cannot set logging fix(custom-resources): cannot set logging for state machine generated in CompleteHandler Dec 19, 2023
Copy link
Contributor

@kaizencc kaizencc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the lengthy review @lpizzinidev and for waiting patiently @go-to-k. Sorry for the delay. I just have two documentation comments and then I think we're good to go!

DefinitionString: definition,
RoleArn: role.roleArn,
},
const resource = new CfnStateMachine(this, 'Resource', {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We previously used CfnResource here because we did not want to depend on aws-stepfunctions module (back in CDK v1 where individual modules were released. Now that they are both part of aws-cdk-lib, this change is ok. But there are comments on line 80 that need to be updated to reflect this. I would document that we previously used CfnResource to avoid depending on aws-stepfunctions, but now it is okay.

): CfnStateMachine.LoggingConfigurationProperty | undefined {
if (disableLogging) return undefined;

// https://docs.aws.amazon.com/step-functions/latest/dg/cw-logs.html#cloudwatch-iam-policy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this link. Let's also copy in the important piece of information from this link:

// You need to specify `*` in the Resource field because CloudWatch API actions, such as CreateLogDelivery and DescribeLogGroups, don't support Resource types defined by Amazon CloudWatch Logs.

@mergify mergify bot dismissed kaizencc’s stale review December 20, 2023 03:15

Pull request has been modified.

@go-to-k
Copy link
Contributor Author

go-to-k commented Dec 20, 2023

@kaizencc

Thanks for your review! I fixed.

Copy link
Contributor

@kaizencc kaizencc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @go-to-k!

Copy link
Contributor

mergify bot commented Dec 20, 2023

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

@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Dec 20, 2023
Copy link
Contributor

mergify bot commented Dec 20, 2023

Thank you for contributing! Your pull request will be updated from main 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
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 0e7aeb9
  • 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 bfeef00 into aws:main Dec 20, 2023
9 checks passed
Copy link
Contributor

mergify bot commented Dec 20, 2023

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

paulhcsun pushed a commit to paulhcsun/aws-cdk that referenced this pull request Jan 5, 2024
… in CompleteHandler (aws#27310)

This PR fixes the case that `StateMachine` generated for `CompleteHandler` in `Provider` cannot set logging.

Closes aws#27283.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
MrArnoldPalmer added a commit that referenced this pull request Jan 12, 2024
Reverts #27310 which allows setting up LogGroups for the state machine
configured by the waiter custom-resource.

Refs: bfeef00

This reverts commit bfeef00.
MrArnoldPalmer added a commit that referenced this pull request Jan 12, 2024
Reverts #27310 which allows setting up LogGroups for the state machine
configured by the waiter custom-resource.

Refs: bfeef00

This reverts commit bfeef00.
mergify bot pushed a commit that referenced this pull request Jan 13, 2024
Reverts #27310 which allows setting up LogGroups for the state machine configured by the waiter custom-resource.

Refs: bfeef00

This reverts commit bfeef00.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
MrArnoldPalmer added a commit that referenced this pull request Jan 13, 2024
Reverts #27310 which allows setting up LogGroups for the state machine configured by the waiter custom-resource.

Refs: bfeef00

This reverts commit bfeef00.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
mergify bot pushed a commit that referenced this pull request Apr 19, 2024
… in CompleteHandler (#28706)

This PR fixes the case that `StateMachine` generated for `CompleteHandler` in `Provider` cannot set logging.

The default log group name of the state machine automatically created by the `Provider` with `isCompleteHandler` should start with `/aws/vendedlogs/states`. Otherwise, each time the state machine is created, the log resource policy size increases. 

https://docs.aws.amazon.com/step-functions/latest/dg/bp-cwl.html

Closes #27283
Fixes #28577 #28744

Related PR #27310(reverted by #28699), #28587

----

*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
admired-contributor [Pilot] contributed between 13-24 PRs to the CDK bug This issue is a bug. effort/medium Medium work item – several days of effort p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

custom resources: Generated step function generates finding due to missing logging
4 participants