Skip to content

fix(terraform-vault): pass vault_ca_bundle only when there is one - #178

Merged
patrick-hermann-sva merged 1 commit into
mainfrom
fix/terraform-vault-optional-ca-var
Sep 9, 2026
Merged

fix(terraform-vault): pass vault_ca_bundle only when there is one#178
patrick-hermann-sva merged 1 commit into
mainfrom
fix/terraform-vault-optional-ca-var

Conversation

@patrick-hermann-sva

Copy link
Copy Markdown
Contributor

The cli path sent -var="vault_ca_bundle=..." unconditionally. Terraform errors on a -var the root module does not declare, so that restricted this workflow to configs taking a CA bundle — the cert issuer — and any other Vault config failed before it started:

Error: Value for undeclared variable

A variable named "vault_ca_bundle" was assigned on the command line, but
the root module does not declare a variable of that name.

Hit by terraform/vault/eso-secrets, which creates a per-cluster KV mount and read policy and has no use for a PKI bundle. The credentials it runs with (openbao-labda.enc.yaml) carry no vaultCaBundle either, so the value would have been empty even where it was accepted.

The two executors disagreed

The dagger path already passes only cluster_name and kubeconfig_path, so it never had this limit — an apply would have worked while a plan could not. This brings the cli path in line rather than adding a new behaviour.

Third in the same family as #175 and #177: the workflow was shaped around one terraform config, and each assumption only surfaces when a second config tries to use it.

🤖 Generated with Claude Code

https://claude.ai/code/session_01K2rfvVDXWjWZAKMcpwvgLG

The cli path sent -var="vault_ca_bundle=..." unconditionally. Terraform ERRORS
on a -var the root module does not declare, so that restricted this workflow to
configs taking a CA bundle -- the cert issuer -- and any other Vault config
failed before it started:

  Error: Value for undeclared variable
  A variable named "vault_ca_bundle" was assigned on the command line, but
  the root module does not declare a variable of that name.

Hit by terraform/vault/eso-secrets, which creates a per-cluster KV mount and
read policy and has no use for a PKI bundle. The credentials it runs with
(openbao-labda.enc.yaml) carry no vaultCaBundle either, so the value would have
been empty even where it was accepted.

The dagger path already passes only cluster_name and kubeconfig_path, so it
never had this limit -- an apply would have worked while a plan could not.
This brings the cli path in line rather than adding a new behaviour.

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 84e5acf into main Sep 9, 2026
2 checks passed
@patrick-hermann-sva
patrick-hermann-sva deleted the fix/terraform-vault-optional-ca-var branch September 9, 2026 12:53
patrick-hermann-sva added a commit that referenced this pull request Sep 9, 2026
…ull" (#180)

#178 made vault_ca_bundle conditional on the file being non-empty. It still
went out, because the file is never empty: on a MISSING key `jq -r` prints the
four-character string "null", not nothing.

So /tmp/vault_ca_bundle contained "null", the -s test saw a non-empty file, and
"null" was passed to terraform as the CA bundle -- reproducing the exact error
#178 set out to fix.

`// empty` makes a missing key yield nothing, which is what every caller here
already assumed it did.

Also guards the mask: ::add-mask:: on an empty value is a no-op warning, and on
the old path it registered the word "null" as a secret to redact from every log
line.


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