Skip to content

feat(infra): prod deploy identity — CI role, EKS access entry, /app EFS access point (#929) - #930

Merged
athvin merged 2 commits into
mainfrom
issue/929-prod-deploy-identity
Nov 8, 2026
Merged

athvin merged 2 commits into
mainfrom
issue/929-prod-deploy-identity

Conversation

@athvin

@athvin athvin commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

Closes #929

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

What

The Terraform half of #556's prod deploy path: er-ci-deploy-prod (GitHub OIDC, main-pinned trust; eks:DescribeCluster, read-only er/prod/app/* secrets, ECR digest reads, EFS + ELBv2 describes for discovery), its EKS access entry on er-prod, and the /app EFS access point nothing created until now.

Why

The role must exist in the account before any workflow assumes it — dev set that precedent (role applied first, first rollout via workflow_dispatch). Merging role and deploy leg together would race on merge and put red deploy runs on main. Verified live: prod EFS fs-05ee4143366be7722 has zero access points.

Proof

bash scripts/ci/tf-validate-all.sh — all stacks valid (Terraform 1.11.4); terraform fmt -check clean; bash scripts/ci/tf-static-credentials-check.sh clean.

Risk & rollback

Risk: the access entry grants the CI role cluster-admin on er-prod — bounded by the main-only OIDC trust; mirrors dev. Rollback: git revert, merge — CI applies the removal.

Post-merge ledger

Closed by: agent · codex session on Athvins-MacBook-Pro · 2026-11-08T23:15:00Z

Specific to this change

Context — plan, discoveries, measurements, files

Plan

Discoveries

Measurements

Files

@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

terraform plan

48a0b77 · run log and full plans

env add change destroy
state-backend (plan only) 0 0 0
core 0 0 2
dev 0 0 0
prod 5 0 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.

Warning

This plan DESTROYS resources in: core. Merging applies it unattended.
The apply refuses to run unless the merge commit message carries
ALLOW-DESTROY. Retitling is not enough on a single-commit PR — GitHub
uses the commit message there, not the title. Merge with
gh pr merge <n> --squash --subject '<subject> ALLOW-DESTROY'.

core — 0 to add, 0 to change, 2 to DESTROY
data.aws_iam_policy_document.ci_tf_apply_no_prod_state: Reading...
data.aws_iam_policy_document.ci_tf_apply_no_prod_state: Read complete after 0s [id=2395007408]
data.aws_iam_policy_document.obs_pod_trust: Reading...
module.identity_center.data.aws_ssoadmin_instances.this: Reading...
data.aws_iam_policy_document.obs_pod_trust: Read complete after 0s [id=819195744]
data.aws_iam_policy_document.ci_tf_plan_state: Reading...
data.aws_caller_identity.current: Reading...
data.aws_iam_policy_document.ci_tf_plan_state: Read complete after 0s [id=2883378100]
data.aws_iam_policy_document.ci_tf_drift_refresh: Reading...
module.github_oidc.data.aws_iam_policy_document.trust: Reading...
module.github_oidc.data.aws_iam_policy_document.trust: Read complete after 0s [id=4060172364]
data.aws_iam_policy_document.ci_tf_drift_refresh: Read complete after 0s [id=2350222434]
data.aws_iam_policy_document.cur_delivery: Reading...
data.aws_caller_identity.current: Read complete after 0s [id=797781631727]
data.aws_iam_policy_document.cur_delivery: Read complete after 0s [id=2207400467]
data.aws_iam_policy_document.sccache_write: Reading...
data.aws_iam_policy_document.sccache_read: Reading...
data.aws_iam_policy_document.config_bucket: Reading...
data.aws_iam_policy_document.sccache_read: Read complete after 0s [id=2701062528]
data.aws_iam_policy_document.sccache_write: Read complete after 0s [id=786296009]
data.aws_iam_policy_document.openobserve: Reading...
data.aws_iam_policy_document.sccache_trust_read: Reading...
data.aws_iam_policy_document.config_bucket: Read complete after 0s [id=4067691321]
data.aws_iam_policy_document.ci_tf_plan_trust: Reading...
data.aws_iam_policy_document.openobserve: Read complete after 0s [id=2662704728]
data.aws_iam_policy_document.ci_tf_plan_trust: Read complete after 0s [id=1630650595]
data.aws_iam_policy_document.sccache_trust_write: Reading...
data.aws_iam_policy_document.sccache_trust_read: Read complete after 0s [id=1630650595]
data.aws_iam_policy_document.sccache_trust_write: Read complete after 0s [id=4060172364]
data.aws_iam_policy_document.audit_bucket: Reading...
data.aws_iam_policy_document.ci_tf_apply_trust: Reading...
data.aws_iam_policy_document.audit_bucket: Read complete after 0s [id=3031279952]
data.aws_iam_policy_document.ci_tf_apply_trust: Read complete after 0s [id=2538345208]
data.aws_iam_policy_document.ci_tf_drift_trust: Reading...
data.aws_iam_policy_document.ci_tf_drift_trust: Read complete after 0s [id=2357770959]
module.github_oidc.data.aws_iam_policy_document.push: Reading...
module.github_oidc.data.aws_iam_policy_document.push: Read complete after 0s [id=2177873069]
data.aws_iam_policy_document.ci_tf_apply_prod_trust: Reading...
data.aws_iam_policy_document.ci_tf_apply_prod_trust: Read complete after 0s [id=3513372776]
module.identity_center.data.aws_ssoadmin_instances.this: Read complete after 0s [id=us-east-2]
module.identity_center.data.aws_identitystore_user.admin: Reading...
module.identity_center.data.aws_identitystore_user.admin: Read complete after 0s [id=b17b2500-e0b1-7046-405b-23c088cf392b]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  - destroy

Terraform will perform the following actions:

  # cloudflare_r2_bucket.sccache[0] will be destroyed
  # (because index [0] is out of range for count)
  - resource "cloudflare_r2_bucket" "sccache" {
      - account_id    = "9eefbe6bc92d11b2bb4e962494765a4c" -> null
      - creation_date = "2026-11-08T20:59:18.644Z" -> null
      - id            = "er-ci-sccache" -> null
      - jurisdiction  = "default" -> null
      - location      = "ENAM" -> null
      - name          = "er-ci-sccache" -> null
      - storage_class = "Standard" -> null
    }

  # cloudflare_r2_bucket_lifecycle.sccache[0] will be destroyed
  # (because index [0] is out of range for count)
  - resource "cloudflare_r2_bucket_lifecycle" "sccache" {
      - account_id   = "9eefbe6bc92d11b2bb4e962494765a4c" -> null
      - bucket_name  = "er-ci-sccache" -> null
      - jurisdiction = "default" -> null
      - rules        = [
          - {
              - abort_multipart_uploads_transition = {
                  - condition = {
                      - max_age = 86400 -> null
                      - type    = "Age" -> null
                    } -> null
                } -> null
              - conditions                         = {
                    # (1 unchanged attribute hidden)
                } -> null
              - delete_objects_transition          = {
                  - condition = {
                      - max_age = 1209600 -> null
                      - type    = "Age" -> null
                    } -> null
                } -> null
              - enabled                            = true -> null
              - id                                 = "expire-cache-objects" -> null
            },
        ] -> null
    }

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

Changes to Outputs:
  - r2_sccache_bucket         = "er-ci-sccache" -> null
  - r2_sccache_endpoint       = "https://9eefbe6bc92d11b2bb4e962494765a4c.r2.cloudflarestorage.com" -> null

Warning: Resource Destruction Considerations

  with cloudflare_r2_bucket_lifecycle.sccache[0],
  on r2.tf line 96, in resource "cloudflare_r2_bucket_lifecycle" "sccache":
  96: resource "cloudflare_r2_bucket_lifecycle" "sccache" {

Applying this resource destruction will remove the resource from the
Terraform state but will not change it in the API. If you would like to
destroy or reset this resource in the API, refer to the documentation for how
to do it manually.
prod — 5 to add, 0 to change
data.aws_rds_engine_version.aurora_pg: Reading...
module.network.data.aws_availability_zones.available: Reading...
module.eks.data.aws_iam_policy_document.node_trust: Reading...
data.aws_iam_policy_document.pod_trust: Reading...
module.eks.data.aws_iam_policy_document.cluster_trust: Reading...
data.aws_iam_policy_document.eso_trust: Reading...
module.network.data.aws_region.current: Reading...
module.eks.data.aws_iam_policy_document.cluster_trust: Read complete after 0s [id=1029077455]
module.network.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]
data.aws_iam_policy_document.eso_trust: Read complete after 0s [id=819195744]
data.aws_iam_policy_document.efs_csi_trust: Reading...
module.eks.data.aws_iam_policy_document.node_trust: Read complete after 0s [id=2851119427]
data.aws_caller_identity.current: Reading...
data.aws_iam_policy_document.efs_csi_trust: Read complete after 0s [id=819195744]
data.aws_iam_openid_connect_provider.github: Reading...
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=3960055703]
data.aws_caller_identity.current: Read complete after 0s [id=797781631727]
data.aws_iam_policy_document.lake_access: Reading...
data.aws_iam_policy_document.lake_access: Read complete after 0s [id=3734071059]
data.aws_iam_policy_document.eso: Reading...
data.aws_iam_policy_document.eso: Read complete after 0s [id=2178872705]
data.aws_rds_engine_version.aurora_pg: Read complete after 1s [id=17.9]
module.network.data.aws_availability_zones.available: Read complete after 1s [id=us-east-2]
data.aws_iam_policy_document.ci_deploy_prod: Reading...
data.aws_iam_policy_document.ci_deploy_prod: Read complete after 0s [id=3634844169]
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:
  + create

