Outputs expose values from a Terraform module so other modules and operators can read them after an apply. The Terraform Output Generator builds one valid output block from a short form and lets you choose how the value is written. You can emit a raw reference such as aws_instance.web.id exactly as typed, or pick a typed literal mode where a string, number, or boolean is emitted as a properly quoted HCL value. An optional description documents the output for consumers, the sensitive checkbox redacts the value in the CLI and state, and a comma separated depends_on list adds resource dependencies that are not otherwise referenced. The generator validates the output name as a Terraform identifier, serialises the block with the shared engine, and shows it in a preview you can copy, download as outputs.tf, or print. Everything runs locally in the browser; nothing is uploaded and no cloud or registry call is made. It is a quick, reliable way to produce correct output blocks while authoring or tidying a module. Choosing the right mode matters: a raw reference keeps the output live so it always reflects the referenced resource, while a typed literal freezes a fixed value that is handy for tags, endpoints, or messages you want to surface. The sensitive flag is especially useful for tokens and connection strings that should never appear in plain text in the CLI, the state file, or a shared plan. By previewing the exact block before you paste it, you avoid a wasted plan and a confusing diff, and you keep your module interfaces consistent for every consumer.
Terraform Output Generator
Build a single Terraform output block (HCL) for outputs.tf.
Runs entirely in your browser - nothing is uploaded and no cloud connection is made.
Your generated output block will appear here.
About Terraform Output Generator
Features
- Value modes - raw reference, or typed string, number, or boolean literals.
- Typed literals - string, number and bool are emitted with correct HCL quoting.
- Description - an optional sentence documents the output.
- Sensitive flag - redact the output in plans, applies, and state.
- depends_on - a comma separated list of resource addresses.
- Identifier check - the name is validated as a legal Terraform identifier.
- Correct HCL - the serializer keeps indentation and quoting correct.
- Instant preview - the block shows in the preview on generate.
- Line stats - a stats row reports the generated block size and flags.
- Markdown export - copy a fenced markdown snippet for your docs.
- Live reference - raw mode keeps the output bound to the real resource attribute.
- Fixed literal - typed mode freezes a constant value for tags or messages.
How to Use
- Name the output with a valid identifier such as bucket_arn or db_endpoint.
- Enter the value and pick its type: raw for a reference, or string, number, bool for a literal.
- Add a description when the output needs context for module consumers.
- Tick sensitive for secrets that must be hidden in CLI and state output.
- Fill depends_on with comma separated addresses when needed.
- Click Generate HCL to build and preview the block.
- Export it with Copy, Copy as Markdown, Download, or Print into your outputs.tf.
- Review the mode before generating; switch between raw and typed if the preview shows the wrong quoting.
- Re-run after changes so the preview and stats reflect your latest inputs.
Examples
Example 1 - raw reference. Value aws_instance.web.id in raw mode emits value = aws_instance.web.id with no quotes.
Example 2 - string literal. Value hello in string mode emits value = "hello" with quotes.
Example 3 - boolean. Value true in bool mode emits value = true, useful for feature flags.
Example 4 - sensitive. A sensitive output adds sensitive = true so Terraform hides the value.
Example 5 - number. Value 443 in number mode emits value = 443, useful for ports or counts.
Example 6 - described only. Adding a description without sensitive still produces a valid, documented output block that is easy to read.
Benefits
- Correct schema - the block always follows output syntax.
- Flexible value - references or typed literals both work.
- Validated name - illegal identifiers are caught early.
- Private - runs in the browser with no upload.
- Fast scaffolding - generate in one click while editing.
- Portable - copy, markdown, download, or print.
- Mode aware - pick a live reference or a fixed literal as the situation needs.
- Safer secrets - sensitive outputs keep credentials out of logs and state.
- Clean diffs - previewing avoids surprise changes in plans.
- Reusable - the block pastes into any module unchanged.
Frequently Asked Questions
What does this tool generate?
It writes one output block with a name, value expression, optional description, sensitive flag and depends_on list.
How is the value written?
Pick raw for a reference such as aws_instance.web.id, or string/number/bool to emit a quoted literal.
What is depends_on?
A comma separated list of resource addresses that this output depends on; they are emitted unquoted inside a list.
Does this connect to a cloud?
No. Everything is assembled in your browser and nothing is uploaded.
Can I download it?
Yes. Copy the HCL, download outputs.tf, or print it.