Repository navigation
feat(infra): prod Pod Identity, ESO and the §9 secrets envs/prod never had - #895
Merged
Merged
Conversation
Contributor
terraform plan
prod — 15 to add, 0 to changemodule.network.data.aws_availability_zones.available: Reading...
module.network.data.aws_region.current: Reading...
data.aws_caller_identity.current: Reading...
data.aws_iam_policy_document.eso_trust: Reading...
data.aws_iam_policy_document.eso_trust: Read complete after 0s [id=819195744]
module.network.data.aws_region.current: Read complete after 0s [id=us-east-2]
data.aws_iam_policy_document.pod_trust: Reading...
data.aws_rds_engine_version.aurora_pg: Reading...
data.aws_iam_policy_document.pod_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: 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]
module.eks.data.aws_iam_policy_document.node_trust: Read complete after 0s [id=2851119427]
data.aws_iam_policy_document.efs_csi_trust: Read complete after 0s [id=819195744]
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_iam_policy_document.lake_access: Reading...
data.aws_iam_policy_document.lake_access: Read complete after 0s [id=3734071059]
data.aws_caller_identity.current: Read complete after 0s [id=797781631727]
data.aws_iam_policy_document.eso: Reading...
data.aws_iam_policy_document.eso: Read complete after 0s [id=2178872705]
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]
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_eks_pod_identity_association.er_api will be created
+ resource "aws_eks_pod_identity_association" "er_api" {
+ association_arn = (known after apply)
+ association_id = (known after apply)
+ cluster_name = "er-prod"
+ disable_session_tags = false
+ external_id = (known after apply)
+ id = (known after apply)
+ namespace = "app"
+ region = "us-east-2"
+ role_arn = (known after apply)
+ service_account = "er-api"
+ tags_all = {
+ "Environment" = "prod"
+ "ManagedBy" = "terraform"
+ "Project" = "entity-resolution"
}
}
# aws_eks_pod_identity_association.er_runner will be created
+ resource "aws_eks_pod_identity_association" "er_runner" {
+ association_arn = (known after apply)
+ association_id = (known after apply)
+ cluster_name = "er-prod"
+ disable_session_tags = false
+ external_id = (known after apply)
+ id = (known after apply)
+ namespace = "app"
+ region = "us-east-2"
+ role_arn = (known after apply)
+ service_account = "er-runner"
+ tags_all = {
+ "Environment" = "prod"
+ "ManagedBy" = "terraform"
+ "Project" = "entity-resolution"
}
}
# aws_eks_pod_identity_association.eso will be created
+ resource "aws_eks_pod_identity_association" "eso" {
+ association_arn = (known after apply)
+ association_id = (known after apply)
+ cluster_name = "er-prod"
+ disable_session_tags = false
+ external_id = (known after apply)
+ id = (known after apply)
+ namespace = "external-secrets"
+ region = "us-east-2"
+ role_arn = (known after apply)
+ service_account = "external-secrets"
+ tags_all = {
+ "Environment" = "prod"
+ "ManagedBy" = "terraform"
+ "Project" = "entity-resolution"
}
}
# aws_iam_role.er_api_pod will be created
+ resource "aws_iam_role" "er_api_pod" {
+ arn = (known after apply)
+ assume_role_policy = jsonencode(
{
+ Statement = [
+ {
+ Action = [
+ "sts:TagSession",
+ "sts:AssumeRole",
]
+ Effect = "Allow"
+ Principal = {
+ Service = "pods.eks.amazonaws.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-prod-api-pod"
+ name_prefix = (known after apply)
+ path = "/"
+ tags = {
+ "Name" = "er-prod-api-pod"
}
+ tags_all = {
+ "Environment" = "prod"
+ "ManagedBy" = "terraform"
+ "Name" = "er-prod-api-pod"
+ "Project" = "entity-resolution"
}
+ unique_id = (known after apply)
+ inline_policy (known after apply)
}
# aws_iam_role.er_runner_pod will be created
+ resource "aws_iam_role" "er_runner_pod" {
+ arn = (known after apply)
+ assume_role_policy = jsonencode(
{
+ Statement = [
+ {
+ Action = [
+ "sts:TagSession",
+ "sts:AssumeRole",
]
+ Effect = "Allow"
+ Principal = {
+ Service = "pods.eks.amazonaws.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-prod-runner-pod"
+ name_prefix = (known after apply)
+ path = "/"
+ tags = {
+ "Name" = "er-prod-runner-pod"
}
+ tags_all = {
+ "Environment" = "prod"
+ "ManagedBy" = "terraform"
+ "Name" = "er-prod-runner-pod"
+ "Project" = "entity-resolution"
}
+ unique_id = (known after apply)
+ inline_policy (known after apply)
}
# aws_iam_role.eso will be created
+ resource "aws_iam_role" "eso" {
+ arn = (known after apply)
+ assume_role_policy = jsonencode(
{
+ Statement = [
+ {
+ Action = [
+ "sts:TagSession",
+ "sts:AssumeRole",
]
+ Effect = "Allow"
+ Principal = {
+ Service = "pods.eks.amazonaws.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-prod-external-secrets"
+ 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.er_runner_lake will be created
+ resource "aws_iam_role_policy" "er_runner_lake" {
+ id = (known after apply)
+ name = "er-prod-runner-lake"
+ name_prefix = (known after apply)
+ policy = jsonencode(
{
+ Statement = [
+ {
+ Action = [
+ "s3:PutObject",
+ "s3:ListMultipartUploadParts",
+ "s3:GetObject",
+ "s3:DeleteObject",
+ "s3:AbortMultipartUpload",
]
+ Effect = "Allow"
+ Resource = "arn:aws:s3:::er-prod-lake-797781631727/*"
+ Sid = "LakeObjects"
},
+ {
+ Action = [
+ "s3:ListBucketMultipartUploads",
+ "s3:ListBucket",
+ "s3:GetBucketLocation",
]
+ Effect = "Allow"
+ Resource = "arn:aws:s3:::er-prod-lake-797781631727"
+ Sid = "LakeList"
},
+ {
+ Action = [
+ "kms:GenerateDataKey*",
+ "kms:Decrypt",
]
+ Effect = "Allow"
+ Resource = "arn:aws:kms:us-east-2:797781631727:key/aac8b63d-fd14-4c13-896e-ceaa41dcf0ce"
+ Sid = "LakeKey"
},
]
+ Version = "2012-10-17"
}
)
+ role = (known after apply)
}
# aws_iam_role_policy.eso will be created
+ resource "aws_iam_role_policy" "eso" {
+ id = (known after apply)
+ name = "read-prod-secrets"
+ name_prefix = (known after apply)
+ policy = jsonencode(
{
+ Statement = [
+ {
+ Action = [
+ "secretsmanager:ListSecretVersionIds",
+ "secretsmanager:GetSecretValue",
+ "secretsmanager:DescribeSecret",
]
+ Effect = "Allow"
+ Resource = "arn:aws:secretsmanager:us-east-2:797781631727:secret:er/prod/*"
+ Sid = "ReadProdSecrets"
},
+ {
+ Action = [
+ "secretsmanager:ListSecrets",
+ "secretsmanager:BatchGetSecretValue",
]
+ Effect = "Allow"
+ Resource = "*"
+ Sid = "ListForDiscovery"
},
]
+ Version = "2012-10-17"
}
)
+ role = (known after apply)
}
# aws_secretsmanager_secret.erserver will be created
+ resource "aws_secretsmanager_secret" "erserver" {
+ arn = (known after apply)
+ description = "Prod control-plane env (er-server): DSN, operator token, tenant env template."
+ force_overwrite_replica_secret = false
+ id = (known after apply)
+ name = "er/prod/app/erserver"
+ name_prefix = (known after apply)
+ policy = (known after apply)
+ recovery_window_in_days = 30
+ region = "us-east-2"
+ tags_all = {
+ "Environment" = "prod"
+ "ManagedBy" = "terraform"
+ "Project" = "entity-resolution"
}
}
# aws_secretsmanager_secret.erweb will be created
+ resource "aws_secretsmanager_secret" "erweb" {
+ arn = (known after apply)
+ description = "Prod BFF env (er-web): database URL, session secret, credential-sealing key."
+ force_overwrite_replica_secret = false
+ id = (known after apply)
+ name = "er/prod/app/erweb"
+ name_prefix = (known after apply)
+ policy = (known after apply)
+ recovery_window_in_days = 30
+ region = "us-east-2"
+ tags_all = {
+ "Environment" = "prod"
+ "ManagedBy" = "terraform"
+ "Project" = "entity-resolution"
}
}
# aws_secretsmanager_secret_version.erserver will be created
+ resource "aws_secretsmanager_secret_version" "erserver" {
+ arn = (known after apply)
+ has_secret_string_wo = (known after apply)
+ id = (known after apply)
+ region = "us-east-2"
+ secret_arn = (known after apply)
+ secret_id = (known after apply)
+ secret_string = (sensitive value)
+ secret_string_wo = (write-only attribute)
+ version_id = (known after apply)
+ version_stages = (known after apply)
}
# aws_secretsmanager_secret_version.erweb will be created
+ resource "aws_secretsmanager_secret_version" "erweb" {
+ arn = (known after apply)
+ has_secret_string_wo = (known after apply)
+ id = (known after apply)
+ region = "us-east-2"
+ secret_arn = (known after apply)
+ secret_id = (known after apply)
+ secret_string = (sensitive value)
+ secret_string_wo = (write-only attribute)
+ version_id = (known after apply)
+ version_stages = (known after apply)
}
# random_bytes.operator_token will be created
+ resource "random_bytes" "operator_token" {
+ base64 = (sensitive value)
+ hex = (sensitive value)
+ length = 32
}
# random_bytes.web_credential_key will be created
+ resource "random_bytes" "web_credential_key" {
+ base64 = (sensitive value)
+ hex = (sensitive value)
+ length = 32
}
# random_bytes.web_session_secret will be created
+ resource "random_bytes" "web_session_secret" {
+ base64 = (sensitive value)
+ hex = (sensitive value)
+ length = 32
}
Plan: 15 to add, 0 to change, 0 to destroy.
Changes to Outputs:
+ app_namespace = "app"
+ er_api_pod_role_arn = (known after apply)
+ er_runner_pod_role_arn = (known after apply)
+ eso_role_arn = (known after apply)
|
…r had (#894) `envs/prod/` declared the network, EKS, Aurora, EFS and the lake, and none of the identity or secret plumbing a pod needs to start. #553-#556 all assume this substrate exists. - `secrets.tf`: the ESO role and its Pod Identity association, plus the two §9 Secrets Manager entries. Scoped to `er/prod/*` where dev's role allows `er/*` — dev's breadth is harmless in the direction that matters, but it is the wrong default to copy into the environment holding the real credentials. The entries are Terraform's here because prod has no `dev_env.sh`; the key lists are the chart's contract, since `externalsecrets.yaml` uses `dataFrom.extract` and a renamed key fails as a missing env var at pod start rather than at apply. - `pod_identity.tf`: `er-prod-api-pod` and `er-prod-runner-pod` with associations for the one fixed prod namespace. `er-api` carries no policy yet and that is the correct state — its two dev capabilities are SES send and Bedrock invoke, and prod has neither. The association is the part that must exist before a pod starts. - `lake.tf`: the `lake_access` document. The file's own comment has promised a role "wired with the app deploy" since October; that role is now written and this is what it attaches. The namespace is `app`, not `prod`: the chart turns it into the `developer` value which lands in the secret path, so `prod` would read back as `er/prod/prod/erserver` — the objection `ci-deploy.tf` already raised against naming dev's CI namespace `dev`. `random_bytes` rather than `random_password` for the two values whose encoding is load-bearing. `ERWEB_CREDENTIAL_KEY` must be 32 raw bytes base64-encoded — base64-encoding a 32-character password decodes to 32 bytes and so passes `frontend/src/lib/env.ts`'s check while carrying ~6 bits per byte instead of 8. The `erweb` entry is `ignore_changes = [secret_string]` and has a 30-day recovery window: its credential key unseals `erweb.org_credentials`, so an apply that re-rendered the value would orphan every sealed org credential. envs/prod is already in all three CI tiers (`tf-validate-all.sh`, and the plan and apply matrices), so no hand-written list needed joining. `footprint.md`'s generated block moves with it — +3 IAM roles, +2 role policies, +3 Pod Identity associations, +2 secrets and versions, and the `~> 3.6` random pin. The drift check compares against `git show HEAD:<f>` (skills-check.sh:2765), so a regenerated-but-uncommitted block still fails it. Closes #894 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
athvin
force-pushed
the
worktree-prod-substrate
branch
from
November 8, 2026 19:40
1c690ab to
625ed4a
Compare
This was referenced Nov 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #894
What
The ESO stack, the two Pod Identity roles and the two §9 Secrets Manager entries that
envs/prod/never had. Plus thelake_accesspolicy documentlake.tfhas referred to since October without defining.Why
#553–#556 all assume a prod substrate that does not exist. Without this, the
er-platformrelease fails at its first pre-install hook (its twoExternalSecrets resolve against no store) and a pod that did start could not reach the lake — Pod Identity has no node-credential fallback here by design.Proof
bash scripts/ci/tf-validate-all.sh— all five stacks, includingenvs/prod,Success! The configuration is valid.bash scripts/ci/tf-static-credentials-check.sh—clean — 1 access key(s), all allowed.terraform fmt -recursiveclean. No Rust or frontend files in the diff, somake check's compile tiers are not the gate this change answers to; CI'sdetectskips them for the same reason.Not applied. The plan tier will show the real resource count on this PR.
Risk & rollback
Risk: additive to a stack carrying no traffic — the
appnamespace it names does not exist yet, so the two associations bind to nothing until the deploy path lands. Rollback:git revert <merge-sha>, then an apply; the two Secrets Manager entries survive revert behind their recovery windows and must be deleted by hand if that is wanted.Post-merge ledger
Closed by: agent · session
a7f03c6d-206a-4ae3-a5c3-1c2f74052399onMac· 2026-11-08T20:05:00Zmainis green with this change on it — merge SHA9583e470, which isorigin/main's head.rustrun 42516455716 concluded success with 23 jobs and zero failures;frontend,infraanddevcontaineron the same SHA also success. The run satpendingwith zero jobs for ~6 minutes first — the merge-burst concurrency signature (four commits in four minutes; therustruns on8f4059deand350cd213were both cancelled) — so it was watched to a conclusion rather than read while pending.images—n/a — no image inputs changed.The diff is four Terraform files underenvs/prod/plus one generated reference; noimagesrun exists on9583e470.deploy—n/a — nothing to deploy, and the red run on this SHA is not this change.Adeployrun is attributed to9583e470and it failed, butDEPLOY_SHAinside it is350cd21379f73526b9af7a1e383ffde95a424368(feat(tags): reserved system tags, per-tag permission, tags in export (#805) #875,feat(tags)), andCLUSTERiser-dev. Root cause is feat(tags): reserved system tags, per-tag permission, tags in export (#805) #875's schema change, reported there with the pod log: the reconciler returnsverdict: breakingand refusespublic.tags: column kind is absent. Nothing in this diff reaches dev's control-plane schema.infra(the only one this change can affect) is green andapply (prod)ran;deployis knowingly red for feat(tags): reserved system tags, per-tag permission, tags in export (#805) #875's reason, not this change, per the box above;driftandkind's nightly leg have not fired since the merge and are untouched by a prod-only IAM/secrets diff.Donethrough the automation — Prod substrate: Pod Identity, ESO and the §9 secrets envs/prod never had #894 readsCLOSED / COMPLETEDat2026-11-08T19:43:25Z, two seconds after the merge, and its card readsDone. Not touched by hand.appNodePool + the per-environmentcluster-objectslayout, and applying the NetworkPolicy controller toer-prod), ANTHROPIC_API_KEY is empty in er/prod/app/erweb #907 (ANTHROPIC_API_KEYempty iner/prod/app/erweb). Thesslmode=verify-fullgap is Prod environment — network, EKS, Aurora #553's, where it was already recorded along with the 14-vs-35-day PITR finding.workflow_runattribution trap is recorded in memory (workflow-run-headsha-misattributes-deploy): for aworkflow_run-triggered deploy,gh run list'sheadShais the head ofmainwhen the run fired, not the commit being deployed, so a later merge appears to own an earlier one's broken deploy. It cost a full attribution pass here and would mislead any session landing a PR behind a broken deploy.Specific to this change
apply (prod)actually ran and created the 15 resources — run 42516455727, jobapply (prod)success. Verified against AWS rather than the log:er-prod-external-secrets,er-prod-api-podander-prod-runner-podall return ARNs fromiam get-role, andeks list-pod-identity-associations --cluster-name er-prodlistsapp/er-api,app/er-runnerandexternal-secrets/external-secrets.jq keyson each, values never printed:er/prod/app/erserver→ERSERVER_DSN, ERSERVER_OPERATOR_TOKEN, ERSERVER_TENANT_ENV_JSONer/prod/app/erweb→ANTHROPIC_API_KEY, ERWEB_CREDENTIAL_KEY, ERWEB_DATABASE_URL, ERWEB_SESSION_SECRETBoth match what
scripts/dev_env.shwrites for dev, which is the chart'sdataFrom.extractcontract.ANTHROPIC_API_KEYis filled in —deferred — #907. Terraform writes it empty on purpose andignore_changeskeeps it that way; the features degrade rather than crash, so this does not gate the bring-up.appNodePool —deferred — #906. Confirmed live that it is needed and not merely theoretical:modules/eks/main.tf:109setsnode_pools = ["system"], so Auto Mode'sgeneral-purposepool is not enabled ander-prodhas no NodePool at all.Context — plan, discoveries, measurements, files
Plan
lake.tf— definelake_access, mirroring dev's document (same actions; the environments differ in bucket and CMK, not in what is allowed).secrets.tf— ESO role scoped toer/prod/*, its association, and the two §9 entries.pod_identity.tf— the two roles, the lake policy on the runner, associations for the one fixed namespace.versions.tf—random ~> 3.6forrandom_bytes.envs/prodis already in all three CI tiers. It is — no hand-written list needed joining.Discoveries
envs/prod/lake.tf's comment described a role that did not exist. "prod reaches S3 via EKS Pod Identity (an IAM role), wired with the app deploy" has been in the tree since 2026-10-15, and neither the role nor thelake_accessdocument it attaches was ever written. Prod lake + scoped CloudTrail #554's body repeats the claim as fact.systemnode pool (node_pools = ["system"]), notgeneral-purpose. So prod has no pool that app pods can land on, and the customapppool is required rather than an optimisation. Split out, becausemake cluster-objectsis hardcoded toER_DEV_CONTEXTand the non-recursive apply that keepsmeasure/out of the cluster makes the per-environment nodepool layout its own decision.rds.tfalready writesERSERVER_DSNwithsslmode=require. Prod environment — network, EKS, Aurora #553's probe wantsverify-full, which needs the RDS CA bundle in the images first. The DSNs here match what is already there rather than introducing a second convention; Prod environment — network, EKS, Aurora #553 moves both.er/*, noter/dev/*. Copying it would have let the prod operator read developer namespaces and vice versa. Prod's is narrowed; dev's is left alone (the leak direction that matters is a dev cluster reading prod, not the reverse, and changing dev's is not this PR's business).Measurements
Files
infra/terraform/envs/prod/secrets.tf(new) — ESO role + association,er/prod/app/{erserver,erweb}infra/terraform/envs/prod/pod_identity.tf(new) —er-prod-api-pod,er-prod-runner-pod, associationsinfra/terraform/envs/prod/lake.tf— thelake_accessdocumentinfra/terraform/envs/prod/versions.tf—random ~> 3.6