Skip to content

fix(infra): the prod deploy role may pull er-api layers for the launch gate (#1248) - #1249

Merged
athvin merged 1 commit into
mainfrom
fix/pr-1247-ecr-layer-read
Nov 26, 2026
Merged

athvin merged 1 commit into
mainfrom
fix/pr-1247-ecr-layer-read

Conversation

@athvin

@athvin athvin commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

Closes #1248

Post-merge is part of this pull request. The ledger below records whether
the follow-up work actually happened. /land-pr closes it.

What

er-ci-deploy-prod gains ecr:GetDownloadUrlForLayer + ecr:BatchCheckLayerAvailability, on the er-api repository only, in api-contract.tf beside the gate's other grants.

Why

#1248: post-merge fix-forward for #1247. The first gated prod deploy (run 45736789375) failed at Fetch the release's API checker with not authorized to perform: ecr:GetDownloadUrlForLayer. The role could resolve digests but not pull layers. The failure was safe: the gate runs before the inactive colour is deployed, so production kept serving the previous release, and dev deployed normally.

Proof

terraform fmt -check and terraform validate (envs/prod): clean. The PR's terraform plan (prod) must show 0 add, 1 change (the inline policy), 0 destroy. After the apply, re-running the failed prod job is the live proof.

Risk & rollback

One inline-policy change; nothing is destroyed or replaced. Rollback: git revert <merge-sha>.

Post-merge ledger

Closed by: agent · session Claude Code:d1e3b2dc-3174-4091-9c30-c08fc4820306 on Mac · 2026-11-26T01:56:34Z

  • main is green with this change on it: merge 8f4e939b. Push runs: rust 45737874823 success, frontend 45737874830 success, devcontainer 45737875008 success, infra 45737874733 success.
  • images: n/a. Terraform only.
  • deploy converged: n/a for the app. The change of record is the infra apply: run 45737874733 apply (prod) gave Modifications complete [id=er-ci-deploy-prod:api-contract] and Apply complete! Resources: 0 added, 1 changed, 0 destroyed. Live proof that the grant works: the re-run prod deploy's Fetch the release's API checker step succeeded, where attempt 1 had been refused.
  • the push-only surface: infra apply green and matches the plan (prod 0/1/0).
  • the board card: #658 follow-up: er-ci-deploy-prod needs ECR layer read for the launch gate's checker #1248 was closed by fix(infra): the prod deploy role may pull er-api layers for the launch gate (#1248) #1249 through the merge automation.
  • follow-ups: none.
  • what was learned is written down: the policy statement's comment records why a digest-resolving role also needs layer read to copy a binary out of an image.

Specific to this change

Context — plan, discoveries, measurements, files

Plan

Discoveries

Measurements

Files

…h gate (#1248)

The first gated prod deploy failed safely at fetching the checker: the
role resolves digests but cannot pull layers, which docker create needs.
GetDownloadUrlForLayer + BatchCheckLayerAvailability on the er-api
repository only.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

terraform plan

82306b0 · run log and full plans

env add change destroy
state-backend (plan only) 0 0 0
core 0 0 0
dev 0 0 0
prod 0 1 0

Planned with -refresh=false, so this is the config-versus-state diff and
not out-of-band drift. That is a security choice, not a speed one: a refreshing
plan reads secret values, and the plan role is assumable from any PR branch —
which can edit the workflow it runs under. Drift is caught at apply time, which
refreshes fully.

prod — 0 to add, 1 to change
data.aws_iam_policy_document.pod_trust: Reading...
module.network.data.aws_region.current: Reading...
data.aws_iam_openid_connect_provider.github: Reading...
module.ses.data.aws_region.current: Reading...
module.network.data.aws_availability_zones.available: Reading...
module.ses.data.aws_region.current: Read complete after 0s [id=us-east-2]
data.aws_iam_policy_document.pod_trust: Read complete after 0s [id=819195744]
module.network.data.aws_region.current: Read complete after 0s [id=us-east-2]
data.aws_rds_engine_version.aurora_pg: Reading...
module.eks.data.aws_iam_policy_document.cluster_trust: Reading...
module.eks.data.aws_iam_policy_document.cluster_trust: Read complete after 0s [id=1029077455]
data.aws_caller_identity.current: Reading...
data.aws_iam_policy_document.efs_csi_trust: Reading...
data.aws_iam_policy_document.efs_csi_trust: Read complete after 0s [id=819195744]
module.eks.data.aws_iam_policy_document.node_trust: Reading...
module.eks.data.aws_iam_policy_document.node_trust: Read complete after 0s [id=2851119427]
data.aws_iam_policy_document.eso_trust: Reading...
data.aws_iam_policy_document.eso_trust: Read complete after 0s [id=819195744]
data.aws_iam_policy_document.otel_collector: Reading...
data.aws_iam_policy_document.api_contract_bucket: Reading...
data.aws_iam_policy_document.otel_collector: Read complete after 0s [id=1193716550]
data.aws_iam_policy_document.api_contract_bucket: Read complete after 0s [id=1127163522]
data.aws_iam_policy_document.fluent_bit: Reading...
data.aws_iam_policy_document.fluent_bit: Read complete after 0s [id=2978074842]
module.lake.data.aws_iam_policy_document.lake_tls_only: Reading...
module.lake.data.aws_iam_policy_document.lake_tls_only: Read complete after 0s [id=81696635]
data.aws_caller_identity.current: Read complete after 1s [id=797781631727]
data.aws_iam_policy_document.openobserve: Reading...
data.aws_iam_policy_document.openobserve: Read complete after 0s [id=2652188337]
module.ses.data.aws_iam_policy_document.send: Reading...
module.ses.data.aws_iam_policy_document.send: Read complete after 0s [id=3767633194]
data.aws_iam_policy_document.eso: Reading...
data.aws_iam_policy_document.eso: Read complete after 0s [id=2178872705]
data.aws_iam_policy_document.ci_deploy_prod_api_contract: Reading...
data.aws_iam_policy_document.lake_access: Reading...
data.aws_iam_policy_document.ci_deploy_prod_api_contract: Read complete after 0s [id=3801820449]
data.aws_iam_policy_document.lake_access: Read complete after 0s [id=1033619361]
module.network.data.aws_availability_zones.available: Read complete after 1s [id=us-east-2]
data.aws_rds_engine_version.aurora_pg: Read complete after 1s [id=17.9]
data.aws_iam_policy_document.ci_deploy_prod: Reading...
data.aws_iam_policy_document.ci_deploy_prod: Read complete after 0s [id=2891227359]
data.aws_iam_openid_connect_provider.github: Read complete after 1s [id=arn:aws:iam::797781631727:oidc-provider/token.actions.githubusercontent.com]
data.aws_iam_policy_document.ci_deploy_prod_trust: Reading...
data.aws_iam_policy_document.ci_deploy_prod_trust: Read complete after 0s [id=4060172364]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # aws_iam_role_policy.ci_deploy_prod_api_contract will be updated in-place
  ~ resource "aws_iam_role_policy" "ci_deploy_prod_api_contract" {
        id          = "er-ci-deploy-prod:api-contract"
        name        = "api-contract"
      ~ policy      = jsonencode(
          ~ {
              ~ Statement = [
                    {
                        Action   = [
                            "s3:PutObject",
                            "s3:GetObject",
                        ]
                        Effect   = "Allow"
                        Resource = [
                            "arn:aws:s3:::er-prod-api-contract-797781631727/releases/*",
                            "arn:aws:s3:::er-prod-api-contract-797781631727/deployed/*",
                        ]
                    },
                  + {
                      + Action   = [
                          + "ecr:GetDownloadUrlForLayer",
                          + "ecr:BatchCheckLayerAvailability",
                        ]
                      + Effect   = "Allow"
                      + Resource = "arn:aws:ecr:us-east-2:797781631727:repository/er-api"
                    },
                    {
                        Action    = "s3:ListBucket"
                        Condition = {
                            StringLike = {
                                "s3:prefix" = [
                                    "deployed/*",
                                    "releases/*",
                                ]
                            }
                        }
                        Effect    = "Allow"
                        Resource  = "arn:aws:s3:::er-prod-api-contract-797781631727"
                    },
                ]
                # (1 unchanged attribute hidden)
            }
        )
        # (2 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

@athvin
athvin merged commit 8f4e939 into main Nov 26, 2026
40 checks passed
@athvin
athvin temporarily deployed to marketing-preview November 26, 2026 01:45 — with GitHub Actions Inactive

This branch was previously deployed

1 inactive deployment
marketing-preview — 92d08908 Deployed Nov 26, 2026 by athvin via remove closed PR previews #62
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.

#658 follow-up: er-ci-deploy-prod needs ECR layer read for the launch gate's checker

2 participants