fix(vault): rename applications.policies → ops_policies (cms CI was silently missing its R2 policy) #4
Reference in New Issue
Block a user
Delete Branch "claude/fix-cms-ops-policies-key"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The bug
The
applicationsobject field is declaredpoliciesinvariables.tf, but everything else uses the nameops_policies:cmstfvars entry:ops_policies = ["factory__cf_r2_arcodange_tf"]doc/runbooks/new-web-app/03-vault-platform.md:28,82vibe/guidebooks/tools/secrets-and-vso.md:112modules/app_policyvariableops_policiesTerraform silently drops unknown attributes when converting a value to an
object()type, so cms'sops_policieswas discarded andeach.value.policies(main.tf:82) fell back to[]. Net effect:gitea_cicd_cmsnever received thefactory__cf_r2_arcodange_tftoken policy (read onkvv1/cloudflare/r2/arcodange-tf+kvv1/zoho/self_client, defined in factoryiac/cloudflare.tf:52). cms CI has been missing its Cloudflare R2 Terraform-state permissions.The fix (root-cause, not symptom)
Rename the schema field
policies→ops_policies+ its single reference (main.tf:82each.value.policies→each.value.ops_policies). This aligns the whole chain.I chose this over renaming the tfvars key (the obvious alternative) because:
ops_policies, so renaming the tfvars would also require fixing both docs to prevent the next app from copying the broken key again. Renaming the schema fixes it at the source.Behavioural change + merge gate
gitea_cicd_cmsgainsfactory__cf_r2_arcodange_tfin itstoken_policies. No other app sets this field (all default[]), so no other role changes. The CItofu applymust show onlyvault_jwt_auth_backend_role.gitea_jwt_cicd["cms"]updated in-place (token_policies gains the R2 policy) and 0 destroyed — I'll dispatch + confirm before merging.Reviewer: please confirm
factory__cf_r2_arcodange_tfis the intended grant for cms CI (it is persecrets-and-vso.md:112, but it's your prod permission so worth a glance).🤖 Generated with Claude Code