Post

Locking Tunnel Bootstrap Secrets to Write-Only Transfer Parameters

Locking Tunnel Bootstrap Secrets to Write-Only Transfer Parameters

The tunnel bootstrap credentials used to be entangled with the Octelium stack, which meant the transfer stack could not render independently of it. This push adds a test that pins the fix in place: the stack’s rendered parameters must declare the tunnel credential inputs as write-only and seed them with a placeholder rather than a real value. The commit message frames it as decoupling, and the test is what stops that decoupling from quietly regressing.

Asserting write-only tunnel parameters in terragrunt-ststack-test.py

The new case copies the stack’s terragrunt.hcl into a temporary directory, renders it with terragrunt render in JSON mode and with writes suppressed, and then inspects the resulting parameter map. For each tunnel credential suffix it asserts two things about the destination under the public tunnel stack: the parameter is declared write-only at version 1, and its initial value is a placeholder sentinel rather than anything resembling a secret. It then confirms the corresponding Octelium-side parameter exists in the same render. Together those checks encode the intent of the change — the public tunnel stack can produce its own bootstrap inputs, and the Octelium stack still gets what it needs — without either side reading a real credential out of configuration.

What a render-time assertion does and does not prove

This is a static test. It proves the stack renders to the expected parameter shape with the credential inputs marked write-only and unpopulated. It does not prove that an apply against the live cluster accepts those parameters, that the secret lands in the right store, or that the tunnel comes up. Write-only arguments are precisely the case where a render can look correct while the eventual apply path behaves differently, so I am treating the merged assertion as evidence about the configuration contract, not about runtime behaviour. The change summary also shows four files withheld from the excerpts I could read, so I am deliberately limiting my claims to what the test itself states. The next check is a plan or apply of the affected stack to confirm the write-only inputs are accepted and populated through the intended secret path.

Why write-only parameters are the right boundary for bootstrap credentials

The reason this pattern transfers is that bootstrap credentials are exactly the kind of input that should never be readable back out of state or configuration. Declaring them write-only moves the value out of the visible parameter surface while keeping it available to whatever consumes it, and seeding a placeholder keeps the stack renderable by anyone without holding the secret. The second half of the technique is the structural assertion: instead of testing that a value equals something, test that the declaration exists and the initial value is inert. A platform team facing the same problem — a shared credential that two stacks both need during provisioning — can use this shape to break the dependency without widening access to the secret, and can use the render assertion to keep the two sides from drifting apart again.

This post is licensed under CC BY 4.0 by the author.