Skip to content

[EPAC-2102]: add missing Lambda IAM permissions for Terraform lifecycle management#628

Merged
riddim-developer-bot[bot] merged 1 commit into
mainfrom
symphony/epac-2102-ci-backend-staging-deploy-failing-on-main
May 26, 2026
Merged

[EPAC-2102]: add missing Lambda IAM permissions for Terraform lifecycle management#628
riddim-developer-bot[bot] merged 1 commit into
mainfrom
symphony/epac-2102-ci-backend-staging-deploy-failing-on-main

Conversation

@riddim-developer-bot

Copy link
Copy Markdown
Contributor

Summary

  • Add lambda:ListVersionsByFunction, lambda:CreateFunction, lambda:DeleteFunction, lambda:GetPolicy, lambda:ListTags, lambda:TagResource, and lambda:UntagResource to both the staging and production CI IAM role policies
  • These permissions are required by the Terraform AWS provider to refresh Lambda function state, create new functions from the deployment manifest, manage tags, and handle full lifecycle operations

Root cause

PR #627 (EPAC-2101) re-added terraform apply for the staging workspace to the backend staging deploy workflow. The Terraform provider calls lambda:ListVersionsByFunction during the state refresh phase, but the ManageStagingLambda IAM policy only included the subset of Lambda actions needed for direct CLI deploys (update-function-code, get-function, etc.) — not the broader set Terraform needs.

Failed run: https://github.com/RiddimSoftware/epac/actions/runs/26427674950

Error: User: arn:aws:sts::227530433709:assumed-role/GitHubActions-epac-backend-staging/GitHubActions is not authorized to perform: lambda:ListVersionsByFunction on resource: arn:aws:lambda:us-east-1:227530433709:function:epac-health-staging

Post-merge action required

The IAM policy is managed by the core Terraform workspace (infra/terraform/core/), which is applied separately from the staging workspace. After this PR merges, the core workspace must be applied before the next staging deploy will succeed:

cd infra/terraform/core
terraform init
terraform apply

Verification

  • terraform validate passes for the core workspace
  • Production policy updated with the same permissions for consistency

Reviewer-Boundary: review-only

Resolves EPAC-2102

Issue estimate was not set in Linear.

…le management

The staging (and production) CI IAM roles were missing Lambda actions
that the Terraform AWS provider needs to manage the full resource
lifecycle: ListVersionsByFunction for state refresh, CreateFunction and
DeleteFunction for new/removed services, and tag management actions.
@riddim-developer-bot riddim-developer-bot Bot added the autonomous Enrolled in prconverged daemon for automated review and merge label May 26, 2026
@riddim-developer-bot riddim-developer-bot Bot added the autonomous Enrolled in prconverged daemon for automated review and merge label May 26, 2026
@riddim-developer-bot
riddim-developer-bot Bot enabled auto-merge (squash) May 26, 2026 01:55
@riddim-developer-bot
riddim-developer-bot Bot merged commit 365b74d into main May 26, 2026
6 of 7 checks passed
@riddim-developer-bot
riddim-developer-bot Bot deleted the symphony/epac-2102-ci-backend-staging-deploy-failing-on-main branch May 26, 2026 01:58
riddim-developer-bot Bot added a commit that referenced this pull request May 26, 2026
## Why

Infrastructure Validation failed on PR #628 because the staging
Terraform plan comment step hit `403 Resource not accessible by
integration` while trying to create a sticky PR comment. That masked the
Terraform plan failure path and made the comment publisher itself a CI
blocker.

## What changed

- Grant the workflow `pull-requests: write` so PR comment writes have
the permission GitHub reports as accepted for the comments endpoint.
- Wrap sticky Terraform plan comment publishing in a warning-only
`try`/`catch`, so Terraform init/plan outcomes continue to govern the
job result.

## Trade-offs not taken

I did not remove the sticky comment step; it is still useful review
context when GitHub accepts the write. The fallback only prevents
optional comment publishing from becoming the failing gate.

## Test plan

- `actionlint .github/workflows/infra-validate.yml`
- Pre-commit hook: `actionlint` on staged workflow file
- `git diff --check`

Skipped checks: iOS build/test and Terraform validate were not run
because this PR only changes GitHub Actions workflow control flow.

Reviewer-Boundary: review-only

Resolves EPAC-2103

_Issue estimate was not set in Linear; treated as the standard
8-complexity tier for implementation._

Co-authored-by: riddim-developer-bot <developer-bot@riddimsoftware.com>
Co-authored-by: Sunny Purewal <sunny@riddimsoftware.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autonomous Enrolled in prconverged daemon for automated review and merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants