apx-aws-lambda 1.2.0__tar.gz → 1.2.2__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.
Files changed (29) hide show
  1. {apx_aws_lambda-1.2.0 → apx_aws_lambda-1.2.2}/PKG-INFO +2 -2
  2. {apx_aws_lambda-1.2.0 → apx_aws_lambda-1.2.2}/README.md +1 -1
  3. {apx_aws_lambda-1.2.0 → apx_aws_lambda-1.2.2}/apx_aws_lambda/lambda_.py +69 -26
  4. {apx_aws_lambda-1.2.0 → apx_aws_lambda-1.2.2}/apx_aws_lambda.egg-info/PKG-INFO +2 -2
  5. {apx_aws_lambda-1.2.0 → apx_aws_lambda-1.2.2}/pyproject.toml +1 -1
  6. {apx_aws_lambda-1.2.0 → apx_aws_lambda-1.2.2}/tests/test_targets.py +106 -1
  7. {apx_aws_lambda-1.2.0 → apx_aws_lambda-1.2.2}/LICENSE +0 -0
  8. {apx_aws_lambda-1.2.0 → apx_aws_lambda-1.2.2}/apx_aws_lambda/__init__.py +0 -0
  9. {apx_aws_lambda-1.2.0 → apx_aws_lambda-1.2.2}/apx_aws_lambda/cli.py +0 -0
  10. {apx_aws_lambda-1.2.0 → apx_aws_lambda-1.2.2}/apx_aws_lambda/connect/template.yaml +0 -0
  11. {apx_aws_lambda-1.2.0 → apx_aws_lambda-1.2.2}/apx_aws_lambda/overlays/cloud/aws/lambda/cookiecutter.json +0 -0
  12. {apx_aws_lambda-1.2.0 → apx_aws_lambda-1.2.2}/apx_aws_lambda/overlays/cloud/aws/lambda/hooks/post_gen_project.py +0 -0
  13. {apx_aws_lambda-1.2.0 → apx_aws_lambda-1.2.2}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/.github/workflows/deploy.yml +0 -0
  14. {apx_aws_lambda-1.2.0 → apx_aws_lambda-1.2.2}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/DEPLOY.md +0 -0
  15. {apx_aws_lambda-1.2.0 → apx_aws_lambda-1.2.2}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/Makefile +0 -0
  16. {apx_aws_lambda-1.2.0 → apx_aws_lambda-1.2.2}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/requirements/policy.json +0 -0
  17. {apx_aws_lambda-1.2.0 → apx_aws_lambda-1.2.2}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/requirements/trust.json +0 -0
  18. {apx_aws_lambda-1.2.0 → apx_aws_lambda-1.2.2}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/samconfig.toml +0 -0
  19. {apx_aws_lambda-1.2.0 → apx_aws_lambda-1.2.2}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/template.yaml +0 -0
  20. {apx_aws_lambda-1.2.0 → apx_aws_lambda-1.2.2}/apx_aws_lambda/overlays/index.json +0 -0
  21. {apx_aws_lambda-1.2.0 → apx_aws_lambda-1.2.2}/apx_aws_lambda/plugin.py +0 -0
  22. {apx_aws_lambda-1.2.0 → apx_aws_lambda-1.2.2}/apx_aws_lambda/shell.py +0 -0
  23. {apx_aws_lambda-1.2.0 → apx_aws_lambda-1.2.2}/apx_aws_lambda/tools.py +0 -0
  24. {apx_aws_lambda-1.2.0 → apx_aws_lambda-1.2.2}/apx_aws_lambda.egg-info/SOURCES.txt +0 -0
  25. {apx_aws_lambda-1.2.0 → apx_aws_lambda-1.2.2}/apx_aws_lambda.egg-info/dependency_links.txt +0 -0
  26. {apx_aws_lambda-1.2.0 → apx_aws_lambda-1.2.2}/apx_aws_lambda.egg-info/entry_points.txt +0 -0
  27. {apx_aws_lambda-1.2.0 → apx_aws_lambda-1.2.2}/apx_aws_lambda.egg-info/requires.txt +0 -0
  28. {apx_aws_lambda-1.2.0 → apx_aws_lambda-1.2.2}/apx_aws_lambda.egg-info/top_level.txt +0 -0
  29. {apx_aws_lambda-1.2.0 → apx_aws_lambda-1.2.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apx-aws-lambda
3
- Version: 1.2.0
3
+ Version: 1.2.2
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>-dev|prod`, 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.
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>-dev|prod`, 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.
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
 
@@ -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}-{'prod' if ctx.stage == 'prod' else 'dev'}"
113
+ return f"{prefix}-{ctx.stage or 'dev'}"
113
114
 
