This repository has been archived on 2026-11-21. You can view files and clone it. You cannot open issues or pull requests or push a commit.
unkin-agent 5245bcdc29
ci/woodpecker/push/apply Pipeline was successful
Omit empty tune block on remaining auth backends (#178)
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
2024-09-09 22:57:00 +10:00

terraform-vault

A repository to manage the configuration of Vault secret engines, authentication modes and policies.

Usage

  1. Initialize Terraform

Once you have your backend block configured, you need to initialize your Terraform working directory to configure the backend:

terraform init

This command initializes the backend and checks the connection to Consul. If everything is set up correctly, Terraform will start using Consul as its backend for storing the state.

  1. Common terraform init Errors

If you encounter errors while running terraform init, check the following:

Consul server is reachable: Make sure that the address is correct and that you can connect to the Consul server.
Consul token (if using ACLs): Verify that the token has the correct permissions to write to the specified path in the Consul KV store.
  1. Example Consul KV Structure

In Consul, the state file will be stored in the KV store under the specified path:

terraform/state

You can check the Consul KV store by accessing the Consul UI or using the consul kv command to see the stored Terraform state:

consul kv get terraform/state

GitHub Actions JWT roles

auth/jwt/github/iuclabs trusts GitHub Actions OIDC tokens. One org-wide role, default (config/auth_jwt_role/jwt/github/iuclabs/default.yaml, the mount's default_role, so workflows needn't name it), accepts any IUCLabs repo for push, release, schedule and pull_request runs on refs/heads/*, refs/tags/* or refs/pull/*/merge. Role validation rejects any other event (pull_request_target, workflow_run, comment events), any other ref glob, and globs in any other claim. Fork pull requests can't mint OIDC tokens unless "Send write tokens to workflows from pull requests" is enabled on the repo.

Workflows log in with audience https://vault.service.consul:8200:

permissions:
  id-token: write
  contents: read
steps:
  - uses: hashicorp/vault-action@v3
    with:
      url: https://vault.service.consul:8200
      method: jwt
      path: jwt/github/iuclabs
      jwtGithubAudience: https://vault.service.consul:8200
      secrets: |
        kv/data/github/IUCLabs/<repo>/ref/refs/heads/main/.secrets/deploy token | DEPLOY_TOKEN

The role attaches a templated read-only policy, so each run reads only its own KV-v2 secrets:

  • kv/github/<org>/<repo>/event/<event_name>/* is not ref-scoped: any run of that event in the repo, on any branch or tag a writer pushes, can read it; keep it for secrets every such run may use
  • kv/github/<org>/<repo>/ref/<full ref>/.secrets/*, e.g. ref/refs/heads/main/.secrets/, ref/refs/tags/v1.2.3/.secrets/; git refnames can't contain a .-prefixed component, so branch x can never read branch x/y's secrets

On OpenBao older than the fork's v2.6, a ref path component of exactly + acts as a single-segment wildcard in the templated policy. Public IUCLabs repos block such refs via a terraform-git ruleset; private repos are not protected, so a writer in a private repo can read that repo's other refs' secrets.

user_claim is jti, so every run creates its own Vault identity entity; Vault never garbage-collects these, so entity count grows with CI volume.

Extra policies are granted via a policy yaml auth: {jwt/github/iuclabs: [default]}; the KV read policy is attached automatically.

S
Description
A repository to manage the configuration of Vault secret engines, authentication modes and policies.
Readme MIT 1.6 MiB
Languages
HCL 95.1%
Python 4.2%
Makefile 0.7%