Terraform will perform the following actions:

  # aws_efs_access_point.app will be created
  + resource "aws_efs_access_point" "app" {
      + arn             = (known after apply)
      + file_system_arn = (known after apply)
      + file_system_id  = "fs-05ee4143366be7722"
      + id              = (known after apply)
      + owner_id        = (known after apply)
      + region          = "us-east-2"
      + tags            = {
          + "Name" = "er-prod-config-app"
        }
      + tags_all        = {
          + "Environment" = "prod"
          + "ManagedBy"   = "terraform"
          + "Name"        = "er-prod-config-app"
          + "Project"     = "entity-resolution"
        }

      + posix_user {
          + gid = 1001
          + uid = 1001
        }

      + root_directory {
          + path = "/app"

          + creation_info {
              + owner_gid   = 1001
              + owner_uid   = 1001
              + permissions = "0750"
            }
        }
    }

  # aws_iam_role.ci_deploy_prod will be created
  + resource "aws_iam_role" "ci_deploy_prod" {
      + arn                   = (known after apply)
      + assume_role_policy    = jsonencode(
            {
              + Statement = [
                  + {
                      + Action    = "sts:AssumeRoleWithWebIdentity"
                      + Condition = {
                          + StringEquals = {
                              + "token.actions.githubusercontent.com:aud" = "sts.amazonaws.com"
                              + "token.actions.githubusercontent.com:sub" = "repo:athvin@273880343/entity-resolution-engine@1334344510:ref:refs/heads/main"
                            }
                        }
                      + Effect    = "Allow"
                      + Principal = {
                          + Federated = "arn:aws:iam::797781631727:oidc-provider/token.actions.githubusercontent.com"
                        }
                    },
                ]
              + Version   = "2012-10-17"
            }
        )
      + create_date           = (known after apply)
      + force_detach_policies = false
      + id                    = (known after apply)
      + managed_policy_arns   = (known after apply)
      + max_session_duration  = 3600
      + name                  = "er-ci-deploy-prod"
      + name_prefix           = (known after apply)
      + path                  = "/"
      + tags_all              = {
          + "Environment" = "prod"
          + "ManagedBy"   = "terraform"
          + "Project"     = "entity-resolution"
        }
      + unique_id             = (known after apply)

      + inline_policy (known after apply)
    }

  # aws_iam_role_policy.ci_deploy_prod will be created
  + resource "aws_iam_role_policy" "ci_deploy_prod" {
      + id          = (known after apply)
      + name        = "deploy-prod"
      + name_prefix = (known after apply)
      + policy      = jsonencode(
            {
              + Statement = [
                  + {
                      + Action   = "eks:DescribeCluster"
                      + Effect   = "Allow"
                      + Resource = "arn:aws:eks:us-east-2:797781631727:cluster/er-prod"
                    },
                  + {
                      + Action   = [
                          + "elasticfilesystem:DescribeFileSystems",
                          + "elasticfilesystem:DescribeAccessPoints",
                        ]
                      + Effect   = "Allow"
                      + Resource = "*"
                    },
                  + {
                      + Action   = [
                          + "secretsmanager:GetSecretValue",
                          + "secretsmanager:DescribeSecret",
                        ]
                      + Effect   = "Allow"
                      + Resource = "arn:aws:secretsmanager:us-east-2:797781631727:secret:er/prod/app/*"
                    },
                  + {
                      + Action   = [
                          + "ecr:ListImages",
                          + "ecr:GetAuthorizationToken",
                          + "ecr:DescribeImages",
                          + "ecr:BatchGetImage",
                        ]
                      + Effect   = "Allow"
                      + Resource = "*"
                    },
                  + {
                      + Action   = "elasticloadbalancing:DescribeTargetGroups"
                      + Effect   = "Allow"
                      + Resource = "*"
                    },
                ]
              + Version   = "2012-10-17"
            }
        )
      + role        = (known after apply)
    }

  # module.eks.aws_eks_access_entry.admin["ci_deploy"] will be created
  + resource "aws_eks_access_entry" "admin" {
      + access_entry_arn  = (known after apply)
      + cluster_name      = "er-prod"
      + created_at        = (known after apply)
      + id                = (known after apply)
      + kubernetes_groups = (known after apply)
      + modified_at       = (known after apply)
      + principal_arn     = (known after apply)
      + region            = "us-east-2"
      + tags_all          = {
          + "Environment" = "prod"
          + "ManagedBy"   = "terraform"
          + "Project"     = "entity-resolution"
        }
      + type              = "STANDARD"
      + user_name         = (known after apply)
    }

  # module.eks.aws_eks_access_policy_association.admin["ci_deploy"] will be created
  + resource "aws_eks_access_policy_association" "admin" {
      + associated_at = (known after apply)
      + cluster_name  = "er-prod"
      + id            = (known after apply)
      + modified_at   = (known after apply)
      + policy_arn    = "arn:aws:eks::aws:cluster-access-policy/AmazonEKSClusterAdminPolicy"
      + principal_arn = (known after apply)
      + region        = "us-east-2"

      + access_scope {
          + type = "cluster"
        }
    }

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

Changes to Outputs:
  + app_efs_access_point_id = (known after apply)
  + ci_deploy_prod_role_arn = (known after apply)

@athvin
athvin marked this pull request as ready for review November 8, 2026 22:43
@athvin
athvin merged commit ff5b416 into main Nov 8, 2026
40 checks passed
@athvin athvin mentioned this pull request Nov 8, 2026
3 tasks done
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.

Prod deploy identity: CI role, EKS access entry, app EFS access point (Terraform half of #556)

2 participants