<TemplateInline>
The <TemplateInline> block renders Boilerplate templates directly in your runbook, displaying the rendered output inline. Unlike <Template>, which loads templates from a directory, <TemplateInline> lets you write template content directly in your runbook file.
Basic Usage
Section titled “Basic Usage”<Inputs id="greeting">```yamlvariables: - name: Name type: string default: World```</Inputs>
<TemplateInline inputsId="greeting" outputPath="hello.txt">```txtHello, {{ .Name }}!```</TemplateInline>vs. Template
Section titled “vs. Template”TemplateInline and Template both render Boilerplate templates, but they serve different purposes:
| Feature | <TemplateInline> | <Template> |
|---|---|---|
| Template source | Inline in runbook | Directory with boilerplate.yml |
| Form rendered | No (uses Inputs) | Yes, from boilerplate.yml |
| File generation | Optional (generateFile={true}) | Always saves to workspace |
| Use case | Show preview of single files inline | Generate files from template directories |
Use <TemplateInline> when you want to show users what generated content looks like inline, or for quick single-file templates. Use <Template> when you have a full Boilerplate template directory with multiple files and a boilerplate.yml configuration.
Required Props
Section titled “Required Props”- [Inline template content] - The template content to render, written as a fenced code block inside the
<TemplateInline>tags. The code block should include a language hint (e.g.,hcl,yaml,dockerfile) for syntax highlighting.
Optional Props
Section titled “Optional Props”inputsId(string | string[]) - ID of the Inputs block(s) to get variable values from. When multiple IDs are provided as an array, variables are merged in order (later IDs override earlier ones). If not provided, the template renders without variable substitution.outputPath(string) - File path to display for the rendered output (e.g.,config.yaml). This appears as the filename in the code block header.generateFile(boolean) - Whether to add the rendered file to the file tree. Whenfalse(the default), the template is preview-only and displays inline. Set totrueto also save the rendered file to the workspace.
With Variables
Section titled “With Variables”There are several ways to provide variables to a TemplateInline.
Using inputsId
Section titled “Using inputsId”Reference a separate Inputs block to get variable values:
<Inputs id="docker-config">```yamlvariables: - name: AppName type: string - name: NodeVersion type: string default: "18"```</Inputs>
<TemplateInline inputsId="docker-config" outputPath="Dockerfile">```dockerfileFROM node:{{ .NodeVersion }}-alpine
WORKDIR /appCOPY package*.json ./RUN npm installCOPY . .
EXPOSE 3000CMD ["node", "server.js"]```</TemplateInline>Using Multiple inputsIds
Section titled “Using Multiple inputsIds”You can reference multiple Inputs blocks by passing an array of IDs. Variables are merged in order, with later IDs overriding earlier ones:
<Inputs id="global-config">```yamlvariables: - name: Environment type: enum options: [dev, staging, prod] default: dev```</Inputs>
<Inputs id="service-config">```yamlvariables: - name: ServiceName type: string - name: Port type: int default: 8080```</Inputs>
<TemplateInline inputsId={["global-config", "service-config"]} outputPath="deploy.tf">```hclresource "aws_ecs_service" "main" { name = "{{ .ServiceName }}-{{ .Environment }}"
load_balancer { container_port = {{ .Port }} }}```</TemplateInline>In this example, the template has access to variables from both Inputs blocks.
Multiple Files
Section titled “Multiple Files”You can have multiple <TemplateInline> blocks referencing the same <Inputs>:
<Inputs id="app-config">```yamlvariables: - name: AppName type: string - name: Environment type: enum options: [dev, prod]```</Inputs>
<TemplateInline inputsId="app-config" outputPath="config.yaml">```yamlapp: name: {{ .AppName }} environment: {{ .Environment }}```</TemplateInline>
<TemplateInline inputsId="app-config" outputPath=".env">```bashAPP_NAME={{ .AppName }}ENVIRONMENT={{ .Environment }}```</TemplateInline>With Boilerplate Logic
Section titled “With Boilerplate Logic”You can use full Boilerplate template syntax including conditionals and loops:
<Inputs id="terraform-config">```yamlvariables: - name: Environment type: enum options: [dev, prod] - name: EnableMonitoring type: bool default: false```</Inputs>
<TemplateInline inputsId="terraform-config" outputPath="main.tf">```hclresource "aws_instance" "app" { ami = "ami-12345678" instance_type = "{{ if eq .Environment "prod" }}t3.large{{ else }}t3.micro{{ end }}"
{{- if .EnableMonitoring }} monitoring = true {{- end }}}```</TemplateInline>For full details on template syntax, see Boilerplate Template Syntax.
Generating Files
Section titled “Generating Files”By default, <TemplateInline> is preview-only—it shows the rendered output but doesn’t save files. To also save the rendered content to the generated files workspace, set generateFile={true}:
<Inputs id="config">```yamlvariables: - name: ProjectName type: string```</Inputs>
<TemplateInline inputsId="config" outputPath="README.md" generateFile={true}>```markdown# {{ .ProjectName }}
Welcome to {{ .ProjectName }}!```</TemplateInline>Complete Example
Section titled “Complete Example”Here’s a complete example showing <Inputs> with multiple <TemplateInline> blocks:
# Configure Your Docker Service
Enter your service configuration:
<Inputs id="service-config">```yamlvariables: - name: ServiceName type: string description: Name of your service validations: "required" - name: Port type: int description: Port to expose default: 8080 - name: Environment type: enum description: Deployment environment options: [dev, staging, prod] default: dev```</Inputs>
Here's what your Docker Compose file will look like:
<TemplateInline inputsId="service-config" outputPath="docker-compose.yaml" generateFile={true}>```yamlversion: "3.8"services: {{ .ServiceName }}: build: . ports: - "{{ .Port }}:{{ .Port }}" environment: - NODE_ENV={{ .Environment }}```</TemplateInline>
And your environment file:
<TemplateInline inputsId="service-config" outputPath=".env" generateFile={true}>```bashSERVICE_NAME={{ .ServiceName }}PORT={{ .Port }}ENVIRONMENT={{ .Environment }}```</TemplateInline>