Skip to content

feat(terraform-vault): make the tfvars template and credential file inputs - #175

Merged
patrick-hermann-sva merged 1 commit into
mainfrom
feat/terraform-vault-parameterize
Sep 9, 2026
Merged

feat(terraform-vault): make the tfvars template and credential file inputs#175
patrick-hermann-sva merged 1 commit into
mainfrom
feat/terraform-vault-parameterize

Conversation

@patrick-hermann-sva

Copy link
Copy Markdown
Contributor

ENCRYPTED_ENV and TFVARS_TEMPLATE were env: constants, which tied this workflow to one terraform config — the cert issuer:

ENCRYPTED_ENV:    secrets/envs/vault-infra-${{ inputs.lab }}.enc.yaml
TFVARS_TEMPLATE:  secrets/envs/vault-ca-terraform-tfvars.json.tmpl

That blocks any other Vault work through this workflow. A per-cluster ESO KV mount and read policy needs different values for both, and on LabDA the credentials live in secrets/envs/openbao-labda.enc.yaml — a name the derived vault-infra-<lab> pattern cannot produce, and a file that carries no vaultCaBundle for the cert-issuer template to render.

Backwards compatible by construction

Both inputs default to exactly what was hardcoded, so every existing caller keeps its behaviour without naming either one.

The fallback shape is load-bearing

workflow_dispatch does not define these inputs, so a dispatched run reads them as empty. Without the != '' && x || default guard on both, a dispatched run would render with no template file at all.

The first version of this change had exactly that bug — TFVARS_TEMPLATE: ${{ inputs.tfvars-template }} alone — and it only shows up on the dispatch path, not the call path. Resolution was simulated for all three cases before pushing:

trigger result
call, both set secrets/envs/openbao-labda.enc.yaml
call, neither set secrets/envs/vault-infra-labul.enc.yaml (unchanged)
dispatch (inputs empty) secrets/envs/vault-infra-labda.enc.yaml (unchanged)

🤖 Generated with Claude Code

https://claude.ai/code/session_01K2rfvVDXWjWZAKMcpwvgLG

…nputs

ENCRYPTED_ENV and TFVARS_TEMPLATE were env constants, which tied this workflow
to ONE terraform config: the cert issuer, whose tfvars needs a vaultCaBundle
and whose credentials live under the vault-infra-<lab> name.

That blocks any other Vault work. A per-cluster ESO KV mount and read policy
needs different values for both, and on LabDA the credentials are in
secrets/envs/openbao-labda.enc.yaml -- a file whose name the derived
vault-infra-<lab> pattern cannot produce, and which carries no vaultCaBundle
for the cert-issuer template to render.

Both inputs default to exactly what was hardcoded, so every existing caller
keeps its behaviour without naming either one.

The fallback shape is load-bearing rather than cosmetic: workflow_dispatch
does not define these inputs, so a dispatched run reads them as empty. Without
the `!= '' && x || default` on BOTH, a dispatched run would render with no
template file at all -- the first version of this change had that bug.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K2rfvVDXWjWZAKMcpwvgLG
@patrick-hermann-sva
patrick-hermann-sva merged commit bf6608f into main Sep 9, 2026
1 check passed
@patrick-hermann-sva
patrick-hermann-sva deleted the feat/terraform-vault-parameterize branch September 9, 2026 12:24
patrick-hermann-sva added a commit that referenced this pull request Sep 9, 2026
…rived

cluster-name has been doing two jobs: naming the cluster to terraform, and
locating its kubeconfig via

  KUBE_CONFIG_ENC: secrets/kubeconfigs/${{ inputs.cluster-name }}.yaml

Those disagree in practice, because kubeconfigs are named inconsistently --
philly.yaml and cicd-crossplane.yaml carry no lab, labda-cicd-machinery-test5
and labda-sthings-infra do. A caller whose file is prefixed had to pass the
prefixed name, and then got that prefix into every Vault object the terraform
config names.

Concretely: cicd-machinery-test5 already has an ESO mount
`cicd-machinery-test5` and a k8s-auth mount `cicd-machinery-test5-eso`, but its
kubeconfig is labda-cicd-machinery-test5.yaml. No value of cluster-name
produced both.

kubeconfig-file defaults to empty and derives the old path, so nothing existing
changes. Same guard shape as #175 and for the same reason: workflow_dispatch
does not define the input, so a dispatched run reads it as empty and must fall
back.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K2rfvVDXWjWZAKMcpwvgLG
patrick-hermann-sva added a commit that referenced this pull request Sep 9, 2026
…rived (#177)

cluster-name has been doing two jobs: naming the cluster to terraform, and
locating its kubeconfig via

  KUBE_CONFIG_ENC: secrets/kubeconfigs/${{ inputs.cluster-name }}.yaml

Those disagree in practice, because kubeconfigs are named inconsistently --
philly.yaml and cicd-crossplane.yaml carry no lab, labda-cicd-machinery-test5
and labda-sthings-infra do. A caller whose file is prefixed had to pass the
prefixed name, and then got that prefix into every Vault object the terraform
config names.

Concretely: cicd-machinery-test5 already has an ESO mount
`cicd-machinery-test5` and a k8s-auth mount `cicd-machinery-test5-eso`, but its
kubeconfig is labda-cicd-machinery-test5.yaml. No value of cluster-name
produced both.

kubeconfig-file defaults to empty and derives the old path, so nothing existing
changes. Same guard shape as #175 and for the same reason: workflow_dispatch
does not define the input, so a dispatched run reads it as empty and must fall
back.


Claude-Session: https://claude.ai/code/session_01K2rfvVDXWjWZAKMcpwvgLG

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
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.

1 participant