Skip to content

fix(infra): grant PlatformReadOnly a view access entry on er-dev (#839) - #844

Merged
athvin merged 2 commits into
mainfrom
issue/839-eks-readonly-access
Nov 8, 2026
Merged

athvin merged 2 commits into
mainfrom
issue/839-eks-readonly-access

Conversation

@athvin

@athvin athvin commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

Closes #839

🚧 Claimed by an agent session — 2026-11-08T07:45:54Z, session 01a1b892-4cde-7a53-bb3e-9ed2e764acdc on Mac.
The claim is this open draft PR: closing it releases the ticket.

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

What

Grants the PlatformReadOnly SSO permission-set role a cluster-scoped EKS access entry with AmazonEKSViewPolicy on er-dev, via a new viewer_principal_arns variable on the eks module.

Why

kubectl as er-readonly gets a 401 from the cluster even though the IAM side is healthy: the module created access entries for admins but none for read-only identities. Deploy verification (kubectl get pods, log fetches) is documented as a read-only-profile operation and cannot work without this entry.

Proof

AWS_ACCESS_KEY_ID=test … bash scripts/ci/tf-validate-all.sh → "Success! The configuration is valid." for every env. scripts/skills-check.sh regen updated the generated AWS footprint (the two access-resource types move 1→2). The behavioral proof is post-merge: the apply creates the entry and kubectl --context er-dev-ro get pods -A stops 401ing.

Risk & rollback

Additive only — a new access entry and policy association; nothing existing is touched. Worst case the read-only role sees more of the cluster than intended, but AmazonEKSViewPolicy reads no Secret contents, matching the AWS-side ReadOnlyAccess posture. Rollback: git revert <merge-sha> and re-apply, or remove the access entry by hand.

Post-merge ledger

Closed by: agent · session 01a1b892-4cde-7a53-bb3e-9ed2e764acdc on Mac · 2026-11-08T08:18:38Z

  • main is green with this change on it — merge SHA f2568e17; all
    four push runs success: infra 42461288374 (incl. apply core/dev/prod),
    rust 42461288368, frontend 42461288375, devcontainer 42461288348:
  • images — n/a: infra-only diff, no image inputs changed; the images
    workflow correctly never ran (absent from the merge SHA's run list):
  • deploy — for an infra change the apply IS the deploy: infra run
    42461288374 apply (dev) success created the access entry; no app/chart
    change, so no app deploy was owed. Convergence proof below:
  • the push-only surface no pull request can pre-test — apply green
    (run 42461288374); drift latest 42453080846 success; kind nightly leg
    latest 42455973323 success. Nothing red for a reason that is this change:
  • the board card reached Done through the automation (verified via
    GraphQL projectItems), and er-dev rejects the er-readonly identity with 401 — EKS access entry drift suspected #839 closed COMPLETED on merge:
  • follow-ups — skill: document the EKS 401-despite-healthy-IAM failure mode in aws-account-operations #846 (document the 401 failure mode in
    aws-account-operations); nothing else deferred:
  • what was learned is written down — the 401-despite-healthy-IAM
    failure mode is recorded in the module comment at
    infra/terraform/envs/dev/eks.tf and filed as skill: document the EKS 401-despite-healthy-IAM failure mode in aws-account-operations #846 for the
    aws-account-operations skill:

Specific to this change

  • kubectl --context er-dev-ro works — post-apply, kubectl --context er-dev-ro -n ci get pods returns the namespace's pods (er-dispatcher, web-api-blue, er-tenant-drift) instead of Unauthorized. The ticket's acceptance, proven.
Context — plan, discoveries, measurements, files

Plan

  1. Probe the cluster's access entries as er-readonly to distinguish gap from drift. ✅
  2. Add viewer_principal_arns (map, default {}) to the eks module, wired to aws_eks_access_entry + aws_eks_access_policy_association with AmazonEKSViewPolicy at cluster scope. ✅
  3. Pass the materialized PlatformReadOnly role ARN from envs/dev. ✅
  4. Regenerate the AWS footprint reference; validate all envs credential-free. ✅
  5. Post-merge: confirm the apply created the entry and kubectl --context er-dev-ro reads.

Discoveries

  • aws eks list-access-entries --cluster-name er-dev (profile er-readonly) lists entries for AdministratorAccess and PlatformAdmin but no PlatformReadOnly entry — the 401 is a coverage gap in the module, not drift of an existing entry.
  • The module already had an admin_principal_arns map feeding identical resources with AmazonEKSClusterAdminPolicy; the fix mirrors that shape for viewers rather than inventing a second pattern.
  • AmazonEKSViewPolicy excludes Secret contents, which is the match for the AWS-side ReadOnlyAccess managed policy the permission set carries.
  • Local terraform is 1.5.7 but the repo requires ≥1.11; used a downloaded 1.11.4 binary for validate.

Measurements

  • aws eks list-access-entries --cluster-name er-dev --profile er-readonly → 2 entries (AdministratorAccess, PlatformAdmin), neither covering the PlatformReadOnly role ARN.
  • kubectl --context er-dev-ro -n ci get pods → error: You must be logged in to the server (Unauthorized) before this change.

Files

  • infra/terraform/modules/eks/main.tf — new viewer_principal_arns variable + viewer access entry and policy association.
  • infra/terraform/envs/dev/eks.tf — passes the materialized PlatformReadOnly SSO role ARN.
  • .claude/skills/aws-account-operations/references/footprint.md — regenerated (generated block; the two access-resource types move 1→2).

The eks module created access entries for admin principals only, so the
er-readonly profile's SSO role got a 401 from the cluster despite healthy
IAM. Add a viewer_principal_arns map wired to an access entry with
AmazonEKSViewPolicy (cluster scope, no Secret contents) and pass the
materialized PlatformReadOnly role ARN from envs/dev. Regenerate the AWS
footprint reference for the two resource-type count changes.
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

terraform plan

b414b8c · run log and full plans

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

dev — 2 to add, 0 to change
module.network.data.aws_region.current: Reading...
data.aws_region.current: Reading...
module.eks.data.aws_iam_policy_document.cluster_trust: Reading...
data.aws_region.current: Read complete after 0s [id=us-east-2]
module.network.data.aws_region.current: Read complete after 0s [id=us-east-2]
module.eks.data.aws_iam_policy_document.cluster_trust: Read complete after 0s [id=1029077455]
data.aws_iam_policy_document.efs_csi_trust: Reading...
data.aws_iam_openid_connect_provider.github: Reading...
data.aws_iam_policy_document.er_api_pod_trust: Reading...
data.aws_rds_engine_version.aurora_pg: Reading...
data.aws_iam_policy_document.efs_csi_trust: Read complete after 0s [id=819195744]
data.aws_iam_policy_document.eso_trust: Reading...
data.aws_caller_identity.current: Reading...
module.eks.data.aws_iam_policy_document.node_trust: Reading...
data.aws_iam_policy_document.er_api_pod_trust: Read complete after 0s [id=819195744]
data.aws_iam_policy_document.eso: Reading...
data.aws_iam_policy_document.eso_trust: Read complete after 0s [id=819195744]
data.aws_iam_policy_document.obs_pod_trust: Reading...
module.eks.data.aws_iam_policy_document.node_trust: Read complete after 0s [id=2851119427]
module.network.data.aws_availability_zones.available: Reading...
data.aws_iam_policy_document.obs_pod_trust: Read complete after 0s [id=819195744]
data.aws_iam_policy_document.eso: Read complete after 0s [id=1725605485]
data.aws_iam_policy_document.fluent_bit: Reading...
data.aws_iam_policy_document.fluent_bit: Read complete after 0s [id=4006586444]
data.aws_iam_policy_document.otel_collector: Reading...
data.aws_iam_policy_document.otel_collector: Read complete after 0s [id=3111493560]
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=2205495074]
data.aws_caller_identity.current: Read complete after 0s [id=797781631727]
data.aws_iam_policy_document.bedrock_invoke: Reading...
data.aws_iam_policy_document.lake_access: Reading...
data.aws_iam_policy_document.bedrock_invoke: Read complete after 0s [id=3601248236]
data.aws_iam_policy_document.lake_access: Read complete after 0s [id=3442692123]
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_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_dev_trust: Reading...
data.aws_iam_policy_document.ci_deploy_dev_trust: Read complete after 0s [id=4060172364]
data.aws_iam_policy_document.ci_deploy_dev: Reading...
data.aws_iam_policy_document.ci_deploy_dev: Read complete after 0s [id=1754478413]

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:

  # module.eks.aws_eks_access_entry.viewer["platform_readonly"] will be created
  + resource "aws_eks_access_entry" "viewer" {
      + access_entry_arn  = (known after apply)
      + cluster_name      = "er-dev"
      + created_at        = (known after apply)
      + id                = (known after apply)
      + kubernetes_groups = (known after apply)
      + modified_at       = (known after apply)
      + principal_arn     = "arn:aws:iam::797781631727:role/aws-reserved/sso.amazonaws.com/us-east-2/AWSReservedSSO_PlatformReadOnly_32bd506ae970d37d"
      + region            = "us-east-2"
      + tags_all          = {
          + "Environment" = "dev"
          + "ManagedBy"   = "terraform"
          + "Project"     = "entity-resolution"
        }
      + type              = "STANDARD"
      + user_name         = (known after apply)
    }

  # module.eks.aws_eks_access_policy_association.viewer["platform_readonly"] will be created
  + resource "aws_eks_access_policy_association" "viewer" {
      + associated_at = (known after apply)
      + cluster_name  = "er-dev"
      + id            = (known after apply)
      + modified_at   = (known after apply)
      + policy_arn    = "arn:aws:eks::aws:cluster-access-policy/AmazonEKSViewPolicy"
      + principal_arn = "arn:aws:iam::797781631727:role/aws-reserved/sso.amazonaws.com/us-east-2/AWSReservedSSO_PlatformReadOnly_32bd506ae970d37d"
      + region        = "us-east-2"

      + access_scope {
          + type = "cluster"
        }
    }

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

@athvin
athvin marked this pull request as ready for review November 8, 2026 08:02
@athvin
athvin merged commit f2568e1 into main Nov 8, 2026
41 checks passed
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.

er-dev rejects the er-readonly identity with 401 — EKS access entry drift suspected

2 participants