114
115
  params = (
115
116
  self._samconfig(ctx)
@@ -256,10 +257,13 @@ class LambdaTarget(DeployTarget):
256
257
 
257
258
  return checks
258
259
 
259
- def _boundary_parameter(self, ctx: Context) -> Check:
260
+ def _takes_boundary(self, ctx: Context) -> bool:
260
261
  text = (ctx.repo_root / "template.yaml").read_text(errors="replace")
261
262
 
262
- if "PermissionsBoundaryArn" in text and "RolePath" in text:
263
+ return "PermissionsBoundaryArn" in text and "RolePath" in text
264
+
265
+ def _boundary_parameter(self, ctx: Context) -> Check:
266
+ if self._takes_boundary(ctx):
263
267
  return Check(
264
268
  "template.boundary", True, "the execution role takes the boundary"
265
269
  )
@@ -277,7 +281,7 @@ class LambdaTarget(DeployTarget):
277
281
  if status is None:
278
282
  return Check("stack.state", True, "no stack yet; the deploy creates it")
279
283
 
280
- if status == "ROLLBACK_COMPLETE":
284
+ if status in FAILED_CREATION:
281
285
  return Check(
282
286
  "stack.state",
283
287
  True,
@@ -430,38 +434,77 @@ class LambdaTarget(DeployTarget):
430
434
  return rows[0].get("StackStatus") if rows else None
431
435
 
432
436
  def _clear_failed_creation(self, ctx: Context) -> None:
433
- """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."""
434
- if self._status(ctx) != "ROLLBACK_COMPLETE":
437
+ """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."""
438
+ status = self._status(ctx)
439
+
440
+ if status not in FAILED_CREATION:
435
441
  return
436
442
 
437
443
  stack = self._stack(ctx)
438
- logger.info(
439
- "stack %s is ROLLBACK_COMPLETE: deleting it before the deploy", stack
440
- )
444
+ logger.info("stack %s is %s: deleting it before the deploy", stack, status)
441
445
  region = self._region(ctx)
442
446
  env = self.env(ctx)
443
- shell.aws(
444
- "cloudformation",
445
- "delete-stack",
446
- "--stack-name",
447
- stack,
448
- region=region,
449
- env=env,
450
- )
451
- shell.aws(
452
- "cloudformation",
453
- "wait",
454
- "stack-delete-complete",
455
- "--stack-name",
456
- stack,
457
- region=region,
458
- env=env,
459
- )
447
+ self._delete_stack(stack, region, env)
448
+
449
+ if self._status(ctx) != "DELETE_FAILED":
450
+ return
451
+
452
+ stuck = [
453
+ row["LogicalResourceId"]
454
+ for row in shell.aws(
455
+ "cloudformation",
456
+ "describe-stack-resources",
457
+ "--stack-name",
458
+ stack,
459
+ region=region,
460
+ env=env,
461
+ ).get("StackResources", [])
462
+ if row.get("ResourceStatus") == "DELETE_FAILED"
463
+ ]
464
+ logger.info("stack %s kept %s: deleting it without them", stack, stuck)
465
+ self._delete_stack(stack, region, env, retain=stuck)
466
+
467
+ def _delete_stack(
468
+ self,
469
+ stack: str,
470
+ region: str | None,
471
+ env: dict[str, str] | None,
472
+ retain: list[str] | None = None,
473
+ ) -> None:
474
+ """Delete and wait; a delete that fails leaves the stack in DELETE_FAILED for the caller to look at."""
475
+ args = ["cloudformation", "delete-stack", "--stack-name", stack]
476
+
477
+ if retain:
478
+ args += ["--retain-resources", *retain]
479
+
480
+ shell.aws(*args, region=region, env=env)
481
+
482
+ try:
483
+ shell.aws(
484
+ "cloudformation",
485
+ "wait",
486
+ "stack-delete-complete",
487
+ "--stack-name",
488
+ stack,
489
+ region=region,
490
+ env=env,
491
+ )
492
+ except DeployError:
493
+ if retain:
494
+ raise
460
495
 
461
496
  def deploy(self, ctx: Context) -> DeployResult:
462
497
  sam = shell.require("sam", "pip install aws-sam-cli")
463
498
  stage = self._stage(ctx)
464
499
  env = self.env(ctx)
500
+
501
+ if (env or {}).get("AP_BOUNDARY") and not self._takes_boundary(ctx):
502
+ raise DeployError(
503
+ "template.yaml lacks the PermissionsBoundaryArn or RolePath parameter, so the execution role "
504
+ "would land outside what a connected account may create: apply the aws/lambda overlay again "
505
+ "(Configuration → Deploy target, or action-platform cloud set aws/lambda)"
506
+ )
507
+
465
508
  shell.run([*sam, "build"], cwd=ctx.repo_root, env=env)
466
509
  self._clear_failed_creation(ctx)
467
510
  args = [
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apx-aws-lambda
3
- Version: 1.2.0
3
+ Version: 1.2.2
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>-dev|prod`, 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.
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
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "apx-aws-lambda"
3
- version = "1.2.0"
3
+ version = "1.2.2"
4
4
  description = "AWS Lambda for Action Platform: the aws/lambda deploy target (SAM) with its overlay, and tools to read stacks and functions."
5
5
  readme = "README.md"
6
6
  license = "Apache-2.0"
@@ -106,7 +106,7 @@ class LambdaTargetTest(unittest.TestCase):
106
106
  {
107
107
  "Stacks": [
108
108
  {
109
- "StackStatus": next(statuses),
109
+ "StackStatus": next(statuses, "UPDATE_COMPLETE"),
110
110
  "Outputs": [
111
111
  {"OutputKey": "ApiUrl", "OutputValue": "https://x"}
112
112
  ],
@@ -131,6 +131,36 @@ 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
+ {
144
+ "Stacks": [
145
+ {
146
+ "StackStatus": next(statuses, "UPDATE_COMPLETE"),
147
+ "Outputs": [],
148
+ }
149
+ ]
150
+ }
151
+ )
152
+
153
+ return "{}"
154
+
155
+ with mock.patch.multiple(
156
+ shell, run=run, require=lambda tool, hint: [f"/usr/bin/{tool}"]
157
+ ):
158
+ target.deploy(self.ctx("dev"))
159
+
160
+ self.assertIn(
161
+ ["aws", "cloudformation", "delete-stack"], [c[:3] for c in self.calls]
162
+ )
163
+
134
164
  def test_a_healthy_stack_is_left_alone(self):
135
165
  target = LambdaTarget()
136
166
 
@@ -450,6 +480,19 @@ class ConnectedAccountTest(unittest.TestCase):
450
480
  "Project=shop Environment=dev action-platform:prefix=ap-acme-shop-orders",
451
481
  )
452
482
 
483
+ def test_the_stack_is_named_after_the_scope(self):
484
+ ctx = self.ctx()
485
+ ctx.stage = "production"
486
+
487
+ with self.patched():
488
+ LambdaTarget().deploy(ctx)
489
+
490
+ deploy = next(c for c in self.calls if c[:2] == ["sam", "deploy"])
491
+ self.assertEqual(
492
+ deploy[deploy.index("--stack-name") + 1],
493
+ "ap-acme-shop-orders-production",
494
+ )
495
+
453
496
  def test_readiness_simulates_with_the_session_tag_and_the_boundary(self):
454
497
  with self.patched():
455
498
  checks = {c.id: c for c in LambdaTarget().readiness(self.ctx())}
@@ -500,6 +543,68 @@ class ConnectedAccountTest(unittest.TestCase):
500
543
  )
501
544
  self.assertIn("connect/template.yaml", option.action_copy)
502
545
 
546
+ def test_a_deploy_with_an_old_overlay_stops_before_building(self):
547
+ (self.root / "template.yaml").write_text("Resources: {}\n")
548
+
549
+ with self.patched(), self.assertRaises(DeployError) as caught:
550
+ LambdaTarget().deploy(self.ctx())
551
+
552
+ self.assertIn("overlay again", str(caught.exception))
553
+ self.assertNotIn(["sam", "build"], [c[:2] for c in self.calls])
554
+
555
+ def test_a_failed_creation_whose_delete_fails_is_deleted_keeping_the_stuck_role(
556
+ self,
557
+ ):
558
+ statuses = iter(["ROLLBACK_FAILED", "DELETE_FAILED", "UPDATE_COMPLETE"])
559
+
560
+ def run(args, cwd=None, env=None):
561
+ key = " ".join(args[1:3])
562
+
563
+ if key == "cloudformation describe-stacks":
564
+ self.calls.append([Path(args[0]).name, *args[1:]])
565
+ return json.dumps(
566
+ {"Stacks": [{"StackStatus": next(statuses, "UPDATE_COMPLETE")}]}
567
+ )
568
+
569
+ if key == "cloudformation describe-stack-resources":
570
+ self.calls.append([Path(args[0]).name, *args[1:]])
571
+ return json.dumps(
572
+ {
573
+ "StackResources": [
574
+ {
575
+ "LogicalResourceId": "ApiFunctionRole",
576
+ "ResourceStatus": "DELETE_FAILED",
577
+ },
578
+ {
579
+ "LogicalResourceId": "ApiLogGroup",
580
+ "ResourceStatus": "DELETE_COMPLETE",
581
+ },
582
+ ]
583
+ }
584
+ )
585
+
586
+ if key == "cloudformation wait" and not any(
587
+ "--retain-resources" in c for c in self.calls
588
+ ):
589
+ self.calls.append([Path(args[0]).name, *args[1:]])
590
+ raise DeployError("Waiter StackDeleteComplete failed")
591
+
592
+ return self.run_fake(args, cwd, env)
593
+
594
+ with mock.patch.multiple(
595
+ shell, run=run, require=lambda t, h: [f"/usr/bin/{t}"]
596
+ ):
597
+ LambdaTarget().deploy(self.ctx())
598
+
599
+ deletes = [
600
+ c for c in self.calls if c[1:3] == ["cloudformation", "delete-stack"]
601
+ ]
602
+ self.assertEqual(len(deletes), 2)
603
+ self.assertEqual(
604
+ deletes[1][deletes[1].index("--retain-resources") + 1], "ApiFunctionRole"
605
+ )
606
+ self.assertNotIn("ApiLogGroup", deletes[1])
607
+
503
608
  def test_a_role_of_the_repository_wins_over_the_connected_account(self):
504
609
  target = LambdaTarget(role_arn="arn:aws:iam::1:role/own")
505
610
 
File without changes
File without changes