Skip to content

Remove dead IAM bootstrap block from deploy.sh#19

Merged
cipher813 merged 1 commit into
mainfrom
fix/remove-dead-iam-bootstrap-from-deploy
Apr 11, 2026
Merged

Remove dead IAM bootstrap block from deploy.sh#19
cipher813 merged 1 commit into
mainfrom
fix/remove-dead-iam-bootstrap-from-deploy

Conversation

@cipher813
Copy link
Copy Markdown
Owner

Summary

Delete the `Checking IAM role: alpha-engine-data-role` bootstrap block at the end of `infrastructure/deploy.sh`. It's dead code with a silent-fail trap inside it, and it broke today's auto-deploy after the Lambda itself had already succeeded.

Context

Today's Deploy workflow run (triggered by #18 merge) produced:

```
Alias 'live' -> version 4
Canary passed (status=OK) ← Lambda deploy SUCCEEDED

Checking IAM role: alpha-engine-data-role...
Creating IAM role... ← dead-code path
Error: ... iam:CreateRole ... AccessDenied
```

Two layers:

  1. Dead code. `alpha-engine-data-role` has existed in AWS for months and is the live Lambda's execution role. The get-role check at line 203 should always succeed in steady state. The entire `else` branch (create role + attach inline policy) has never fired in steady state and never should. The header comments already list the role as a prerequisite.

  2. Silent fail inside the dead code. The `aws iam get-role` call was followed by `&>/dev/null`, which swallows BOTH "role not found" and "permission denied". The deploy role (`github-actions-lambda-deploy`) intentionally lacks `iam:*` permissions (principle of least privilege). So the check treated every permission denial as "role doesn't exist" and fell through to CreateRole, which then failed explicitly. Classic no-silent-fails antipattern at the IAM layer.

Fix

Delete the whole block. Replace with a comment explaining that the role is a one-time out-of-band provisioning concern. The version-controlled IAM pattern added in #17 (`infrastructure/iam/apply.sh`) is the right home for any future provisioning; this deploy path should never touch IAM.

Impact

  • Next push to main (or merging this PR) triggers a Deploy workflow run that should complete cleanly — Lambda deploys + canary + done.
  • No behavioral change to the Lambda itself (version 4 already live and healthy).
  • No IAM permissions added to the deploy role (good — minimum privilege preserved).

Test plan

🤖 Generated with Claude Code

The post-canary IAM block attempted \`aws iam get-role alpha-engine-data-role\`
as a "create if missing" bootstrap, then fell through to CreateRole
when the get-role call failed. This was dead code with a silent-fail
trap inside it:

1. \`alpha-engine-data-role\` already exists in AWS and is the live
   Lambda's execution role. The get-role check should succeed and
   exit the branch as a no-op — it never actually needs to create
   anything.
2. The deploy.sh header already documents the role as a prerequisite.
   The bootstrap block contradicted that contract.
3. \`&>/dev/null\` swallowed any non-zero exit from get-role, including
   "permission denied" from the github-actions-lambda-deploy role
   (which correctly lacks iam:* permissions). The branch then
   interpreted "permission denied" as "role does not exist" and
   tried to create it, which failed explicitly with iam:CreateRole
   AccessDenied.

Today's auto-deploy after PR #18 merged surfaced all of this: the
Lambda itself deployed successfully (version 4 live, canary passed),
but the workflow failed at the dead IAM step and marked the run red.

Fix: delete the entire block. Replace with a comment explaining the
role is a one-time out-of-band provisioning concern, ideally extended
into \`infrastructure/iam/\` the same way #17 did for
github-actions-lambda-deploy.

This also aligns with the no-silent-fails rule: any future IAM
provisioning that belongs in this path should fail loudly, not fall
through a pattern-matching check.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@cipher813 cipher813 merged commit ad1e1ec into main Apr 11, 2026
1 check passed
@cipher813 cipher813 deleted the fix/remove-dead-iam-bootstrap-from-deploy branch April 11, 2026 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant