|
| 1 | +--- |
| 2 | +sidebar_position: 5 |
| 3 | +title: Blueprint Templates |
| 4 | +--- |
| 5 | + |
| 6 | +A **blueprint template** is a reusable blueprint foundation you can standardize and reuse across teams. It lets you publish a blueprint skeleton with shared metadata, inputs, outputs, and grains, then adapt it for specific use cases. |
| 7 | + |
| 8 | +:::warning Beta Feature |
| 9 | +Blueprint Templates is currently in beta. |
| 10 | +Behavior and schema details may change as the feature evolves. |
| 11 | +::: |
| 12 | + |
| 13 | +To mark a blueprint as a template, add a `template` section with `placeholders`: |
| 14 | + |
| 15 | +```yaml |
| 16 | +template: |
| 17 | + placeholders: [] |
| 18 | +``` |
| 19 | +
|
| 20 | +## When to use templates |
| 21 | +
|
| 22 | +Templates are useful when you want consistency and speed while still allowing teams to customize implementation details. |
| 23 | +
|
| 24 | +Common examples: |
| 25 | +
|
| 26 | +- **Standardized infrastructure starters** - provide a base VM, Kubernetes, or application deployment pattern that teams can reuse |
| 27 | +- **Organization guardrails** - enforce shared conventions (metadata labels, required inputs, common setup grains) in a single reusable blueprint definition |
| 28 | +
|
| 29 | +## How templates work |
| 30 | +
|
| 31 | +A template is a valid blueprint YAML file. It is authored and stored like any other blueprint, and includes the same blueprint sections (`spec_version`, `metadata`, `inputs`, `outputs`, `grains`, and so on). |
| 32 | + |
| 33 | +The difference is the `template` block: |
| 34 | + |
| 35 | +- `template.placeholders` indicates this blueprint is intended to be used as a template |
| 36 | +- placeholders can be used to keep explicit extension points in the blueprint structure |
| 37 | + |
| 38 | +This allows platform teams to maintain one reusable baseline while keeping room for per-template adaptations. |
| 39 | + |
| 40 | +## Template YAML structure |
| 41 | + |
| 42 | +```yaml |
| 43 | +spec_version: 2 |
| 44 | +
|
| 45 | +description: Reusable blueprint template |
| 46 | +
|
| 47 | +template: |
| 48 | + placeholders: [] |
| 49 | +
|
| 50 | +metadata: |
| 51 | + display-name: Template VM Deployment |
| 52 | + blueprint-labels: |
| 53 | + - key: Category |
| 54 | + value: VMaaS |
| 55 | +
|
| 56 | +inputs: |
| 57 | + agent: |
| 58 | + type: agent |
| 59 | +
|
| 60 | +outputs: |
| 61 | + status: |
| 62 | + value: '{{ .grains.health-check.outputs.status }}' |
| 63 | +
|
| 64 | +grains: |
| 65 | + initial-setup: |
| 66 | + kind: shell |
| 67 | + spec: ... |
| 68 | +
|
| 69 | + vm-deployment: |
| 70 | + kind: terraform |
| 71 | + spec: ... |
| 72 | +
|
| 73 | + health-check: |
| 74 | + kind: shell |
| 75 | + depends-on: vm-deployment |
| 76 | + spec: ... |
| 77 | +``` |
| 78 | + |
| 79 | +### Key sections |
| 80 | + |
| 81 | +| Section | Description | |
| 82 | +|---|---| |
| 83 | +| `template.placeholders` | Marks the blueprint as a template and defines placeholder slots. | |
| 84 | +| `metadata` | Standard catalog metadata such as display name, labels, and icon. | |
| 85 | +| `inputs` | Parameters exposed to the end user (for example `agent`). | |
| 86 | +| `outputs` | Values exposed from deployed grains (for example health or endpoint status). | |
| 87 | +| `grains` | The reusable deployment flow that template consumers can adapt. | |
| 88 | + |
| 89 | +## Example: template VM deployment blueprint |
| 90 | + |
| 91 | +The following example shows a VM deployment blueprint marked as a template: |
| 92 | + |
| 93 | +```yaml |
| 94 | +spec_version: 2 |
| 95 | +description: An Ubuntu Template VM Deployment Blueprint is a standardized framework that automates the provisioning and configuration of virtual machines (VMs) across various cloud platforms and on-premises environments. It provides a reusable template for deploying VMs with predefined settings, such as operating system, resource allocation, and network configurations. This blueprint streamlines the deployment process, ensures consistency across environments, and accelerates time-to-deployment for applications and services that require VM infrastructure. |
| 96 | +
|
| 97 | +template: |
| 98 | + placeholders: [] |
| 99 | + |
| 100 | +metadata: |
| 101 | + blueprint-labels: |
| 102 | + - key: Category |
| 103 | + value: VMaaS |
| 104 | + display-name: Template VM Deployment |
| 105 | + icon: |
| 106 | + path: graphics/Ubuntu.svg |
| 107 | +
|
| 108 | +inputs: |
| 109 | + agent: |
| 110 | + type: agent |
| 111 | +
|
| 112 | +outputs: |
| 113 | + status: |
| 114 | + # placeholder. should be adapted if changed in the health-check |
| 115 | + value: '{{.grains.health-check.outputs.status}}' |
| 116 | +
|
| 117 | +grains: |
| 118 | + initial-setup: |
| 119 | + kind: shell |
| 120 | + spec: |
| 121 | + agent: |
| 122 | + name: '{{.inputs.agent}}' |
| 123 | + ... |
| 124 | +
|
| 125 | + vm-deployment: |
| 126 | + kind: terraform |
| 127 | + spec: |
| 128 | + agent: |
| 129 | + name: '{{.inputs.agent}}' |
| 130 | + ... |
| 131 | +
|
| 132 | + # placeholder for grain |
| 133 | + health-check: |
| 134 | + kind: shell |
| 135 | + depends-on: vm-deployment |
| 136 | + spec: |
| 137 | + agent: |
| 138 | + name: '{{.inputs.agent}}' |
| 139 | + ... |
| 140 | +``` |
| 141 | + |
| 142 | +## Related topics |
| 143 | + |
| 144 | +- [Blueprint YAML Structure](/blueprint-designer-guide/blueprints/blueprints-yaml-structure) |
| 145 | +- [Blueprint Families](/blueprint-designer-guide/blueprint-families) |
| 146 | +- [Blueprint Publishing](/blueprint-designer-guide/blueprint-publishing) |
0 commit comments