Skip to content

Commit 9c8fa6f

Browse files
authored
v2 of Start SFN execution policy (#2955)
1 parent 6bb9d53 commit 9c8fa6f

File tree

6 files changed

+99
-1
lines changed

6 files changed

+99
-1
lines changed

samtranslator/policy_templates_data/policy_templates.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2303,6 +2303,35 @@
23032303
}
23042304
}
23052305
},
2306+
"StepFunctionsExecutionPolicy_v2": {
2307+
"Definition": {
2308+
"Statement": [
2309+
{
2310+
"Action": [
2311+
"states:StartExecution",
2312+
"states:StartSyncExecution"
2313+
],
2314+
"Effect": "Allow",
2315+
"Resource": {
2316+
"Fn::Sub": [
2317+
"arn:${AWS::Partition}:states:${AWS::Region}:${AWS::AccountId}:stateMachine:${stateMachineName}",
2318+
{
2319+
"stateMachineName": {
2320+
"Ref": "StateMachineName"
2321+
}
2322+
}
2323+
]
2324+
}
2325+
}
2326+
]
2327+
},
2328+
"Description": "Gives permission to start a Step Functions state machine execution",
2329+
"Parameters": {
2330+
"StateMachineName": {
2331+
"Description": "The name of the state machine to execute."
2332+
}
2333+
}
2334+
},
23062335
"TextractDetectAnalyzePolicy": {
23072336
"Definition": {
23082337
"Statement": [

samtranslator/policy_templates_data/schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"Templates": {
7070
"additionalProperties": false,
7171
"patternProperties": {
72-
"^[a-zA-Z0-9]+Policy$": {
72+
"^[a-zA-Z0-9]+Policy(_v[0-9])?$": {
7373
"$ref": "#/definitions/template"
7474
}
7575
},

tests/translator/input/all_policy_templates.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,3 +177,6 @@ Resources:
177177

178178
- SSMParameterWithSlashPrefixReadPolicy:
179179
ParameterName: /name
180+
181+
- StepFunctionsExecutionPolicy_v2:
182+
StateMachineName: name

tests/translator/output/all_policy_templates.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1639,6 +1639,28 @@
16391639
]
16401640
},
16411641
"PolicyName": "KitchenSinkFunctionRolePolicy60"
1642+
},
1643+
{
1644+
"PolicyDocument": {
1645+
"Statement": [
1646+
{
1647+
"Action": [
1648+
"states:StartExecution",
1649+
"states:StartSyncExecution"
1650+
],
1651+
"Effect": "Allow",
1652+
"Resource": {
1653+
"Fn::Sub": [
1654+
"arn:${AWS::Partition}:states:${AWS::Region}:${AWS::AccountId}:stateMachine:${stateMachineName}",
1655+
{
1656+
"stateMachineName": "name"
1657+
}
1658+
]
1659+
}
1660+
}
1661+
]
1662+
},
1663+
"PolicyName": "KitchenSinkFunctionRolePolicy61"
16421664
}
16431665
],
16441666
"Tags": [

tests/translator/output/aws-cn/all_policy_templates.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1639,6 +1639,28 @@
16391639
]
16401640
},
16411641
"PolicyName": "KitchenSinkFunctionRolePolicy60"
1642+
},
1643+
{
1644+
"PolicyDocument": {
1645+
"Statement": [
1646+
{
1647+
"Action": [
1648+
"states:StartExecution",
1649+
"states:StartSyncExecution"
1650+
],
1651+
"Effect": "Allow",
1652+
"Resource": {
1653+
"Fn::Sub": [
1654+
"arn:${AWS::Partition}:states:${AWS::Region}:${AWS::AccountId}:stateMachine:${stateMachineName}",
1655+
{
1656+
"stateMachineName": "name"
1657+
}
1658+
]
1659+
}
1660+
}
1661+
]
1662+
},
1663+
"PolicyName": "KitchenSinkFunctionRolePolicy61"
16421664
}
16431665
],
16441666
"Tags": [

tests/translator/output/aws-us-gov/all_policy_templates.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1639,6 +1639,28 @@
16391639
]
16401640
},
16411641
"PolicyName": "KitchenSinkFunctionRolePolicy60"
1642+
},
1643+
{
1644+
"PolicyDocument": {
1645+
"Statement": [
1646+
{
1647+
"Action": [
1648+
"states:StartExecution",
1649+
"states:StartSyncExecution"
1650+
],
1651+
"Effect": "Allow",
1652+
"Resource": {
1653+
"Fn::Sub": [
1654+
"arn:${AWS::Partition}:states:${AWS::Region}:${AWS::AccountId}:stateMachine:${stateMachineName}",
1655+
{
1656+
"stateMachineName": "name"
1657+
}
1658+
]
1659+
}
1660+
}
1661+
]
1662+
},
1663+
"PolicyName": "KitchenSinkFunctionRolePolicy61"
16421664
}
16431665
],
16441666
"Tags": [

0 commit comments

Comments
 (0)