Skip to content

Commit 99041b2

Browse files
authored
fix(custom-resources): cannot set logging for state machine generated 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*
1 parent 2126ee5 commit 99041b2

File tree

143 files changed

+12993
-6062
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+12993
-6062
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/aws-cdk-dynamodb-global-replicas-provisioned.assets.json

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/aws-cdk-dynamodb-global-replicas-provisioned.template.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@
291291
{
292292
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
293293
},
294-
"/9e74695d20fbb89dc62fd8a020b6273050655fc292429f61f3ec014282a93e69.json"
294+
"/960077579d48da3054d2f2b5a09cca17fc80809a34ba0d9d2d2fd19702c9b684.json"
295295
]
296296
]
297297
}

packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/awscdkdynamodbglobalreplicasprovisionedawscdkawsdynamodbReplicaProviderEA32CB30.nested.template.json

+52
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,22 @@
676676
]
677677
}
678678
]
679+
},
680+
{
681+
"Action": [
682+
"logs:CreateLogDelivery",
683+
"logs:CreateLogStream",
684+
"logs:DeleteLogDelivery",
685+
"logs:DescribeLogGroups",
686+
"logs:DescribeResourcePolicies",
687+
"logs:GetLogDelivery",
688+
"logs:ListLogDeliveries",
689+
"logs:PutLogEvents",
690+
"logs:PutResourcePolicy",
691+
"logs:UpdateLogDelivery"
692+
],
693+
"Effect": "Allow",
694+
"Resource": "*"
679695
}
680696
],
681697
"Version": "2012-10-17"
@@ -688,6 +704,26 @@
688704
]
689705
}
690706
},
707+
"ProviderwaiterstatemachineLogGroupDD693A98": {
708+
"Type": "AWS::Logs::LogGroup",
709+
"Properties": {
710+
"LogGroupName": {
711+
"Fn::Join": [
712+
"",
713+
[
714+
"/aws/vendedlogs/states/waiter-state-machine-",
715+
{
716+
"Ref": "ProviderframeworkisComplete26D7B0CB"
717+
},
718+
"-c861cd2a83a6af30e2613fcc9324bc4db65ca58d7f"
719+
]
720+
]
721+
},
722+
"RetentionInDays": 731
723+
},
724+
"UpdateReplacePolicy": "Retain",
725+
"DeletionPolicy": "Retain"
726+
},
691727
"Providerwaiterstatemachine5D4A9DF0": {
692728
"Type": "AWS::StepFunctions::StateMachine",
693729
"Properties": {
@@ -713,6 +749,22 @@
713749
]
714750
]
715751
},
752+
"LoggingConfiguration": {
753+
"Destinations": [
754+
{
755+
"CloudWatchLogsLogGroup": {
756+
"LogGroupArn": {
757+
"Fn::GetAtt": [
758+
"ProviderwaiterstatemachineLogGroupDD693A98",
759+
"Arn"
760+
]
761+
}
762+
}
763+
}
764+
],
765+
"IncludeExecutionData": false,
766+
"Level": "ERROR"
767+
},
716768
"RoleArn": {
717769
"Fn::GetAtt": [
718770
"ProviderwaiterstatemachineRole0C7159F9",

packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/manifest.json

+7-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/tree.json

+105-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.js.snapshot/cdk-dynamodb-global-20191121.assets.json

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.js.snapshot/cdk-dynamodb-global-20191121.template.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@
246246
{
247247
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-eu-west-1"
248248
},
249-
"/4148c9473bcbd8c19e338a215d442b27cc755081d5d4980c0648dfd92306e0e5.json"
249+
"/8b3c6feb070f454632cee6e863c7ec94af3254d0071ad904533703d3b66a63b8.json"
250250
]
251251
]
252252
}

packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.js.snapshot/cdkdynamodbglobal20191121awscdkawsdynamodbReplicaProviderB281C954.nested.template.json

+52
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,22 @@
672672
]
673673
}
674674
]
675+
},
676+
{
677+
"Action": [
678+
"logs:CreateLogDelivery",
679+
"logs:CreateLogStream",
680+
"logs:DeleteLogDelivery",
681+
"logs:DescribeLogGroups",
682+
"logs:DescribeResourcePolicies",
683+
"logs:GetLogDelivery",
684+
"logs:ListLogDeliveries",
685+
"logs:PutLogEvents",
686+
"logs:PutResourcePolicy",
687+
"logs:UpdateLogDelivery"
688+
],
689+
"Effect": "Allow",
690+
"Resource": "*"
675691
}
676692
],
677693
"Version": "2012-10-17"
@@ -684,6 +700,26 @@
684700
]
685701
}
686702
},
703+
"ProviderwaiterstatemachineLogGroupDD693A98": {
704+
"Type": "AWS::Logs::LogGroup",
705+
"Properties": {
706+
"LogGroupName": {
707+
"Fn::Join": [
708+
"",
709+
[
710+
"/aws/vendedlogs/states/waiter-state-machine-",
711+
{
712+
"Ref": "ProviderframeworkisComplete26D7B0CB"
713+
},
714+
"-c8696e1868b3a8bafc51799993fdba7f11ffdcc5c5"
715+
]
716+
]
717+
},
718+
"RetentionInDays": 731
719+
},
720+
"UpdateReplacePolicy": "Retain",
721+
"DeletionPolicy": "Retain"
722+
},
687723
"Providerwaiterstatemachine5D4A9DF0": {
688724
"Type": "AWS::StepFunctions::StateMachine",
689725
"Properties": {
@@ -709,6 +745,22 @@
709745
]
710746
]
711747
},
748+
"LoggingConfiguration": {
749+
"Destinations": [
750+
{
751+
"CloudWatchLogsLogGroup": {
752+
"LogGroupArn": {
753+
"Fn::GetAtt": [
754+
"ProviderwaiterstatemachineLogGroupDD693A98",
755+
"Arn"
756+
]
757+
}
758+
}
759+
}
760+
],
761+
"IncludeExecutionData": false,
762+
"Level": "ERROR"
763+
},
712764
"RoleArn": {
713765
"Fn::GetAtt": [
714766
"ProviderwaiterstatemachineRole0C7159F9",

0 commit comments

Comments
 (0)