Commit Graph

10 Commits

Author SHA1 Message Date
unkin-agent 5245bcdc29 Omit empty tune block on remaining auth backends (#178)
ci/woodpecker/push/apply Pipeline was successful
terraform-provider-vault 5.6.0 panics in expandAuthMethodTune when an auth backend gets a tune block whose values are all null. #176 fixed the JWT backend; the approle, kubernetes, ldap and oidc backends still render tune unconditionally, so any mount of theirs without tune values crashes plan.

- Render tune via a dynamic block only when at least one tune value is set; values pass through unchanged
- Add tofu tests per module covering the unset and set cases
- Run the new module tests from make test and the tofu-module-tests hook

Reviewed-on: #178
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-11-14 19:02:09 +11:00
unkin-agent fbd161ccf0 Omit empty tune block on JWT auth backends (#176)
ci/woodpecker/push/apply Pipeline was successful
The GitHub Actions JWT mount sets no tune values, so the module rendered an all-null `tune {}` that crashes hashicorp/vault 5.6.0 in `expandAuthMethodTune` after the mount is enabled, leaving `jwt/github/iuclabs` live but outside state.

- Render the `tune` block on JWT auth backends only when a tune value is set
- Import `jwt/github/iuclabs` into state so the next apply converges instead of hitting "path is already in use"
- Add a tofu test for tune rendering and run it in `make test` and pre-commit

Reviewed-on: #176
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-11-10 23:36:33 +11:00
unkin-agent b9ae4a6802 Add GitHub Actions JWT auth mount for IUCLabs (#175)
ci/woodpecker/push/apply Pipeline failed
IUCLabs GitHub Actions workflows need read access to their own KV secrets without per-repo role and policy plumbing.

- add `auth/jwt/github/iuclabs` JWT mount trusting GitHub Actions OIDC
- add org-wide `default` role (mount `default_role`): audience `https://vault.service.consul:8200`, `user_claim=jti`, metadata mappings, 15m/1h TTLs
- restrict to `repository_owner=IUCLabs`, events push/release/schedule/pull_request, refs heads/tags/pull-merge; validation rejects anything wider
- attach templated read-only policy on `kv/github/<repo>/event/<event>/*` and `kv/github/<repo>/ref/<ref>/.secrets/*`
- add `tofu test` cases, run by `make test` and pre-commit
- document login, KV layout, event-path scope, `+` ref caveat and entity growth

Pairs with the terraform-git ref-name ruleset.

Reviewed-on: #175
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-11-10 23:25:31 +11:00
unkin-agent 890d666a53 Keep policy rule paths within their own directory (#158)
ci/woodpecker/push/apply Pipeline was successful
Nothing stopped a policy under policies/x/y/ from granting a rule path outside its own directory, so an over-broad grant read as ordinary review noise and only surfaced once applied to Vault.

- add tests/test_policies.py: a pydantic model rejecting unknown keys, empty rules and non-Vault capabilities
- check every rule path segment-wise against the policy's own directory, stripping the kv-v2 data/metadata segment
- relocate the rules that reached outside their directory, carrying capabilities and auth bindings verbatim
- run the suite from a local pre-commit hook and from make test

Reviewed-on: #158
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-09-28 22:12:14 +10:00
unkin-agent 57fe279d7a Run plan without acquiring the Consul state lock (#136)
ci/woodpecker/push/apply Pipeline was successful
PR plan pipelines were failing with "Error acquiring the state lock ... OperationTypePlan" when a plan collided with an apply (or another plan) holding the lock on the same Consul-backed state. Plans are read-only and don't need the lock.

- `plan`: pass `-lock=false` to `terragrunt ... plan`; `apply` is unchanged and still locks.

Reviewed-on: #136
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-08-23 22:31:58 +10:00
unkinben 9cbac6d3ef feat: add plan workflow
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/plan Pipeline was successful
- update makefile to enable kubernetes auth or roleid auth
- add plan workflow
- update all policies to allow the terraform-vault kubernetes role
2026-05-21 23:52:30 +10:00
unkinben 5cdf6b410d feat: use ephemeral consul token
- add vault_env to makefile
- retrieve a consul_http_token on demand from vault
2026-02-14 18:59:05 +11:00
unkinben 5536869a38 feat: implement consul ACL management with provider aliases
This commit message captures the major architectural change of implementing Consul ACL management
with proper provider aliasing, along with the supporting configuration files and policy definitions
for various terraform services.

- add consul_acl_management module to manage consul acl policies and roles
- add consul backend roles and policies for terraform services (incus, k8s, nomad, repoflow, vault)
- add consul provider configuration to root.hcl
- add policies to generate credentials for each role
- simplify consul_secret_backend_role module to reference acl-managed roles
- switch to opentofu for provider foreach support
- update terragrunt configuration to support consul backend aliases
- update pre-commit hooks to use opentofu instead of terraform
- configure tflint exceptions for consul acl management module
2026-02-14 18:13:50 +11:00
unkinben 8070b6f66b feat: major restructuring in migration to terragrunt
- migrate from individual terraform files to config-driven terragrunt module structure
- add vault_cluster module with config discovery system
- replace individual .tf files with centralized config.hcl
- restructure auth and secret backends as configurable modules
- move auth roles and secret backends to yaml-based configuration
- convert policies from .hcl to .yaml format, add rules/auth definition
- add pre-commit hooks for yaml formatting and file cleanup
- add terragrunt cache to gitignore
- update makefile with terragrunt commands and format target
2026-01-26 23:02:44 +11:00
unkinben 537cc9013a feat: add makefile
- add init, plan and apply to makefile
2025-11-16 12:39:32 +11:00