Skip to content

@adrianhall/cloudflare-toolkit


@adrianhall/cloudflare-toolkit / lib/vite / requireTerraformOutputs

Function: requireTerraformOutputs() ​

requireTerraformOutputs<T>(options): T

Defined in: src/lib/vite/terraform-outputs.ts:125

Like readTerraformOutputs, but throws an actionable Error — naming the outputs path and the caller-supplied hint command — instead of returning undefined. Intended for a cloudflare.config.ts defineWorker callback's production branch, where missing/incomplete Terraform outputs mean the deploy cannot proceed and should fail loudly rather than silently falling back to placeholder values.

Type Parameters ​

T ​

T extends Record<string, string>

Parameters ​

options ​

RequireTerraformOutputsOptions<T>

Same as readTerraformOutputs, plus a required hint (a command the operator should run to produce/refresh the outputs file, e.g. "npm run deploy:infra").

Returns ​

T

The projected outputs.

Throws ​

If the outputs could not be read (see readTerraformOutputs).