Skip to content

Commit

Permalink
try to fix integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
beck3905 committed Feb 25, 2023
1 parent 7c35313 commit 8b67a01
Show file tree
Hide file tree
Showing 44 changed files with 206 additions and 82 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"version": "30.1.0",
"files": {
"e0062b6b6e5d602f62c75537111f5f7c1775579fc32bd055fc9e6eec89e4bfc6": {
"de2c198bbb6588ccbe00d0f0794f7217c429e3d7e3c5b4326e3b085b0d697753": {
"source": {
"path": "StepFunctionsRestApiDeploymentStack.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "e0062b6b6e5d602f62c75537111f5f7c1775579fc32bd055fc9e6eec89e4bfc6.json",
"objectKey": "de2c198bbb6588ccbe00d0f0794f7217c429e3d7e3c5b4326e3b085b0d697753.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
"DefinitionString": "{\"StartAt\":\"PassTask\",\"States\":{\"PassTask\":{\"Type\":\"Pass\",\"Result\":\"Hello\",\"End\":true}}}",
"StateMachineType": "EXPRESS"
},
"DependsOn": [
"StateMachineRoleB840431D"
],
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}/e0062b6b6e5d602f62c75537111f5f7c1775579fc32bd055fc9e6eec89e4bfc6.json",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/de2c198bbb6588ccbe00d0f0794f7217c429e3d7e3c5b4326e3b085b0d697753.json",
"requiresBootstrapStackVersion": 6,
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
"additionalDependencies": [
Expand Down
20 changes: 16 additions & 4 deletions packages/@aws-cdk/aws-stepfunctions/lib/state-machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ export class StateMachine extends StateMachineBase {
// depends on the state machine thus creating a circular dependency. By removing
// this statement, the circular dependency is no longer an issue.
// If removing this is approved in the PR process, I will delete it before merge.
// resource.node.addDependency(this.role);
resource.node.addDependency(this.role);

for (const statement of graph.policyStatements) {
this.addToRolePolicy(statement);
Expand All @@ -440,18 +440,30 @@ export class StateMachine extends StateMachineBase {
this.stateMachineArn = this.getResourceArnAttribute(resource.ref, {
service: 'states',
resource: 'stateMachine',
resourceName: this.physicalName,
resourceName: this.stateMachineName,
arnFormat: ArnFormat.COLON_RESOURCE_NAME,
});

if (graph.requiresExecutionPermissions) {
// this.grantStartExecution(this.role);
// this.grantExecution(this.role, 'states:DescribeExecution', 'states:StopExecution');
this.addToRolePolicy(new iam.PolicyStatement({
actions: ['states:StartExecution'],
resources: [this.stateMachineArn],
resources: [this.stack.formatArn({
service: 'states',
resource: 'stateMachine',
resourceName: '*',
arnFormat: ArnFormat.COLON_RESOURCE_NAME,
})],
}));
this.addToRolePolicy(new iam.PolicyStatement({
actions: ['states:DescribeExecution', 'states:StopExecution'],
resources: [`${this.stateMachineArn}/*`],
resources: [`${this.stack.formatArn({
service: 'states',
resource: 'execution',
resourceName: '*',
arnFormat: ArnFormat.COLON_RESOURCE_NAME,
})}:*`],
}));
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"version": "30.0.0",
"version": "30.1.0",
"files": {
"97d16bb7ba2ae6d9cb22f0b1fa8baa7c02af5176b7d5c016a6824361a838e616": {
"88187762ebb3676ec68ded03ce92c045563205c6497ae5a104f13a32dbf4ef43": {
"source": {
"path": "aws-stepfunctions-custom-state-integ.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "97d16bb7ba2ae6d9cb22f0b1fa8baa7c02af5176b7d5c016a6824361a838e616.json",
"objectKey": "88187762ebb3676ec68ded03ce92c045563205c6497ae5a104f13a32dbf4ef43.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
},
"DefinitionString": "{\"StartAt\":\"my custom task\",\"States\":{\"my custom task\":{\"Next\":\"final step\",\"Type\":\"Task\",\"Resource\":\"arn:aws:states:::dynamodb:putItem\",\"Parameters\":{\"TableName\":\"my-cool-table\",\"Item\":{\"id\":{\"S\":\"my-entry\"}}},\"ResultPath\":null},\"final step\":{\"Type\":\"Pass\",\"End\":true}},\"TimeoutSeconds\":30}"
},
"DependsOn": [
"StateMachineRoleB840431D"
],
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"30.0.0"}
{"version":"30.1.0"}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "30.0.0",
"version": "30.1.0",
"testCases": {
"integ.custom-state": {
"stacks": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "30.0.0",
"version": "30.1.0",
"artifacts": {
"aws-stepfunctions-custom-state-integ.assets": {
"type": "cdk:asset-manifest",
Expand All @@ -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}/97d16bb7ba2ae6d9cb22f0b1fa8baa7c02af5176b7d5c016a6824361a838e616.json",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/88187762ebb3676ec68ded03ce92c045563205c6497ae5a104f13a32dbf4ef43.json",
"requiresBootstrapStackVersion": 6,
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
"additionalDependencies": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
{
"version": "30.0.0",
"version": "30.1.0",
"files": {
"1f3c2cfb18e102edc713fe4c4b4d87572f4297ee4a5e80a5960adf526ee9ea28": {
"73c20a669c041469f7fc3fc03d574b093b5b97e7c716f76c1e8117e6163e4dc4": {
"source": {
"path": "asset.1f3c2cfb18e102edc713fe4c4b4d87572f4297ee4a5e80a5960adf526ee9ea28.bundle",
"path": "asset.73c20a669c041469f7fc3fc03d574b093b5b97e7c716f76c1e8117e6163e4dc4.bundle",
"packaging": "zip"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "1f3c2cfb18e102edc713fe4c4b4d87572f4297ee4a5e80a5960adf526ee9ea28.zip",
"objectKey": "73c20a669c041469f7fc3fc03d574b093b5b97e7c716f76c1e8117e6163e4dc4.zip",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
},
"9380edb21326225b7731531954a3300d128d8056a2e08756f7c804c9ac954383": {
"cc54f1f5315ec04a62e895c71c38dbce6db8a59a548cc90862749307ede8413c": {
"source": {
"path": "DistributedMapDefaultTestDeployAssertFD6CBCC4.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "9380edb21326225b7731531954a3300d128d8056a2e08756f7c804c9ac954383.json",
"objectKey": "cc54f1f5315ec04a62e895c71c38dbce6db8a59a548cc90862749307ede8413c.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
}
},
"flattenResponse": "false",
"salt": "1677270411254"
"salt": "1677308748492"
},
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
Expand Down Expand Up @@ -99,7 +99,7 @@
"S3Bucket": {
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"S3Key": "1f3c2cfb18e102edc713fe4c4b4d87572f4297ee4a5e80a5960adf526ee9ea28.zip"
"S3Key": "73c20a669c041469f7fc3fc03d574b093b5b97e7c716f76c1e8117e6163e4dc4.zip"
},
"Timeout": 120,
"Handler": "index.handler",
Expand Down Expand Up @@ -130,7 +130,7 @@
"Body": "a,b,c\n1,2,3\n4,5,6"
},
"flattenResponse": "false",
"salt": "1677270411255"
"salt": "1677308748492"
},
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
Expand All @@ -152,7 +152,7 @@
}
},
"flattenResponse": "true",
"salt": "1677270411255"
"salt": "1677308748492"
},
"DependsOn": [
"AwsApiCallS3putObject"
Expand Down Expand Up @@ -181,7 +181,7 @@
}
},
"flattenResponse": "false",
"salt": "1677270411255"
"salt": "1677308748492"
},
"DependsOn": [
"AwsApiCallStepFunctionsstartExecution"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "30.0.0",
"version": "30.1.0",
"files": {
"33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c": {
"source": {
Expand All @@ -14,15 +14,15 @@
}
}
},
"f1b74e73aade202e63063e2d1ee52583e3eef69fe17836ba1473d0db7e2a1465": {
"97b8ee3e82e13cd15aba6cf69000620fa38bd980f28e3c4f60715ff5746025e7": {
"source": {
"path": "aws-stepfunctions-map-integ.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "f1b74e73aade202e63063e2d1ee52583e3eef69fe17836ba1473d0db7e2a1465.json",
"objectKey": "97b8ee3e82e13cd15aba6cf69000620fa38bd980f28e3c4f60715ff5746025e7.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,24 @@
"Action": "states:StartExecution",
"Effect": "Allow",
"Resource": {
"Ref": "StateMachine2E01A3A5"
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":states:",
{
"Ref": "AWS::Region"
},
":",
{
"Ref": "AWS::AccountId"
},
":stateMachine:*"
]
]
}
},
{
Expand All @@ -201,10 +218,19 @@
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "StateMachine2E01A3A5"
"Ref": "AWS::Partition"
},
"/*"
":states:",
{
"Ref": "AWS::Region"
},
":",
{
"Ref": "AWS::AccountId"
},
":execution:*/*"
]
]
}
Expand Down Expand Up @@ -246,6 +272,10 @@
]
}
},
"DependsOn": [
"StateMachineRoleDefaultPolicyDF1E6607",
"StateMachineRoleB840431D"
],
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"30.0.0"}
{"version":"30.1.0"}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "30.0.0",
"version": "30.1.0",
"testCases": {
"DistributedMap/DefaultTest": {
"stacks": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "30.0.0",
"version": "30.1.0",
"artifacts": {
"aws-stepfunctions-map-integ.assets": {
"type": "cdk:asset-manifest",
Expand All @@ -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}/f1b74e73aade202e63063e2d1ee52583e3eef69fe17836ba1473d0db7e2a1465.json",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/97b8ee3e82e13cd15aba6cf69000620fa38bd980f28e3c4f60715ff5746025e7.json",
"requiresBootstrapStackVersion": 6,
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
"additionalDependencies": [
Expand Down Expand Up @@ -124,7 +124,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}/9380edb21326225b7731531954a3300d128d8056a2e08756f7c804c9ac954383.json",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/cc54f1f5315ec04a62e895c71c38dbce6db8a59a548cc90862749307ede8413c.json",
"requiresBootstrapStackVersion": 6,
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
"additionalDependencies": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,24 @@
"Action": "states:StartExecution",
"Effect": "Allow",
"Resource": {
"Ref": "StateMachine2E01A3A5"
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":states:",
{
"Ref": "AWS::Region"
},
":",
{
"Ref": "AWS::AccountId"
},
":stateMachine:*"
]
]
}
},
{
Expand All @@ -265,10 +282,19 @@
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "StateMachine2E01A3A5"
"Ref": "AWS::Partition"
},
"/*"
":states:",
{
"Ref": "AWS::Region"
},
":",
{
"Ref": "AWS::AccountId"
},
":execution:*/*"
]
]
}
Expand Down
Loading

0 comments on commit 8b67a01

Please sign in to comment.