Skip to content

Commit 62f08f4

Browse files
committed
fix(stepfunctions): distributed maps under branches
distributed maps under branch states (i.e., Parallel) do not apply the necessary permissions to run the state. this moves the bind functionality into state and calls it on both state and all child states. rather than relying on the single purpose that it is now (add distributed map perms) and fast returning all the way out, this instead just checks if the policy it is trying to add is in place before proceeding and uses that condition to return immediately.
1 parent 1d16304 commit 62f08f4

File tree

12 files changed

+1090
-18
lines changed

12 files changed

+1090
-18
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.map-distributed-iam.js.snapshot/cdk-stepfunctions-map-distributed-stack.assets.json

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
{
2+
"Resources": {
3+
"StateMachine1RoleDE82F282": {
4+
"Type": "AWS::IAM::Role",
5+
"Properties": {
6+
"AssumeRolePolicyDocument": {
7+
"Statement": [
8+
{
9+
"Action": "sts:AssumeRole",
10+
"Effect": "Allow",
11+
"Principal": {
12+
"Service": "states.amazonaws.com"
13+
}
14+
}
15+
],
16+
"Version": "2012-10-17"
17+
}
18+
}
19+
},
20+
"StateMachine18AFC9B86": {
21+
"Type": "AWS::StepFunctions::StateMachine",
22+
"Properties": {
23+
"DefinitionString": "{\"StartAt\":\"My-Map-State\",\"States\":{\"My-Map-State\":{\"Type\":\"Map\",\"End\":true,\"ItemsPath\":\"$.inputForMap\",\"ItemSelector\":{\"foo\":\"foo\",\"bar.$\":\"$.bar\"},\"ItemProcessor\":{\"ProcessorConfig\":{\"Mode\":\"DISTRIBUTED\",\"ExecutionType\":\"STANDARD\"},\"StartAt\":\"Pass State 1\",\"States\":{\"Pass State 1\":{\"Type\":\"Pass\",\"End\":true}}},\"MaxConcurrencyPath\":\"$.maxConcurrency\"}},\"TimeoutSeconds\":30}",
24+
"RoleArn": {
25+
"Fn::GetAtt": [
26+
"StateMachine1RoleDE82F282",
27+
"Arn"
28+
]
29+
}
30+
},
31+
"DependsOn": [
32+
"StateMachine1RoleDE82F282"
33+
],
34+
"UpdateReplacePolicy": "Delete",
35+
"DeletionPolicy": "Delete"
36+
},
37+
"StateMachine1DistributedMapPolicyA6BF4F8F": {
38+
"Type": "AWS::IAM::Policy",
39+
"Properties": {
40+
"PolicyDocument": {
41+
"Statement": [
42+
{
43+
"Action": "states:StartExecution",
44+
"Effect": "Allow",
45+
"Resource": {
46+
"Ref": "StateMachine18AFC9B86"
47+
}
48+
},
49+
{
50+
"Action": [
51+
"states:DescribeExecution",
52+
"states:StopExecution"
53+
],
54+
"Effect": "Allow",
55+
"Resource": {
56+
"Fn::Join": [
57+
"",
58+
[
59+
{
60+
"Ref": "StateMachine18AFC9B86"
61+
},
62+
":*"
63+
]
64+
]
65+
}
66+
}
67+
],
68+
"Version": "2012-10-17"
69+
},
70+
"PolicyName": "StateMachine1DistributedMapPolicyA6BF4F8F",
71+
"Roles": [
72+
{
73+
"Ref": "StateMachine1RoleDE82F282"
74+
}
75+
]
76+
}
77+
},
78+
"StateMachine2Role6BE3CF0B": {
79+
"Type": "AWS::IAM::Role",
80+
"Properties": {
81+
"AssumeRolePolicyDocument": {
82+
"Statement": [
83+
{
84+
"Action": "sts:AssumeRole",
85+
"Effect": "Allow",
86+
"Principal": {
87+
"Service": "states.amazonaws.com"
88+
}
89+
}
90+
],
91+
"Version": "2012-10-17"
92+
}
93+
}
94+
},
95+
"StateMachine21CE8E3CE": {
96+
"Type": "AWS::StepFunctions::StateMachine",
97+
"Properties": {
98+
"DefinitionString": "{\"StartAt\":\"My-Map-State\",\"States\":{\"My-Map-State\":{\"Type\":\"Map\",\"End\":true,\"ItemsPath\":\"$.inputForMap\",\"ItemSelector\":{\"foo\":\"foo\",\"bar.$\":\"$.bar\"},\"ItemProcessor\":{\"ProcessorConfig\":{\"Mode\":\"DISTRIBUTED\",\"ExecutionType\":\"STANDARD\"},\"StartAt\":\"Pass State 2\",\"States\":{\"Pass State 2\":{\"Type\":\"Pass\",\"End\":true}}},\"MaxConcurrencyPath\":\"$.maxConcurrency\"}},\"TimeoutSeconds\":30}",
99+
"RoleArn": {
100+
"Fn::GetAtt": [
101+
"StateMachine2Role6BE3CF0B",
102+
"Arn"
103+
]
104+
}
105+
},
106+
"DependsOn": [
107+
"StateMachine2Role6BE3CF0B"
108+
],
109+
"UpdateReplacePolicy": "Delete",
110+
"DeletionPolicy": "Delete"
111+
},
112+
"StateMachine2DistributedMapPolicyECDEB23C": {
113+
"Type": "AWS::IAM::Policy",
114+
"Properties": {
115+
"PolicyDocument": {
116+
"Statement": [
117+
{
118+
"Action": "states:StartExecution",
119+
"Effect": "Allow",
120+
"Resource": {
121+
"Ref": "StateMachine21CE8E3CE"
122+
}
123+
},
124+
{
125+
"Action": [
126+
"states:DescribeExecution",
127+
"states:StopExecution"
128+
],
129+
"Effect": "Allow",
130+
"Resource": {
131+
"Fn::Join": [
132+
"",
133+
[
134+
{
135+
"Ref": "StateMachine21CE8E3CE"
136+
},
137+
":*"
138+
]
139+
]
140+
}
141+
}
142+
],
143+
"Version": "2012-10-17"
144+
},
145+
"PolicyName": "StateMachine2DistributedMapPolicyECDEB23C",
146+
"Roles": [
147+
{
148+
"Ref": "StateMachine2Role6BE3CF0B"
149+
}
150+
]
151+
}
152+
}
153+
},
154+
"Outputs": {
155+
"StateMachine1ARN": {
156+
"Value": {
157+
"Ref": "StateMachine18AFC9B86"
158+
}
159+
},
160+
"StateMachine1RoleARN": {
161+
"Value": {
162+
"Fn::GetAtt": [
163+
"StateMachine1RoleDE82F282",
164+
"Arn"
165+
]
166+
}
167+
},
168+
"StateMachine2ARN": {
169+
"Value": {
170+
"Ref": "StateMachine21CE8E3CE"
171+
}
172+
},
173+
"StateMachine2RoleARN": {
174+
"Value": {
175+
"Fn::GetAtt": [
176+
"StateMachine2Role6BE3CF0B",
177+
"Arn"
178+
]
179+
}
180+
}
181+
},
182+
"Parameters": {
183+
"BootstrapVersion": {
184+
"Type": "AWS::SSM::Parameter::Value<String>",
185+
"Default": "/cdk-bootstrap/hnb659fds/version",
186+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
187+
}
188+
},
189+
"Rules": {
190+
"CheckBootstrapVersion": {
191+
"Assertions": [
192+
{
193+
"Assert": {
194+
"Fn::Not": [
195+
{
196+
"Fn::Contains": [
197+
[
198+
"1",
199+
"2",
200+
"3",
201+
"4",
202+
"5"
203+
],
204+
{
205+
"Ref": "BootstrapVersion"
206+
}
207+
]
208+
}
209+
]
210+
},
211+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
212+
}
213+
]
214+
}
215+
}
216+
}

packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.map-distributed-iam.js.snapshot/cdk.out

Lines changed: 1 addition & 0 deletions
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-stepfunctions/test/integ.map-distributed-iam.js.snapshot/cdkstepfunctionsmapdistributediamintegDefaultTestDeployAssert63593303.assets.json

Lines changed: 19 additions & 0 deletions
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-stepfunctions/test/integ.map-distributed-iam.js.snapshot/cdkstepfunctionsmapdistributediamintegDefaultTestDeployAssert63593303.template.json

Lines changed: 36 additions & 0 deletions
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-stepfunctions/test/integ.map-distributed-iam.js.snapshot/integ.json

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)