diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/batch/integ.job-definition-events.js.snapshot/batch-events.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/batch/integ.job-definition-events.js.snapshot/batch-events.assets.json index eee3e664f6039..05978415b977f 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/batch/integ.job-definition-events.js.snapshot/batch-events.assets.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/batch/integ.job-definition-events.js.snapshot/batch-events.assets.json @@ -1,7 +1,7 @@ { - "version": "31.0.0", + "version": "32.0.0", "files": { - "d7dcc67b92ba98cf8898af8fd31d31f46001867bc6458f3c816a77850e10a990": { + "9ad3e49b4b05bbbb8d2ad91c2718d29b90ebcb493570a3f1c3e42005681045f4": { "source": { "path": "batch-events.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "d7dcc67b92ba98cf8898af8fd31d31f46001867bc6458f3c816a77850e10a990.json", + "objectKey": "9ad3e49b4b05bbbb8d2ad91c2718d29b90ebcb493570a3f1c3e42005681045f4.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/batch/integ.job-definition-events.js.snapshot/batch-events.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/batch/integ.job-definition-events.js.snapshot/batch-events.template.json index 64a5e706ba3d3..a948360bbf810 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/batch/integ.job-definition-events.js.snapshot/batch-events.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/batch/integ.job-definition-events.js.snapshot/batch-events.template.json @@ -79,6 +79,49 @@ } } }, + "containerExecutionRoleDefaultPolicyF00DA4D6": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/batch/job:*" + ] + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "containerExecutionRoleDefaultPolicyF00DA4D6", + "Roles": [ + { + "Ref": "containerExecutionRoleFD602179" + } + ] + } + }, "MyJob8719E923": { "Type": "AWS::Batch::JobDefinition", "Properties": { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/batch/integ.job-definition-events.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/batch/integ.job-definition-events.js.snapshot/cdk.out index 7925065efbcc4..f0b901e7c06e5 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/batch/integ.job-definition-events.js.snapshot/cdk.out +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/batch/integ.job-definition-events.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"31.0.0"} \ No newline at end of file +{"version":"32.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/batch/integ.job-definition-events.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/batch/integ.job-definition-events.js.snapshot/integ.json index 6641b55a0ddc5..7afd725483c8b 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/batch/integ.job-definition-events.js.snapshot/integ.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/batch/integ.job-definition-events.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "31.0.0", + "version": "32.0.0", "testCases": { "integ.job-definition-events": { "stacks": [ diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/batch/integ.job-definition-events.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/batch/integ.job-definition-events.js.snapshot/manifest.json index af8e10dc7201c..409e5d61f1daa 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/batch/integ.job-definition-events.js.snapshot/manifest.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/batch/integ.job-definition-events.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "31.0.0", + "version": "32.0.0", "artifacts": { "batch-events.assets": { "type": "cdk:asset-manifest", @@ -17,7 +17,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/d7dcc67b92ba98cf8898af8fd31d31f46001867bc6458f3c816a77850e10a990.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/9ad3e49b4b05bbbb8d2ad91c2718d29b90ebcb493570a3f1c3e42005681045f4.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -57,6 +57,12 @@ "data": "containerExecutionRoleFD602179" } ], + "/batch-events/container/ExecutionRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "containerExecutionRoleDefaultPolicyF00DA4D6" + } + ], "/batch-events/MyJob/Resource": [ { "type": "aws:cdk:logicalId", @@ -110,15 +116,6 @@ "type": "aws:cdk:logicalId", "data": "CheckBootstrapVersion" } - ], - "MyQueue4F9177CF": [ - { - "type": "aws:cdk:logicalId", - "data": "MyQueue4F9177CF", - "trace": [ - "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" - ] - } ] }, "displayName": "batch-events" diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/batch/integ.job-definition-events.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/batch/integ.job-definition-events.js.snapshot/tree.json index 8ef25135c82c4..31fd4028219cd 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/batch/integ.job-definition-events.js.snapshot/tree.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/batch/integ.job-definition-events.js.snapshot/tree.json @@ -92,7 +92,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-batch-alpha.UnmanagedComputeEnvironment", + "fqn": "aws-cdk-lib.Resource", "version": "0.0.0" } }, @@ -128,7 +128,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-batch-alpha.JobQueue", + "fqn": "aws-cdk-lib.Resource", "version": "0.0.0" } }, @@ -172,17 +172,86 @@ "fqn": "aws-cdk-lib.aws_iam.CfnRole", "version": "0.0.0" } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "batch-events/container/ExecutionRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "batch-events/container/ExecutionRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/batch/job:*" + ] + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "containerExecutionRoleDefaultPolicyF00DA4D6", + "roles": [ + { + "Ref": "containerExecutionRoleFD602179" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", "version": "0.0.0" } + }, + "batchDefaultLogGroup": { + "id": "batchDefaultLogGroup", + "path": "batch-events/container/batchDefaultLogGroup", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } } }, "constructInfo": { - "fqn": "@aws-cdk/aws-batch-alpha.EcsEc2ContainerDefinition", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.55" } }, "MyJob": { @@ -323,7 +392,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-batch-alpha.EcsJobDefinition", + "fqn": "aws-cdk-lib.Resource", "version": "0.0.0" } }, @@ -541,7 +610,7 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.270" + "version": "10.2.55" } } }, diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/aws-stepfunctions-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/aws-stepfunctions-integ.assets.json index 87318898131e0..05dec2d6c9d8d 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/aws-stepfunctions-integ.assets.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/aws-stepfunctions-integ.assets.json @@ -1,7 +1,7 @@ { - "version": "31.0.0", + "version": "32.0.0", "files": { - "02f57d4a4fe6e856437076797ed3037dbed370ebb26574bc4a5d570ab0b0b478": { + "d52c690255570b27d7cc2b49792058ef0c678d1fd7345f8dda5ef9e9a5d9dc05": { "source": { "path": "aws-stepfunctions-integ.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "02f57d4a4fe6e856437076797ed3037dbed370ebb26574bc4a5d570ab0b0b478.json", + "objectKey": "d52c690255570b27d7cc2b49792058ef0c678d1fd7345f8dda5ef9e9a5d9dc05.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/aws-stepfunctions-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/aws-stepfunctions-integ.template.json index 5cb07cc3988d2..15d2930ca7bd3 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/aws-stepfunctions-integ.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/aws-stepfunctions-integ.template.json @@ -529,6 +529,33 @@ "Properties": { "PolicyDocument": { "Statement": [ + { + "Action": [ + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/batch/job:*" + ] + ] + } + }, { "Action": [ "ecr:BatchCheckLayerAvailability", diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/cdk.out index 7925065efbcc4..f0b901e7c06e5 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/cdk.out +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"31.0.0"} \ No newline at end of file +{"version":"32.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/integ.json index c47e59ad459a8..6f4587658e3bc 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/integ.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "31.0.0", + "version": "32.0.0", "testCases": { "integ.run-batch-job": { "stacks": [ diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/manifest.json index db09a3d1ea42b..8808d28aaea48 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/manifest.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "31.0.0", + "version": "32.0.0", "artifacts": { "aws-stepfunctions-integ.assets": { "type": "cdk:asset-manifest", @@ -17,7 +17,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/02f57d4a4fe6e856437076797ed3037dbed370ebb26574bc4a5d570ab0b0b478.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/d52c690255570b27d7cc2b49792058ef0c678d1fd7345f8dda5ef9e9a5d9dc05.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -260,15 +260,6 @@ "type": "aws:cdk:logicalId", "data": "CheckBootstrapVersion" } - ], - "JobQueueC5644E0D": [ - { - "type": "aws:cdk:logicalId", - "data": "JobQueueC5644E0D", - "trace": [ - "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" - ] - } ] }, "displayName": "aws-stepfunctions-integ" diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/tree.json index ee7601231ded0..be6423c4434dd 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/tree.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/tree.json @@ -815,7 +815,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-batch-alpha.ManagedEc2EcsComputeEnvironment", + "fqn": "aws-cdk-lib.Resource", "version": "0.0.0" } }, @@ -851,7 +851,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-batch-alpha.JobQueue", + "fqn": "aws-cdk-lib.Resource", "version": "0.0.0" } }, @@ -908,6 +908,33 @@ "aws:cdk:cloudformation:props": { "policyDocument": { "Statement": [ + { + "Action": [ + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/batch/job:*" + ] + ] + } + }, { "Action": [ "ecr:BatchCheckLayerAvailability", @@ -972,6 +999,14 @@ "version": "0.0.0" } }, + "batchDefaultLogGroup": { + "id": "batchDefaultLogGroup", + "path": "aws-stepfunctions-integ/Container/batchDefaultLogGroup", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, "AssetImage": { "id": "AssetImage", "path": "aws-stepfunctions-integ/Container/AssetImage", @@ -1000,8 +1035,8 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-batch-alpha.EcsEc2ContainerDefinition", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.55" } }, "JobDefinition": { @@ -1052,7 +1087,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-batch-alpha.EcsJobDefinition", + "fqn": "aws-cdk-lib.Resource", "version": "0.0.0" } }, @@ -1304,7 +1339,7 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.270" + "version": "10.2.55" } } }, diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/aws-stepfunctions-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/aws-stepfunctions-integ.assets.json index 11136685a8eb4..f7396886702c3 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/aws-stepfunctions-integ.assets.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/aws-stepfunctions-integ.assets.json @@ -1,7 +1,7 @@ { - "version": "31.0.0", + "version": "32.0.0", "files": { - "40eeb6dc0a7fbe38cdca73b998f41d71b047bf499a3554164309a332a0d0e539": { + "d920f520c73c8097151218b117e2201193abcd86b42fc5241e56c8dd98ae6ef1": { "source": { "path": "aws-stepfunctions-integ.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "40eeb6dc0a7fbe38cdca73b998f41d71b047bf499a3554164309a332a0d0e539.json", + "objectKey": "d920f520c73c8097151218b117e2201193abcd86b42fc5241e56c8dd98ae6ef1.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/aws-stepfunctions-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/aws-stepfunctions-integ.template.json index 5ed0ed2b30ed9..5e87685375f07 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/aws-stepfunctions-integ.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/aws-stepfunctions-integ.template.json @@ -529,6 +529,33 @@ "Properties": { "PolicyDocument": { "Statement": [ + { + "Action": [ + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/batch/job:*" + ] + ] + } + }, { "Action": [ "ecr:BatchCheckLayerAvailability", diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/cdk.out index 7925065efbcc4..f0b901e7c06e5 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/cdk.out +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"31.0.0"} \ No newline at end of file +{"version":"32.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/integ.json index f46207a13f9c9..6e1575ee62d3c 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/integ.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "31.0.0", + "version": "32.0.0", "testCases": { "integ.submit-job": { "stacks": [ diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/manifest.json index 74acb5cb16ce3..73dccdde1d557 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/manifest.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "31.0.0", + "version": "32.0.0", "artifacts": { "aws-stepfunctions-integ.assets": { "type": "cdk:asset-manifest", @@ -17,7 +17,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/40eeb6dc0a7fbe38cdca73b998f41d71b047bf499a3554164309a332a0d0e539.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/d920f520c73c8097151218b117e2201193abcd86b42fc5241e56c8dd98ae6ef1.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -260,15 +260,6 @@ "type": "aws:cdk:logicalId", "data": "CheckBootstrapVersion" } - ], - "JobQueueC5644E0D": [ - { - "type": "aws:cdk:logicalId", - "data": "JobQueueC5644E0D", - "trace": [ - "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" - ] - } ] }, "displayName": "aws-stepfunctions-integ" diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/tree.json index f97d2dbf74247..fce41457c9e6b 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/tree.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/tree.json @@ -815,7 +815,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-batch-alpha.ManagedEc2EcsComputeEnvironment", + "fqn": "aws-cdk-lib.Resource", "version": "0.0.0" } }, @@ -851,7 +851,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-batch-alpha.JobQueue", + "fqn": "aws-cdk-lib.Resource", "version": "0.0.0" } }, @@ -908,6 +908,33 @@ "aws:cdk:cloudformation:props": { "policyDocument": { "Statement": [ + { + "Action": [ + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/batch/job:*" + ] + ] + } + }, { "Action": [ "ecr:BatchCheckLayerAvailability", @@ -972,6 +999,14 @@ "version": "0.0.0" } }, + "batchDefaultLogGroup": { + "id": "batchDefaultLogGroup", + "path": "aws-stepfunctions-integ/Container/batchDefaultLogGroup", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, "AssetImage": { "id": "AssetImage", "path": "aws-stepfunctions-integ/Container/AssetImage", @@ -1000,8 +1035,8 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-batch-alpha.EcsEc2ContainerDefinition", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.55" } }, "JobDefinition": { @@ -1052,7 +1087,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-batch-alpha.EcsJobDefinition", + "fqn": "aws-cdk-lib.Resource", "version": "0.0.0" } }, @@ -1304,7 +1339,7 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.270" + "version": "10.2.55" } } }, diff --git a/packages/@aws-cdk/aws-batch-alpha/lib/ecs-container-definition.ts b/packages/@aws-cdk/aws-batch-alpha/lib/ecs-container-definition.ts index c4b13e6829253..34a95037a33e3 100644 --- a/packages/@aws-cdk/aws-batch-alpha/lib/ecs-container-definition.ts +++ b/packages/@aws-cdk/aws-batch-alpha/lib/ecs-container-definition.ts @@ -6,6 +6,7 @@ import { Lazy, PhysicalName, Size } from 'aws-cdk-lib/core'; import { Construct, IConstruct } from 'constructs'; import { CfnJobDefinition } from 'aws-cdk-lib/aws-batch'; import { LinuxParameters } from './linux-parameters'; +import { LogGroup } from 'aws-cdk-lib/aws-logs'; const EFS_VOLUME_SYMBOL = Symbol.for('aws-cdk-lib/aws-batch/lib/container-definition.EfsVolume'); const HOST_VOLUME_SYMBOL = Symbol.for('aws-cdk-lib/aws-batch/lib/container-definition.HostVolume'); @@ -510,7 +511,7 @@ abstract class EcsContainerDefinitionBase extends Construct implements IEcsConta this.cpu = props.cpu; this.command = props.command; this.environment = props.environment; - this.executionRole = props.executionRole ?? createExecutionRole(this, 'ExecutionRole'); + this.executionRole = props.executionRole ?? createExecutionRole(this, 'ExecutionRole', props.logging ? true : false); this.jobRole = props.jobRole; this.linuxParameters = props.linuxParameters; this.memory = props.memory; @@ -964,10 +965,17 @@ export class EcsFargateContainerDefinition extends EcsContainerDefinitionBase im }; } -function createExecutionRole(scope: Construct, id: string): iam.IRole { - return new iam.Role(scope, id, { +function createExecutionRole(scope: Construct, id: string, logging: boolean): iam.IRole { + const execRole = new iam.Role(scope, id, { assumedBy: new iam.ServicePrincipal('ecs-tasks.amazonaws.com'), // needed for cross-account access with TagParameterContainerImage roleName: PhysicalName.GENERATE_IF_NEEDED, }); + + if (!logging) { + // all jobs will fail without this if they produce any output at all when no logging is specified + LogGroup.fromLogGroupName(scope, 'batchDefaultLogGroup', '/aws/batch/job').grantWrite(execRole); + } + + return execRole; } diff --git a/packages/@aws-cdk/aws-batch-alpha/test/ecs-container-definition.test.ts b/packages/@aws-cdk/aws-batch-alpha/test/ecs-container-definition.test.ts index 9665a124136bf..378c4a08e58b4 100644 --- a/packages/@aws-cdk/aws-batch-alpha/test/ecs-container-definition.test.ts +++ b/packages/@aws-cdk/aws-batch-alpha/test/ecs-container-definition.test.ts @@ -1,4 +1,3 @@ - import { Template } from 'aws-cdk-lib/assertions'; import * as path from 'path'; import { Vpc } from 'aws-cdk-lib/aws-ec2'; @@ -46,7 +45,15 @@ describe.each([EcsEc2ContainerDefinition, EcsFargateContainerDefinition])('%p', // GIVEN beforeEach(() => { stack = new Stack(); - pascalCaseExpectedProps = capitalizePropertyNames(stack, defaultExpectedProps); + pascalCaseExpectedProps = capitalizePropertyNames(stack, { + ...defaultExpectedProps, + containerProperties: { + ...defaultExpectedProps.containerProperties, + executionRoleArn: { + 'Fn::GetAtt': ['EcsContainerExecutionRole3B199293', 'Arn'], + } as any, + }, + }); }); test('ecs container defaults', () => { @@ -60,6 +67,58 @@ describe.each([EcsEc2ContainerDefinition, EcsFargateContainerDefinition])('%p', // THEN Template.fromStack(stack).hasResourceProperties('AWS::Batch::JobDefinition', { ...pascalCaseExpectedProps, + ContainerProperties: { + ExecutionRoleArn: { + 'Fn::GetAtt': ['EcsContainerExecutionRole3B199293', 'Arn'], + }, + ...pascalCaseExpectedProps.ContainerProperties, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: { + Statement: [ + { + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { Service: 'ecs-tasks.amazonaws.com' }, + }, + ], + Version: '2012-10-17', + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: [ + 'logs:CreateLogStream', + 'logs:PutLogEvents', + ], + Effect: 'Allow', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { Ref: 'AWS::Partition' }, + ':logs:', + { Ref: 'AWS::Region' }, + ':', + { Ref: 'AWS::AccountId' }, + ':log-group:/aws/batch/job:*', + ], + ], + }, + }, + ], + Version: '2012-10-17', + }, + PolicyName: 'EcsContainerExecutionRoleDefaultPolicy6F59CD37', + Roles: [{ + Ref: 'EcsContainerExecutionRole3B199293', + }], }); }); @@ -185,7 +244,7 @@ describe.each([EcsEc2ContainerDefinition, EcsFargateContainerDefinition])('%p', }); }); - test('respects logging and creates an execution role for EC2 and Fargate containers', () => { + test('respects logging', () => { // WHEN new EcsJobDefinition(stack, 'ECSJobDefn', { container: new ContainerDefinition(stack, 'EcsContainer', { @@ -221,11 +280,13 @@ describe.each([EcsEc2ContainerDefinition, EcsFargateContainerDefinition])('%p', Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { AssumeRolePolicyDocument: { - Statement: [{ - Action: 'sts:AssumeRole', - Effect: 'Allow', - Principal: { Service: 'ecs-tasks.amazonaws.com' }, - }], + Statement: [ + { + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { Service: 'ecs-tasks.amazonaws.com' }, + }, + ], Version: '2012-10-17', }, }); @@ -564,7 +625,15 @@ describe('EC2 containers', () => { // GIVEN beforeEach(() => { stack = new Stack(); - pascalCaseExpectedProps = capitalizePropertyNames(stack, defaultExpectedProps); + pascalCaseExpectedProps = capitalizePropertyNames(stack, { + ...defaultExpectedProps, + containerProperties: { + ...defaultExpectedProps.containerProperties, + executionRoleArn: { + 'Fn::GetAtt': ['EcsEc2ContainerExecutionRole90E18680', 'Arn'], + } as any, + }, + }); }); test('respects addUlimit()', () => { @@ -708,7 +777,15 @@ describe('Fargate containers', () => { // GIVEN beforeEach(() => { stack = new Stack(); - pascalCaseExpectedProps = capitalizePropertyNames(stack, defaultExpectedProps); + pascalCaseExpectedProps = capitalizePropertyNames(stack, { + ...defaultExpectedProps, + containerProperties: { + ...defaultExpectedProps.containerProperties, + executionRoleArn: { + 'Fn::GetAtt': ['EcsContainerExecutionRole3B199293', 'Arn'], + } as any, + }, + }); }); test('create executionRole by default', () => { diff --git a/packages/@aws-cdk/aws-batch-alpha/test/integ.batch-unique-name.js.snapshot/BatchUniqueNameTestDefaultTestDeployAssertA3886AB9.assets.json b/packages/@aws-cdk/aws-batch-alpha/test/integ.batch-unique-name.js.snapshot/BatchUniqueNameTestDefaultTestDeployAssertA3886AB9.assets.json index 88a57b8a212ac..3f096020141c2 100644 --- a/packages/@aws-cdk/aws-batch-alpha/test/integ.batch-unique-name.js.snapshot/BatchUniqueNameTestDefaultTestDeployAssertA3886AB9.assets.json +++ b/packages/@aws-cdk/aws-batch-alpha/test/integ.batch-unique-name.js.snapshot/BatchUniqueNameTestDefaultTestDeployAssertA3886AB9.assets.json @@ -1,5 +1,5 @@ { - "version": "31.0.0", + "version": "32.0.0", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/packages/@aws-cdk/aws-batch-alpha/test/integ.batch-unique-name.js.snapshot/cdk.out b/packages/@aws-cdk/aws-batch-alpha/test/integ.batch-unique-name.js.snapshot/cdk.out index 7925065efbcc4..f0b901e7c06e5 100644 --- a/packages/@aws-cdk/aws-batch-alpha/test/integ.batch-unique-name.js.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-batch-alpha/test/integ.batch-unique-name.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"31.0.0"} \ No newline at end of file +{"version":"32.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-batch-alpha/test/integ.batch-unique-name.js.snapshot/integ.json b/packages/@aws-cdk/aws-batch-alpha/test/integ.batch-unique-name.js.snapshot/integ.json index 97b9e03789c80..c87c6567f2c0c 100644 --- a/packages/@aws-cdk/aws-batch-alpha/test/integ.batch-unique-name.js.snapshot/integ.json +++ b/packages/@aws-cdk/aws-batch-alpha/test/integ.batch-unique-name.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "31.0.0", + "version": "32.0.0", "testCases": { "BatchUniqueNameTest/DefaultTest": { "stacks": [ diff --git a/packages/@aws-cdk/aws-batch-alpha/test/integ.batch-unique-name.js.snapshot/manifest.json b/packages/@aws-cdk/aws-batch-alpha/test/integ.batch-unique-name.js.snapshot/manifest.json index 8e8e764599acf..4ae80081afe11 100644 --- a/packages/@aws-cdk/aws-batch-alpha/test/integ.batch-unique-name.js.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-batch-alpha/test/integ.batch-unique-name.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "31.0.0", + "version": "32.0.0", "artifacts": { "stack.assets": { "type": "cdk:asset-manifest", @@ -17,7 +17,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/b7ced7357affd7e042169b0e624c985927080c1c2782ecab4a60b7b323cf14c4.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/dcf58b3d7fe509c8815682983476ddf759ae76a3c8a96611f347f5d93c687a68.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -57,6 +57,12 @@ "data": "containerExecutionRoleFD602179" } ], + "/stack/container/ExecutionRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "containerExecutionRoleDefaultPolicyF00DA4D6" + } + ], "/stack/MyJob/Resource": [ { "type": "aws:cdk:logicalId", @@ -92,15 +98,6 @@ "type": "aws:cdk:logicalId", "data": "CheckBootstrapVersion" } - ], - "MyQueue4F9177CF": [ - { - "type": "aws:cdk:logicalId", - "data": "MyQueue4F9177CF", - "trace": [ - "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" - ] - } ] }, "displayName": "stack" diff --git a/packages/@aws-cdk/aws-batch-alpha/test/integ.batch-unique-name.js.snapshot/stack.assets.json b/packages/@aws-cdk/aws-batch-alpha/test/integ.batch-unique-name.js.snapshot/stack.assets.json index b3fe00f78a845..8359b52766a39 100644 --- a/packages/@aws-cdk/aws-batch-alpha/test/integ.batch-unique-name.js.snapshot/stack.assets.json +++ b/packages/@aws-cdk/aws-batch-alpha/test/integ.batch-unique-name.js.snapshot/stack.assets.json @@ -1,7 +1,7 @@ { - "version": "31.0.0", + "version": "32.0.0", "files": { - "b7ced7357affd7e042169b0e624c985927080c1c2782ecab4a60b7b323cf14c4": { + "dcf58b3d7fe509c8815682983476ddf759ae76a3c8a96611f347f5d93c687a68": { "source": { "path": "stack.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "b7ced7357affd7e042169b0e624c985927080c1c2782ecab4a60b7b323cf14c4.json", + "objectKey": "dcf58b3d7fe509c8815682983476ddf759ae76a3c8a96611f347f5d93c687a68.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-batch-alpha/test/integ.batch-unique-name.js.snapshot/stack.template.json b/packages/@aws-cdk/aws-batch-alpha/test/integ.batch-unique-name.js.snapshot/stack.template.json index 4fe3817737ebf..4947e491e1ecd 100644 --- a/packages/@aws-cdk/aws-batch-alpha/test/integ.batch-unique-name.js.snapshot/stack.template.json +++ b/packages/@aws-cdk/aws-batch-alpha/test/integ.batch-unique-name.js.snapshot/stack.template.json @@ -79,6 +79,49 @@ } } }, + "containerExecutionRoleDefaultPolicyF00DA4D6": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/batch/job:*" + ] + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "containerExecutionRoleDefaultPolicyF00DA4D6", + "Roles": [ + { + "Ref": "containerExecutionRoleFD602179" + } + ] + } + }, "MyJob8719E923": { "Type": "AWS::Batch::JobDefinition", "Properties": { diff --git a/packages/@aws-cdk/aws-batch-alpha/test/integ.batch-unique-name.js.snapshot/tree.json b/packages/@aws-cdk/aws-batch-alpha/test/integ.batch-unique-name.js.snapshot/tree.json index 66c1a3a44874a..68642fa7859d7 100644 --- a/packages/@aws-cdk/aws-batch-alpha/test/integ.batch-unique-name.js.snapshot/tree.json +++ b/packages/@aws-cdk/aws-batch-alpha/test/integ.batch-unique-name.js.snapshot/tree.json @@ -92,7 +92,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-batch-alpha.UnmanagedComputeEnvironment", + "fqn": "aws-cdk-lib.Resource", "version": "0.0.0" } }, @@ -128,7 +128,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-batch-alpha.JobQueue", + "fqn": "aws-cdk-lib.Resource", "version": "0.0.0" } }, @@ -172,17 +172,86 @@ "fqn": "aws-cdk-lib.aws_iam.CfnRole", "version": "0.0.0" } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "stack/container/ExecutionRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "stack/container/ExecutionRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/batch/job:*" + ] + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "containerExecutionRoleDefaultPolicyF00DA4D6", + "roles": [ + { + "Ref": "containerExecutionRoleFD602179" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", "version": "0.0.0" } + }, + "batchDefaultLogGroup": { + "id": "batchDefaultLogGroup", + "path": "stack/container/batchDefaultLogGroup", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } } }, "constructInfo": { - "fqn": "@aws-cdk/aws-batch-alpha.EcsEc2ContainerDefinition", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.55" } }, "MyJob": { @@ -323,7 +392,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-batch-alpha.EcsJobDefinition", + "fqn": "aws-cdk-lib.Resource", "version": "0.0.0" } }, @@ -410,7 +479,7 @@ "path": "BatchUniqueNameTest/DefaultTest/Default", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.270" + "version": "10.2.55" } }, "DeployAssert": { @@ -456,7 +525,7 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.270" + "version": "10.2.55" } } }, diff --git a/packages/@aws-cdk/aws-batch-alpha/test/integ.ecs-job-definition.js.snapshot/manifest.json b/packages/@aws-cdk/aws-batch-alpha/test/integ.ecs-job-definition.js.snapshot/manifest.json index 765c5357a348f..930242adf5963 100644 --- a/packages/@aws-cdk/aws-batch-alpha/test/integ.ecs-job-definition.js.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-batch-alpha/test/integ.ecs-job-definition.js.snapshot/manifest.json @@ -17,7 +17,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/dbfcc646c8225dd32d69798b87a8a94086dd89a2b3137bdf4e0ec96d79cdd4cb.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/c8dd0c72ae74118e7b13f5ad3ad3bd3daaa9115456be74990c685759252458a6.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -207,6 +207,12 @@ "data": "myContainerExecutionRoleEBACF86C" } ], + "/stack/myContainer/ExecutionRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "myContainerExecutionRoleDefaultPolicy42DA929E" + } + ], "/stack/ECSJobDefn/Resource": [ { "type": "aws:cdk:logicalId", @@ -219,6 +225,12 @@ "data": "myFargateContainerExecutionRoleB9EB79EA" } ], + "/stack/myFargateContainer/ExecutionRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "myFargateContainerExecutionRoleDefaultPolicy4FF431BF" + } + ], "/stack/ECSFargateJobDefn/Resource": [ { "type": "aws:cdk:logicalId", diff --git a/packages/@aws-cdk/aws-batch-alpha/test/integ.ecs-job-definition.js.snapshot/stack.assets.json b/packages/@aws-cdk/aws-batch-alpha/test/integ.ecs-job-definition.js.snapshot/stack.assets.json index d33d36502bf5f..2ca8cbd4fec95 100644 --- a/packages/@aws-cdk/aws-batch-alpha/test/integ.ecs-job-definition.js.snapshot/stack.assets.json +++ b/packages/@aws-cdk/aws-batch-alpha/test/integ.ecs-job-definition.js.snapshot/stack.assets.json @@ -1,7 +1,7 @@ { "version": "32.0.0", "files": { - "dbfcc646c8225dd32d69798b87a8a94086dd89a2b3137bdf4e0ec96d79cdd4cb": { + "c8dd0c72ae74118e7b13f5ad3ad3bd3daaa9115456be74990c685759252458a6": { "source": { "path": "stack.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "dbfcc646c8225dd32d69798b87a8a94086dd89a2b3137bdf4e0ec96d79cdd4cb.json", + "objectKey": "c8dd0c72ae74118e7b13f5ad3ad3bd3daaa9115456be74990c685759252458a6.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-batch-alpha/test/integ.ecs-job-definition.js.snapshot/stack.template.json b/packages/@aws-cdk/aws-batch-alpha/test/integ.ecs-job-definition.js.snapshot/stack.template.json index 00e64916fd22c..072500c6c0127 100644 --- a/packages/@aws-cdk/aws-batch-alpha/test/integ.ecs-job-definition.js.snapshot/stack.template.json +++ b/packages/@aws-cdk/aws-batch-alpha/test/integ.ecs-job-definition.js.snapshot/stack.template.json @@ -490,6 +490,49 @@ } } }, + "myContainerExecutionRoleDefaultPolicy42DA929E": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/batch/job:*" + ] + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "myContainerExecutionRoleDefaultPolicy42DA929E", + "Roles": [ + { + "Ref": "myContainerExecutionRoleEBACF86C" + } + ] + } + }, "ECSJobDefn48425E25": { "Type": "AWS::Batch::JobDefinition", "Properties": { @@ -589,6 +632,49 @@ } } }, + "myFargateContainerExecutionRoleDefaultPolicy4FF431BF": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/batch/job:*" + ] + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "myFargateContainerExecutionRoleDefaultPolicy4FF431BF", + "Roles": [ + { + "Ref": "myFargateContainerExecutionRoleB9EB79EA" + } + ] + } + }, "ECSFargateJobDefn327BE725": { "Type": "AWS::Batch::JobDefinition", "Properties": { @@ -678,6 +764,33 @@ "Properties": { "PolicyDocument": { "Statement": [ + { + "Action": [ + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/batch/job:*" + ] + ] + } + }, { "Action": [ "ecr:BatchCheckLayerAvailability", diff --git a/packages/@aws-cdk/aws-batch-alpha/test/integ.ecs-job-definition.js.snapshot/tree.json b/packages/@aws-cdk/aws-batch-alpha/test/integ.ecs-job-definition.js.snapshot/tree.json index 041b6d0faa434..45e4ea126882c 100644 --- a/packages/@aws-cdk/aws-batch-alpha/test/integ.ecs-job-definition.js.snapshot/tree.json +++ b/packages/@aws-cdk/aws-batch-alpha/test/integ.ecs-job-definition.js.snapshot/tree.json @@ -839,17 +839,86 @@ "fqn": "aws-cdk-lib.aws_iam.CfnRole", "version": "0.0.0" } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "stack/myContainer/ExecutionRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "stack/myContainer/ExecutionRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/batch/job:*" + ] + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "myContainerExecutionRoleDefaultPolicy42DA929E", + "roles": [ + { + "Ref": "myContainerExecutionRoleEBACF86C" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", "version": "0.0.0" } + }, + "batchDefaultLogGroup": { + "id": "batchDefaultLogGroup", + "path": "stack/myContainer/batchDefaultLogGroup", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.52" + "version": "10.2.55" } }, "ECSJobDefn": { @@ -992,17 +1061,86 @@ "fqn": "aws-cdk-lib.aws_iam.CfnRole", "version": "0.0.0" } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "stack/myFargateContainer/ExecutionRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "stack/myFargateContainer/ExecutionRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/batch/job:*" + ] + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "myFargateContainerExecutionRoleDefaultPolicy4FF431BF", + "roles": [ + { + "Ref": "myFargateContainerExecutionRoleB9EB79EA" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", "version": "0.0.0" } + }, + "batchDefaultLogGroup": { + "id": "batchDefaultLogGroup", + "path": "stack/myFargateContainer/batchDefaultLogGroup", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.52" + "version": "10.2.55" } }, "ECSFargateJobDefn": { @@ -1169,6 +1307,33 @@ "aws:cdk:cloudformation:props": { "policyDocument": { "Statement": [ + { + "Action": [ + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/batch/job:*" + ] + ] + } + }, { "Action": [ "ecr:BatchCheckLayerAvailability", @@ -1232,11 +1397,19 @@ "fqn": "aws-cdk-lib.aws_iam.Role", "version": "0.0.0" } + }, + "batchDefaultLogGroup": { + "id": "batchDefaultLogGroup", + "path": "stack/EcsDockerContainer/batchDefaultLogGroup", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.52" + "version": "10.2.55" } }, "ECSDockerJobDefn": { @@ -1326,7 +1499,7 @@ "path": "BatchEcsJobDefinitionTest/DefaultTest/Default", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.52" + "version": "10.2.55" } }, "DeployAssert": { @@ -1372,7 +1545,7 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.52" + "version": "10.2.55" } } }, diff --git a/packages/@aws-cdk/aws-batch-alpha/test/integ.multinode-job-definition.js.snapshot/BatchMultiNodeJobDefinitionTestDefaultTestDeployAssertDB834B9D.assets.json b/packages/@aws-cdk/aws-batch-alpha/test/integ.multinode-job-definition.js.snapshot/BatchMultiNodeJobDefinitionTestDefaultTestDeployAssertDB834B9D.assets.json index 3f494b7c45c2e..17b5f9b65eb52 100644 --- a/packages/@aws-cdk/aws-batch-alpha/test/integ.multinode-job-definition.js.snapshot/BatchMultiNodeJobDefinitionTestDefaultTestDeployAssertDB834B9D.assets.json +++ b/packages/@aws-cdk/aws-batch-alpha/test/integ.multinode-job-definition.js.snapshot/BatchMultiNodeJobDefinitionTestDefaultTestDeployAssertDB834B9D.assets.json @@ -1,5 +1,5 @@ { - "version": "31.0.0", + "version": "32.0.0", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/packages/@aws-cdk/aws-batch-alpha/test/integ.multinode-job-definition.js.snapshot/cdk.out b/packages/@aws-cdk/aws-batch-alpha/test/integ.multinode-job-definition.js.snapshot/cdk.out index 7925065efbcc4..f0b901e7c06e5 100644 --- a/packages/@aws-cdk/aws-batch-alpha/test/integ.multinode-job-definition.js.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-batch-alpha/test/integ.multinode-job-definition.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"31.0.0"} \ No newline at end of file +{"version":"32.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-batch-alpha/test/integ.multinode-job-definition.js.snapshot/integ.json b/packages/@aws-cdk/aws-batch-alpha/test/integ.multinode-job-definition.js.snapshot/integ.json index 8e804b6114cab..260082c7a2ab6 100644 --- a/packages/@aws-cdk/aws-batch-alpha/test/integ.multinode-job-definition.js.snapshot/integ.json +++ b/packages/@aws-cdk/aws-batch-alpha/test/integ.multinode-job-definition.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "31.0.0", + "version": "32.0.0", "testCases": { "BatchMultiNodeJobDefinitionTest/DefaultTest": { "stacks": [ diff --git a/packages/@aws-cdk/aws-batch-alpha/test/integ.multinode-job-definition.js.snapshot/manifest.json b/packages/@aws-cdk/aws-batch-alpha/test/integ.multinode-job-definition.js.snapshot/manifest.json index c74907da62cc2..743551c487d8c 100644 --- a/packages/@aws-cdk/aws-batch-alpha/test/integ.multinode-job-definition.js.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-batch-alpha/test/integ.multinode-job-definition.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "31.0.0", + "version": "32.0.0", "artifacts": { "stack.assets": { "type": "cdk:asset-manifest", @@ -17,7 +17,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/2ad190c3f65538c3f31f945af85e9694bb6677d6b0dbf3f724c89003d6e903b5.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/79bf9bc31318f31367fd9137a6bb59249d5afff9035d0d7dbd73aa96088735f2.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -39,6 +39,12 @@ "data": "myContainerExecutionRoleEBACF86C" } ], + "/stack/myContainer/ExecutionRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "myContainerExecutionRoleDefaultPolicy42DA929E" + } + ], "/stack/SingleContainerMultiNodeJob/Resource": [ { "type": "aws:cdk:logicalId", @@ -51,6 +57,12 @@ "data": "multinodecontainerExecutionRoleAB7AA30A" } ], + "/stack/multinodecontainer/ExecutionRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "multinodecontainerExecutionRoleDefaultPolicy2AAB071A" + } + ], "/stack/MultiContainerMultiNodeJob/Resource": [ { "type": "aws:cdk:logicalId", @@ -63,6 +75,12 @@ "data": "multiContainerExecutionRole317DED72" } ], + "/stack/multiContainer/ExecutionRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "multiContainerExecutionRoleDefaultPolicyE3E7D32C" + } + ], "/stack/BootstrapVersion": [ { "type": "aws:cdk:logicalId", diff --git a/packages/@aws-cdk/aws-batch-alpha/test/integ.multinode-job-definition.js.snapshot/stack.assets.json b/packages/@aws-cdk/aws-batch-alpha/test/integ.multinode-job-definition.js.snapshot/stack.assets.json index 574b7c73ccab1..eb96840e2c534 100644 --- a/packages/@aws-cdk/aws-batch-alpha/test/integ.multinode-job-definition.js.snapshot/stack.assets.json +++ b/packages/@aws-cdk/aws-batch-alpha/test/integ.multinode-job-definition.js.snapshot/stack.assets.json @@ -1,7 +1,7 @@ { - "version": "31.0.0", + "version": "32.0.0", "files": { - "2ad190c3f65538c3f31f945af85e9694bb6677d6b0dbf3f724c89003d6e903b5": { + "79bf9bc31318f31367fd9137a6bb59249d5afff9035d0d7dbd73aa96088735f2": { "source": { "path": "stack.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "2ad190c3f65538c3f31f945af85e9694bb6677d6b0dbf3f724c89003d6e903b5.json", + "objectKey": "79bf9bc31318f31367fd9137a6bb59249d5afff9035d0d7dbd73aa96088735f2.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-batch-alpha/test/integ.multinode-job-definition.js.snapshot/stack.template.json b/packages/@aws-cdk/aws-batch-alpha/test/integ.multinode-job-definition.js.snapshot/stack.template.json index ccf13f3c895f8..548695e4384f8 100644 --- a/packages/@aws-cdk/aws-batch-alpha/test/integ.multinode-job-definition.js.snapshot/stack.template.json +++ b/packages/@aws-cdk/aws-batch-alpha/test/integ.multinode-job-definition.js.snapshot/stack.template.json @@ -17,6 +17,49 @@ } } }, + "myContainerExecutionRoleDefaultPolicy42DA929E": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/batch/job:*" + ] + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "myContainerExecutionRoleDefaultPolicy42DA929E", + "Roles": [ + { + "Ref": "myContainerExecutionRoleEBACF86C" + } + ] + } + }, "SingleContainerMultiNodeJob1118AC82": { "Type": "AWS::Batch::JobDefinition", "Properties": { @@ -77,6 +120,49 @@ } } }, + "multinodecontainerExecutionRoleDefaultPolicy2AAB071A": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/batch/job:*" + ] + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "multinodecontainerExecutionRoleDefaultPolicy2AAB071A", + "Roles": [ + { + "Ref": "multinodecontainerExecutionRoleAB7AA30A" + } + ] + } + }, "MultiContainerMultiNodeJobBA8ED368": { "Type": "AWS::Batch::JobDefinition", "Properties": { @@ -160,6 +246,49 @@ "Version": "2012-10-17" } } + }, + "multiContainerExecutionRoleDefaultPolicyE3E7D32C": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/batch/job:*" + ] + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "multiContainerExecutionRoleDefaultPolicyE3E7D32C", + "Roles": [ + { + "Ref": "multiContainerExecutionRole317DED72" + } + ] + } } }, "Parameters": { diff --git a/packages/@aws-cdk/aws-batch-alpha/test/integ.multinode-job-definition.js.snapshot/tree.json b/packages/@aws-cdk/aws-batch-alpha/test/integ.multinode-job-definition.js.snapshot/tree.json index b72641f15378e..1b8ed884bff95 100644 --- a/packages/@aws-cdk/aws-batch-alpha/test/integ.multinode-job-definition.js.snapshot/tree.json +++ b/packages/@aws-cdk/aws-batch-alpha/test/integ.multinode-job-definition.js.snapshot/tree.json @@ -20,8 +20,8 @@ "id": "ImportExecutionRole", "path": "stack/myContainer/ExecutionRole/ImportExecutionRole", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.270" + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" } }, "Resource": { @@ -45,20 +45,89 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "stack/myContainer/ExecutionRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "stack/myContainer/ExecutionRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/batch/job:*" + ] + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "myContainerExecutionRoleDefaultPolicy42DA929E", + "roles": [ + { + "Ref": "myContainerExecutionRoleEBACF86C" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", "version": "0.0.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "batchDefaultLogGroup": { + "id": "batchDefaultLogGroup", + "path": "stack/myContainer/batchDefaultLogGroup", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", "version": "0.0.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/aws-batch.EcsEc2ContainerDefinition", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.55" } }, "SingleContainerMultiNodeJob": { @@ -112,13 +181,13 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-batch.CfnJobDefinition", + "fqn": "aws-cdk-lib.aws_batch.CfnJobDefinition", "version": "0.0.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/aws-batch.MultiNodeJobDefinition", + "fqn": "aws-cdk-lib.Resource", "version": "0.0.0" } }, @@ -134,8 +203,8 @@ "id": "ImportExecutionRole", "path": "stack/multinodecontainer/ExecutionRole/ImportExecutionRole", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.270" + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" } }, "Resource": { @@ -159,20 +228,89 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "stack/multinodecontainer/ExecutionRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "stack/multinodecontainer/ExecutionRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/batch/job:*" + ] + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "multinodecontainerExecutionRoleDefaultPolicy2AAB071A", + "roles": [ + { + "Ref": "multinodecontainerExecutionRoleAB7AA30A" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", "version": "0.0.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "batchDefaultLogGroup": { + "id": "batchDefaultLogGroup", + "path": "stack/multinodecontainer/batchDefaultLogGroup", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", "version": "0.0.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/aws-batch.EcsEc2ContainerDefinition", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.55" } }, "MultiContainerMultiNodeJob": { @@ -250,13 +388,13 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-batch.CfnJobDefinition", + "fqn": "aws-cdk-lib.aws_batch.CfnJobDefinition", "version": "0.0.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/aws-batch.MultiNodeJobDefinition", + "fqn": "aws-cdk-lib.Resource", "version": "0.0.0" } }, @@ -272,8 +410,8 @@ "id": "ImportExecutionRole", "path": "stack/multiContainer/ExecutionRole/ImportExecutionRole", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.270" + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" } }, "Resource": { @@ -297,42 +435,111 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "stack/multiContainer/ExecutionRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "stack/multiContainer/ExecutionRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/batch/job:*" + ] + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "multiContainerExecutionRoleDefaultPolicyE3E7D32C", + "roles": [ + { + "Ref": "multiContainerExecutionRole317DED72" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", "version": "0.0.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "batchDefaultLogGroup": { + "id": "batchDefaultLogGroup", + "path": "stack/multiContainer/batchDefaultLogGroup", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", "version": "0.0.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/aws-batch.EcsEc2ContainerDefinition", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.55" } }, "BootstrapVersion": { "id": "BootstrapVersion", "path": "stack/BootstrapVersion", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.270" + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" } }, "CheckBootstrapVersion": { "id": "CheckBootstrapVersion", "path": "stack/CheckBootstrapVersion", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.270" + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.270" + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" } }, "BatchMultiNodeJobDefinitionTest": { @@ -348,7 +555,7 @@ "path": "BatchMultiNodeJobDefinitionTest/DefaultTest/Default", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.270" + "version": "10.2.55" } }, "DeployAssert": { @@ -359,33 +566,33 @@ "id": "BootstrapVersion", "path": "BatchMultiNodeJobDefinitionTest/DefaultTest/DeployAssert/BootstrapVersion", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.270" + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" } }, "CheckBootstrapVersion": { "id": "CheckBootstrapVersion", "path": "BatchMultiNodeJobDefinitionTest/DefaultTest/DeployAssert/CheckBootstrapVersion", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.270" + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.270" + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/integ-tests.IntegTestCase", + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", "version": "0.0.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/integ-tests.IntegTest", + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", "version": "0.0.0" } }, @@ -394,13 +601,13 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.270" + "version": "10.2.55" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.270" + "fqn": "aws-cdk-lib.App", + "version": "0.0.0" } } } \ No newline at end of file