apx-aws-lambda 1.1.0__tar.gz → 1.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.0}/PKG-INFO +1 -1
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.0}/apx_aws_lambda/connect/template.yaml +4 -4
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.0}/apx_aws_lambda/lambda_.py +10 -4
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.0}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/template.yaml +5 -0
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.0}/apx_aws_lambda.egg-info/PKG-INFO +1 -1
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.0}/pyproject.toml +1 -1
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.0}/tests/test_targets.py +3 -1
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.0}/LICENSE +0 -0
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.0}/README.md +0 -0
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.0}/apx_aws_lambda/__init__.py +0 -0
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.0}/apx_aws_lambda/cli.py +0 -0
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.0}/apx_aws_lambda/overlays/cloud/aws/lambda/cookiecutter.json +0 -0
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.0}/apx_aws_lambda/overlays/cloud/aws/lambda/hooks/post_gen_project.py +0 -0
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.0}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/.github/workflows/deploy.yml +0 -0
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.0}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/DEPLOY.md +0 -0
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.0}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/Makefile +0 -0
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.0}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/requirements/policy.json +0 -0
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.0}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/requirements/trust.json +0 -0
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.0}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/samconfig.toml +0 -0
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.0}/apx_aws_lambda/overlays/index.json +0 -0
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.0}/apx_aws_lambda/plugin.py +0 -0
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.0}/apx_aws_lambda/shell.py +0 -0
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.0}/apx_aws_lambda/tools.py +0 -0
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.0}/apx_aws_lambda.egg-info/SOURCES.txt +0 -0
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.0}/apx_aws_lambda.egg-info/dependency_links.txt +0 -0
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.0}/apx_aws_lambda.egg-info/entry_points.txt +0 -0
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.0}/apx_aws_lambda.egg-info/requires.txt +0 -0
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.0}/apx_aws_lambda.egg-info/top_level.txt +0 -0
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: apx-aws-lambda
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.2.0
|
|
4
4
|
Summary: AWS Lambda for Action Platform: the aws/lambda deploy target (SAM) with its overlay, and tools to read stacks and functions.
|
|
5
5
|
Author-email: Action Platform <cloud@actionplatform.io>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -156,7 +156,7 @@ Resources:
|
|
|
156
156
|
Action:
|
|
157
157
|
- iam:CreateRole
|
|
158
158
|
- iam:PutRolePermissionsBoundary
|
|
159
|
-
Resource: !Sub "arn:aws:iam::${AWS::AccountId}:role/${!aws:PrincipalTag/action-platform:prefix}
|
|
159
|
+
Resource: !Sub "arn:aws:iam::${AWS::AccountId}:role/action-platform/${!aws:PrincipalTag/action-platform:prefix}/*"
|
|
160
160
|
Condition:
|
|
161
161
|
StringEquals:
|
|
162
162
|
iam:PermissionsBoundary: !Ref Boundary
|
|
@@ -165,7 +165,7 @@ Resources:
|
|
|
165
165
|
- Sid: TagExecutionRoleWithItsOwnPrefix
|
|
166
166
|
Effect: Allow
|
|
167
167
|
Action: iam:TagRole
|
|
168
|
-
Resource: !Sub "arn:aws:iam::${AWS::AccountId}:role/${!aws:PrincipalTag/action-platform:prefix}
|
|
168
|
+
Resource: !Sub "arn:aws:iam::${AWS::AccountId}:role/action-platform/${!aws:PrincipalTag/action-platform:prefix}/*"
|
|
169
169
|
Condition:
|
|
170
170
|
StringEqualsIfExists:
|
|
171
171
|
aws:RequestTag/action-platform:prefix: "${aws:PrincipalTag/action-platform:prefix}"
|
|
@@ -183,11 +183,11 @@ Resources:
|
|
|
183
183
|
- iam:DeleteRolePolicy
|
|
184
184
|
- iam:ListRolePolicies
|
|
185
185
|
- iam:ListAttachedRolePolicies
|
|
186
|
-
Resource: !Sub "arn:aws:iam::${AWS::AccountId}:role/${!aws:PrincipalTag/action-platform:prefix}
|
|
186
|
+
Resource: !Sub "arn:aws:iam::${AWS::AccountId}:role/action-platform/${!aws:PrincipalTag/action-platform:prefix}/*"
|
|
187
187
|
- Sid: PassExecutionRoleToLambda
|
|
188
188
|
Effect: Allow
|
|
189
189
|
Action: iam:PassRole
|
|
190
|
-
Resource: !Sub "arn:aws:iam::${AWS::AccountId}:role/${!aws:PrincipalTag/action-platform:prefix}
|
|
190
|
+
Resource: !Sub "arn:aws:iam::${AWS::AccountId}:role/action-platform/${!aws:PrincipalTag/action-platform:prefix}/*"
|
|
191
191
|
Condition:
|
|
192
192
|
StringEquals:
|
|
193
193
|
iam:PassedToService: lambda.amazonaws.com
|
|
@@ -135,13 +135,14 @@ class LambdaTarget(DeployTarget):
|
|
|
135
135
|
own = [
|
|
136
136
|
item
|
|
137
137
|
for item in str(params.get("parameter_overrides") or "").split()
|
|
138
|
-
if not item.startswith(("Stage=", "PermissionsBoundaryArn="))
|
|
138
|
+
if not item.startswith(("Stage=", "PermissionsBoundaryArn=", "RolePath="))
|
|
139
139
|
]
|
|
140
140
|
own.append(f"Stage={ctx.stage}")
|
|
141
141
|
boundary = (env or {}).get("AP_BOUNDARY")
|
|
142
142
|
|
|
143
143
|
if boundary:
|
|
144
144
|
own.append(f"PermissionsBoundaryArn={boundary}")
|
|
145
|
+
own.append(f"RolePath={role_path((env or {})['AP_STACK_PREFIX'])}")
|
|
145
146
|
|
|
146
147
|
return ["--parameter-overrides", " ".join(own)]
|
|
147
148
|
|
|
@@ -258,7 +259,7 @@ class LambdaTarget(DeployTarget):
|
|
|
258
259
|
def _boundary_parameter(self, ctx: Context) -> Check:
|
|
259
260
|
text = (ctx.repo_root / "template.yaml").read_text(errors="replace")
|
|
260
261
|
|
|
261
|
-
if "PermissionsBoundaryArn" in text:
|
|
262
|
+
if "PermissionsBoundaryArn" in text and "RolePath" in text:
|
|
262
263
|
return Check(
|
|
263
264
|
"template.boundary", True, "the execution role takes the boundary"
|
|
264
265
|
)
|
|
@@ -266,7 +267,7 @@ class LambdaTarget(DeployTarget):
|
|
|
266
267
|
return Check(
|
|
267
268
|
"template.boundary",
|
|
268
269
|
False,
|
|
269
|
-
"template.yaml
|
|
270
|
+
"template.yaml lacks the PermissionsBoundaryArn or RolePath parameter: a connected account creates the execution role only within its boundary, under the app's path",
|
|
270
271
|
fix="apply the aws/lambda overlay again: action-platform cloud set aws/lambda",
|
|
271
272
|
)
|
|
272
273
|
|
|
@@ -337,7 +338,7 @@ class LambdaTarget(DeployTarget):
|
|
|
337
338
|
context: list[str] = []
|
|
338
339
|
|
|
339
340
|
if boundary:
|
|
340
|
-
execution = f"arn:aws:iam::{account}:role
|
|
341
|
+
execution = f"arn:aws:iam::{account}:role{role_path(env['AP_STACK_PREFIX'])}{stack}-ApiFunctionRole"
|
|
341
342
|
wanted.append((["iam:CreateRole", "iam:PassRole"], [execution]))
|
|
342
343
|
context = [
|
|
343
344
|
"--context-entries",
|
|
@@ -565,6 +566,11 @@ def _role_of(arn: str) -> str | None:
|
|
|
565
566
|
return f"arn:aws:iam::{found.group(1)}:role/{found.group(2)}" if found else None
|
|
566
567
|
|
|
567
568
|
|
|
569
|
+
def role_path(prefix: str) -> str:
|
|
570
|
+
"""Where a connected account keeps an app's execution roles: CloudFormation cuts a generated role name to 64 characters, which can drop the prefix from it, so the app's roles are told apart by their IAM path instead."""
|
|
571
|
+
return f"/action-platform/{prefix}/"
|
|
572
|
+
|
|
573
|
+
|
|
568
574
|
def connected_env(
|
|
569
575
|
ctx: Context, role_arn: str, prefix: str, session_name: str, region: str | None
|
|
570
576
|
) -> dict[str, str]:
|
|
@@ -18,6 +18,10 @@ Parameters:
|
|
|
18
18
|
Type: String
|
|
19
19
|
Default: ''
|
|
20
20
|
Description: The boundary the execution role SAM creates must carry (a connected account's ActionPlatformAppBoundary). Empty sets none.
|
|
21
|
+
RolePath:
|
|
22
|
+
Type: String
|
|
23
|
+
Default: /
|
|
24
|
+
Description: IAM path of the execution role SAM creates (a connected account's /action-platform/<prefix>/).
|
|
21
25
|
|
|
22
26
|
Conditions:
|
|
23
27
|
IsProd: !Equals [!Ref Stage, prod]
|
|
@@ -61,6 +65,7 @@ Resources:
|
|
|
61
65
|
{%- endif %}
|
|
62
66
|
{%- endif %}
|
|
63
67
|
PermissionsBoundary: !If [HasPermissionsBoundary, !Ref PermissionsBoundaryArn, !Ref AWS::NoValue]
|
|
68
|
+
RolePath: !Ref RolePath
|
|
64
69
|
Layers:
|
|
65
70
|
- !Sub arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerArm64:25
|
|
66
71
|
Environment:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: apx-aws-lambda
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.2.0
|
|
4
4
|
Summary: AWS Lambda for Action Platform: the aws/lambda deploy target (SAM) with its overlay, and tools to read stacks and functions.
|
|
5
5
|
Author-email: Action Platform <cloud@actionplatform.io>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -373,6 +373,7 @@ class ConnectedAccountTest(unittest.TestCase):
|
|
|
373
373
|
)
|
|
374
374
|
(self.root / "template.yaml").write_text(
|
|
375
375
|
"Parameters:\n PermissionsBoundaryArn:\n Type: String\n"
|
|
376
|
+
" RolePath:\n Type: String\n"
|
|
376
377
|
)
|
|
377
378
|
self.calls: list[list[str]] = []
|
|
378
379
|
self.addCleanup(self.tmp.cleanup)
|
|
@@ -441,7 +442,8 @@ class ConnectedAccountTest(unittest.TestCase):
|
|
|
441
442
|
)
|
|
442
443
|
self.assertEqual(
|
|
443
444
|
deploy[deploy.index("--parameter-overrides") + 1],
|
|
444
|
-
f"DomainName= Stage=dev PermissionsBoundaryArn={self.BOUNDARY}"
|
|
445
|
+
f"DomainName= Stage=dev PermissionsBoundaryArn={self.BOUNDARY}"
|
|
446
|
+
" RolePath=/action-platform/ap-acme-shop-orders/",
|
|
445
447
|
)
|
|
446
448
|
self.assertEqual(
|
|
447
449
|
deploy[deploy.index("--tags") + 1],
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|