apx-aws-lambda 1.1.0__tar.gz → 1.2.1__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.1}/PKG-INFO +2 -2
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.1}/README.md +1 -1
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.1}/apx_aws_lambda/connect/template.yaml +4 -4
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.1}/apx_aws_lambda/lambda_.py +18 -11
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.1}/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.1}/apx_aws_lambda.egg-info/PKG-INFO +2 -2
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.1}/pyproject.toml +1 -1
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.1}/tests/test_targets.py +39 -1
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.1}/LICENSE +0 -0
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.1}/apx_aws_lambda/__init__.py +0 -0
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.1}/apx_aws_lambda/cli.py +0 -0
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.1}/apx_aws_lambda/overlays/cloud/aws/lambda/cookiecutter.json +0 -0
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.1}/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.1}/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.1}/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.1}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/Makefile +0 -0
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.1}/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.1}/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.1}/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.1}/apx_aws_lambda/overlays/index.json +0 -0
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.1}/apx_aws_lambda/plugin.py +0 -0
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.1}/apx_aws_lambda/shell.py +0 -0
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.1}/apx_aws_lambda/tools.py +0 -0
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.1}/apx_aws_lambda.egg-info/SOURCES.txt +0 -0
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.1}/apx_aws_lambda.egg-info/dependency_links.txt +0 -0
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.1}/apx_aws_lambda.egg-info/entry_points.txt +0 -0
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.1}/apx_aws_lambda.egg-info/requires.txt +0 -0
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.1}/apx_aws_lambda.egg-info/top_level.txt +0 -0
- {apx_aws_lambda-1.1.0 → apx_aws_lambda-1.2.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: apx-aws-lambda
|
|
3
|
-
Version: 1.1
|
|
3
|
+
Version: 1.2.1
|
|
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
|
|
@@ -93,7 +93,7 @@ What the stack creates:
|
|
|
93
93
|
| `ActionPlatformAppBoundary` (`/action-platform/`) | the cap on every execution role an app's stack creates — logs `/aws/lambda/<prefix>*`; S3 buckets, DynamoDB tables, SQS queues, SNS topics, Lambda functions `<prefix>-*`; Secrets Manager secrets and SSM parameters `<prefix>/*`; X-Ray — `<prefix>` being the role's `action-platform:prefix` tag. An app's own `template.yaml` still declares what its function needs; the boundary caps it |
|
|
94
94
|
| `ActionPlatformDeploy` role (`/action-platform/`) | trust: `AssumeRoleWithWebIdentity` for `sub` `org:<org>:*`, and `TagSession` only for the one tag `action-platform:prefix` with a value `ap-<org>-*`. Policy: every resource under `${aws:PrincipalTag/action-platform:prefix}` — CloudFormation stacks, Lambda, logs; API Gateway; the public Lambda Web Adapter layers; SAM's bucket; `iam:CreateRole` on `<prefix>-*` only with the boundary attached and the app's own prefix tag, `iam:PassRole` of those roles to Lambda only; `iam:SimulatePrincipalPolicy` on itself |
|
|
95
95
|
|
|
96
|
-
How a deploy runs: the platform signs a token for the app with the claim `https://aws.amazon.com/tags` → `principal_tags.action-platform:prefix = ap-<org>-<project>-<app>`; the target assumes the deploy role with it, names the stack `ap-<org>-<project>-<app
|
|
96
|
+
How a deploy runs: the platform signs a token for the app with the claim `https://aws.amazon.com/tags` → `principal_tags.action-platform:prefix = ap-<org>-<project>-<app>`; the target assumes the deploy role with it, names the stack `ap-<org>-<project>-<app>-<scope>`, passes `PermissionsBoundaryArn` to the overlay's template and tags the stack with the prefix, so the execution role SAM creates carries both the boundary and the tag. `sam delete` removes that role with the stack. Who may deploy which app is the platform's decision — it only signs a token for an app the job or the caller is for.
|
|
97
97
|
|
|
98
98
|
Readiness simulates the deploy role with the session tag and the boundary as context entries, and flags an overlay without the `PermissionsBoundaryArn` parameter (apply the overlay again). The stack's policy is the one place to widen or narrow what deploys may do: edit and update the stack.
|
|
99
99
|
|
|
@@ -75,7 +75,7 @@ What the stack creates:
|
|
|
75
75
|
| `ActionPlatformAppBoundary` (`/action-platform/`) | the cap on every execution role an app's stack creates — logs `/aws/lambda/<prefix>*`; S3 buckets, DynamoDB tables, SQS queues, SNS topics, Lambda functions `<prefix>-*`; Secrets Manager secrets and SSM parameters `<prefix>/*`; X-Ray — `<prefix>` being the role's `action-platform:prefix` tag. An app's own `template.yaml` still declares what its function needs; the boundary caps it |
|
|
76
76
|
| `ActionPlatformDeploy` role (`/action-platform/`) | trust: `AssumeRoleWithWebIdentity` for `sub` `org:<org>:*`, and `TagSession` only for the one tag `action-platform:prefix` with a value `ap-<org>-*`. Policy: every resource under `${aws:PrincipalTag/action-platform:prefix}` — CloudFormation stacks, Lambda, logs; API Gateway; the public Lambda Web Adapter layers; SAM's bucket; `iam:CreateRole` on `<prefix>-*` only with the boundary attached and the app's own prefix tag, `iam:PassRole` of those roles to Lambda only; `iam:SimulatePrincipalPolicy` on itself |
|
|
77
77
|
|
|
78
|
-
How a deploy runs: the platform signs a token for the app with the claim `https://aws.amazon.com/tags` → `principal_tags.action-platform:prefix = ap-<org>-<project>-<app>`; the target assumes the deploy role with it, names the stack `ap-<org>-<project>-<app
|
|
78
|
+
How a deploy runs: the platform signs a token for the app with the claim `https://aws.amazon.com/tags` → `principal_tags.action-platform:prefix = ap-<org>-<project>-<app>`; the target assumes the deploy role with it, names the stack `ap-<org>-<project>-<app>-<scope>`, passes `PermissionsBoundaryArn` to the overlay's template and tags the stack with the prefix, so the execution role SAM creates carries both the boundary and the tag. `sam delete` removes that role with the stack. Who may deploy which app is the platform's decision — it only signs a token for an app the job or the caller is for.
|
|
79
79
|
|
|
80
80
|
Readiness simulates the deploy role with the session tag and the boundary as context entries, and flags an overlay without the `PermissionsBoundaryArn` parameter (apply the overlay again). The stack's policy is the one place to widen or narrow what deploys may do: edit and update the stack.
|
|
81
81
|
|
|
@@ -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
|
|
@@ -17,6 +17,7 @@ from action_platform.remote.client import Remote
|
|
|
17
17
|
from apx_aws_lambda import shell
|
|
18
18
|
|
|
19
19
|
BOUNDARY = "policy/action-platform/ActionPlatformAppBoundary"
|
|
20
|
+
FAILED_CREATION = ("ROLLBACK_COMPLETE", "ROLLBACK_FAILED")
|
|
20
21
|
PREFIX_TAG = "action-platform:prefix"
|
|
21
22
|
|
|
22
23
|
|
|
@@ -109,7 +110,7 @@ class LambdaTarget(DeployTarget):
|
|
|
109
110
|
prefix = (self.env(ctx) or {}).get("AP_STACK_PREFIX")
|
|
110
111
|
|
|
111
112
|
if prefix:
|
|
112
|
-
return f"{prefix}-{
|
|
113
|
+
return f"{prefix}-{ctx.stage or 'dev'}"
|
|
113
114
|
|
|
114
115
|
params = (
|
|
115
116
|
self._samconfig(ctx)
|
|
@@ -135,13 +136,14 @@ class LambdaTarget(DeployTarget):
|
|
|
135
136
|
own = [
|
|
136
137
|
item
|
|
137
138
|
for item in str(params.get("parameter_overrides") or "").split()
|
|
138
|
-
if not item.startswith(("Stage=", "PermissionsBoundaryArn="))
|
|
139
|
+
if not item.startswith(("Stage=", "PermissionsBoundaryArn=", "RolePath="))
|
|
139
140
|
]
|
|
140
141
|
own.append(f"Stage={ctx.stage}")
|
|
141
142
|
boundary = (env or {}).get("AP_BOUNDARY")
|
|
142
143
|
|
|
143
144
|
if boundary:
|
|
144
145
|
own.append(f"PermissionsBoundaryArn={boundary}")
|
|
146
|
+
own.append(f"RolePath={role_path((env or {})['AP_STACK_PREFIX'])}")
|
|
145
147
|
|
|
146
148
|
return ["--parameter-overrides", " ".join(own)]
|
|
147
149
|
|
|
@@ -258,7 +260,7 @@ class LambdaTarget(DeployTarget):
|
|
|
258
260
|
def _boundary_parameter(self, ctx: Context) -> Check:
|
|
259
261
|
text = (ctx.repo_root / "template.yaml").read_text(errors="replace")
|
|
260
262
|
|
|
261
|
-
if "PermissionsBoundaryArn" in text:
|
|
263
|
+
if "PermissionsBoundaryArn" in text and "RolePath" in text:
|
|
262
264
|
return Check(
|
|
263
265
|
"template.boundary", True, "the execution role takes the boundary"
|
|
264
266
|
)
|
|
@@ -266,7 +268,7 @@ class LambdaTarget(DeployTarget):
|
|
|
266
268
|
return Check(
|
|
267
269
|
"template.boundary",
|
|
268
270
|
False,
|
|
269
|
-
"template.yaml
|
|
271
|
+
"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
272
|
fix="apply the aws/lambda overlay again: action-platform cloud set aws/lambda",
|
|
271
273
|
)
|
|
272
274
|
|
|
@@ -276,7 +278,7 @@ class LambdaTarget(DeployTarget):
|
|
|
276
278
|
if status is None:
|
|
277
279
|
return Check("stack.state", True, "no stack yet; the deploy creates it")
|
|
278
280
|
|
|
279
|
-
if status
|
|
281
|
+
if status in FAILED_CREATION:
|
|
280
282
|
return Check(
|
|
281
283
|
"stack.state",
|
|
282
284
|
True,
|
|
@@ -337,7 +339,7 @@ class LambdaTarget(DeployTarget):
|
|
|
337
339
|
context: list[str] = []
|
|
338
340
|
|
|
339
341
|
if boundary:
|
|
340
|
-
execution = f"arn:aws:iam::{account}:role
|
|
342
|
+
execution = f"arn:aws:iam::{account}:role{role_path(env['AP_STACK_PREFIX'])}{stack}-ApiFunctionRole"
|
|
341
343
|
wanted.append((["iam:CreateRole", "iam:PassRole"], [execution]))
|
|
342
344
|
context = [
|
|
343
345
|
"--context-entries",
|
|
@@ -429,14 +431,14 @@ class LambdaTarget(DeployTarget):
|
|
|
429
431
|
return rows[0].get("StackStatus") if rows else None
|
|
430
432
|
|
|
431
433
|
def _clear_failed_creation(self, ctx: Context) -> None:
|
|
432
|
-
"""A stack whose first creation failed sits in ROLLBACK_COMPLETE and refuses updates; it never existed, so it is deleted before the deploy creates it again."""
|
|
433
|
-
|
|
434
|
+
"""A stack whose first creation failed sits in ROLLBACK_COMPLETE — or ROLLBACK_FAILED when a resource could not be rolled back — and refuses updates; it never existed, so it is deleted before the deploy creates it again."""
|
|
435
|
+
status = self._status(ctx)
|
|
436
|
+
|
|
437
|
+
if status not in FAILED_CREATION:
|
|
434
438
|
return
|
|
435
439
|
|
|
436
440
|
stack = self._stack(ctx)
|
|
437
|
-
logger.info(
|
|
438
|
-
"stack %s is ROLLBACK_COMPLETE: deleting it before the deploy", stack
|
|
439
|
-
)
|
|
441
|
+
logger.info("stack %s is %s: deleting it before the deploy", stack, status)
|
|
440
442
|
region = self._region(ctx)
|
|
441
443
|
env = self.env(ctx)
|
|
442
444
|
shell.aws(
|
|
@@ -565,6 +567,11 @@ def _role_of(arn: str) -> str | None:
|
|
|
565
567
|
return f"arn:aws:iam::{found.group(1)}:role/{found.group(2)}" if found else None
|
|
566
568
|
|
|
567
569
|
|
|
570
|
+
def role_path(prefix: str) -> str:
|
|
571
|
+
"""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."""
|
|
572
|
+
return f"/action-platform/{prefix}/"
|
|
573
|
+
|
|
574
|
+
|
|
568
575
|
def connected_env(
|
|
569
576
|
ctx: Context, role_arn: str, prefix: str, session_name: str, region: str | None
|
|
570
577
|
) -> 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.1
|
|
3
|
+
Version: 1.2.1
|
|
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
|
|
@@ -93,7 +93,7 @@ What the stack creates:
|
|
|
93
93
|
| `ActionPlatformAppBoundary` (`/action-platform/`) | the cap on every execution role an app's stack creates — logs `/aws/lambda/<prefix>*`; S3 buckets, DynamoDB tables, SQS queues, SNS topics, Lambda functions `<prefix>-*`; Secrets Manager secrets and SSM parameters `<prefix>/*`; X-Ray — `<prefix>` being the role's `action-platform:prefix` tag. An app's own `template.yaml` still declares what its function needs; the boundary caps it |
|
|
94
94
|
| `ActionPlatformDeploy` role (`/action-platform/`) | trust: `AssumeRoleWithWebIdentity` for `sub` `org:<org>:*`, and `TagSession` only for the one tag `action-platform:prefix` with a value `ap-<org>-*`. Policy: every resource under `${aws:PrincipalTag/action-platform:prefix}` — CloudFormation stacks, Lambda, logs; API Gateway; the public Lambda Web Adapter layers; SAM's bucket; `iam:CreateRole` on `<prefix>-*` only with the boundary attached and the app's own prefix tag, `iam:PassRole` of those roles to Lambda only; `iam:SimulatePrincipalPolicy` on itself |
|
|
95
95
|
|
|
96
|
-
How a deploy runs: the platform signs a token for the app with the claim `https://aws.amazon.com/tags` → `principal_tags.action-platform:prefix = ap-<org>-<project>-<app>`; the target assumes the deploy role with it, names the stack `ap-<org>-<project>-<app
|
|
96
|
+
How a deploy runs: the platform signs a token for the app with the claim `https://aws.amazon.com/tags` → `principal_tags.action-platform:prefix = ap-<org>-<project>-<app>`; the target assumes the deploy role with it, names the stack `ap-<org>-<project>-<app>-<scope>`, passes `PermissionsBoundaryArn` to the overlay's template and tags the stack with the prefix, so the execution role SAM creates carries both the boundary and the tag. `sam delete` removes that role with the stack. Who may deploy which app is the platform's decision — it only signs a token for an app the job or the caller is for.
|
|
97
97
|
|
|
98
98
|
Readiness simulates the deploy role with the session tag and the boundary as context entries, and flags an overlay without the `PermissionsBoundaryArn` parameter (apply the overlay again). The stack's policy is the one place to widen or narrow what deploys may do: edit and update the stack.
|
|
99
99
|
|
|
@@ -131,6 +131,29 @@ class LambdaTargetTest(unittest.TestCase):
|
|
|
131
131
|
)
|
|
132
132
|
self.assertTrue(result.ok)
|
|
133
133
|
|
|
134
|
+
def test_a_stack_left_in_rollback_failed_is_deleted_before_the_deploy(self):
|
|
135
|
+
target = LambdaTarget()
|
|
136
|
+
statuses = iter(["ROLLBACK_FAILED", "UPDATE_COMPLETE"])
|
|
137
|
+
|
|
138
|
+
def run(args, cwd=None, env=None):
|
|
139
|
+
self.calls.append([Path(args[0]).name, *args[1:]])
|
|
140
|
+
|
|
141
|
+
if " ".join(args[1:3]) == "cloudformation describe-stacks":
|
|
142
|
+
return json.dumps(
|
|
143
|
+
{"Stacks": [{"StackStatus": next(statuses), "Outputs": []}]}
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
return "{}"
|
|
147
|
+
|
|
148
|
+
with mock.patch.multiple(
|
|
149
|
+
shell, run=run, require=lambda tool, hint: [f"/usr/bin/{tool}"]
|
|
150
|
+
):
|
|
151
|
+
target.deploy(self.ctx("dev"))
|
|
152
|
+
|
|
153
|
+
self.assertIn(
|
|
154
|
+
["aws", "cloudformation", "delete-stack"], [c[:3] for c in self.calls]
|
|
155
|
+
)
|
|
156
|
+
|
|
134
157
|
def test_a_healthy_stack_is_left_alone(self):
|
|
135
158
|
target = LambdaTarget()
|
|
136
159
|
|
|
@@ -373,6 +396,7 @@ class ConnectedAccountTest(unittest.TestCase):
|
|
|
373
396
|
)
|
|
374
397
|
(self.root / "template.yaml").write_text(
|
|
375
398
|
"Parameters:\n PermissionsBoundaryArn:\n Type: String\n"
|
|
399
|
+
" RolePath:\n Type: String\n"
|
|
376
400
|
)
|
|
377
401
|
self.calls: list[list[str]] = []
|
|
378
402
|
self.addCleanup(self.tmp.cleanup)
|
|
@@ -441,13 +465,27 @@ class ConnectedAccountTest(unittest.TestCase):
|
|
|
441
465
|
)
|
|
442
466
|
self.assertEqual(
|
|
443
467
|
deploy[deploy.index("--parameter-overrides") + 1],
|
|
444
|
-
f"DomainName= Stage=dev PermissionsBoundaryArn={self.BOUNDARY}"
|
|
468
|
+
f"DomainName= Stage=dev PermissionsBoundaryArn={self.BOUNDARY}"
|
|
469
|
+
" RolePath=/action-platform/ap-acme-shop-orders/",
|
|
445
470
|
)
|
|
446
471
|
self.assertEqual(
|
|
447
472
|
deploy[deploy.index("--tags") + 1],
|
|
448
473
|
"Project=shop Environment=dev action-platform:prefix=ap-acme-shop-orders",
|
|
449
474
|
)
|
|
450
475
|
|
|
476
|
+
def test_the_stack_is_named_after_the_scope(self):
|
|
477
|
+
ctx = self.ctx()
|
|
478
|
+
ctx.stage = "production"
|
|
479
|
+
|
|
480
|
+
with self.patched():
|
|
481
|
+
LambdaTarget().deploy(ctx)
|
|
482
|
+
|
|
483
|
+
deploy = next(c for c in self.calls if c[:2] == ["sam", "deploy"])
|
|
484
|
+
self.assertEqual(
|
|
485
|
+
deploy[deploy.index("--stack-name") + 1],
|
|
486
|
+
"ap-acme-shop-orders-production",
|
|
487
|
+
)
|
|
488
|
+
|
|
451
489
|
def test_readiness_simulates_with_the_session_tag_and_the_boundary(self):
|
|
452
490
|
with self.patched():
|
|
453
491
|
checks = {c.id: c for c in LambdaTarget().readiness(self.ctx())}
|
|
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
|