Parameters¶
Parameters are template inputs that users provide when creating a deployment. They allow templates to be flexible and reusable — the same template can deploy different configurations depending on the parameter values.
Definition¶
Parameters are defined in the parameters array of a Deployment Template or Resource Group Template:
parameters:
- name: cpu
type: number
description: Number of vCPUs
default: 4
- name: adminPassword
type: secureString
description: Administrator password
- name: features
type: string
description: "SQL features to install"
default: "SQLENGINE,FULLTEXT,IS"
optional: true
- name: serverName
type: string
description: "Server name (lowercase only)"
validation: "^[a-z0-9-]+$"
Properties¶
| Property | Required | Type | Description |
|---|---|---|---|
name |
Yes | string | Parameter identifier (used in expressions as {{parameters.<name>}}) |
type |
Yes | string | Data type — see Types below |
description |
No | string | Explains the parameter to the user in the deployment wizard |
default |
No | varies | Default value (prefilled in the UI, must match the declared type) |
optional |
No | bool | Whether the parameter can be left empty (default: false) |
validation |
No | string | Regex pattern the value must match |
Note
optional and default are independent — you can use both, either, or neither:
- Neither: parameter is required, no prefilled value
defaultonly: parameter is required but prefilled with the defaultoptionalonly: parameter can be left empty, no prefilled value- Both: parameter can be left empty, prefilled with the default if provided
Types¶
| Type | Description | Example values |
|---|---|---|
string |
Text value | "hello", "SQLENGINE,FULLTEXT" |
number |
Numeric value (int, float, decimal) | 4, 32.5 |
bool / boolean |
True or false | true, false |
secureString |
Sensitive text — masked in the portal UI and logs | passwords, API keys |
Validation¶
Use the validation property to enforce a regex pattern on the parameter value:
Validation is checked at runtime. If the value doesn't match, the deployment fails with a validation error.
Parameter Flow¶
Parameters flow through the template hierarchy:
User fills parameters in Dune Portal
|
v
Deployment Template (parameters defined here)
|
v templateParameters: cpu: "{{parameters.dbCpu}}"
|
Resource Group Template (parameters received here)
|
v cpu: "{{parameters.cpu}}"
|
Used in any value within the template — resource fields, postConfig variables, tags, etc.
1. Define in the Deployment Template¶
# singlevm.dunedpt.yaml
parameters:
- name: cpu
type: number
description: Number of vCPUs
default: 4
resourceGroups:
- name: vm
template: singlevm
templateVersion: 1.0.0
templateParameters:
cpu: "{{parameters.cpu}}"
2. Receive in the Resource Group Template¶
# singlevm.dunergt.yaml
parameters:
- name: cpu
type: number
default: 4
resources:
- type: computeNode
computeType: virtualMachine
name: vmsingle
cpu: "{{parameters.cpu}}"
...
3. Or pass static values directly¶
You can also hardcode values in templateParameters without exposing them as deployment parameters:
resourceGroups:
- name: vm
template: singlevm
templateVersion: 1.0.0
templateParameters:
cpu: 4 # static — user never sees this
Accessing Parameters in Expressions¶
Use {{parameters.<name>}} to reference a parameter value in the template where it's defined:
svcName: "app-{{parameters.serviceName}}"
memory: "{{parameters.memory}}"
size: "{{parameters.userDbDiskSize}}"
{{parameters.<name>}} always resolves against the parameters of the current template's scope:
- In a Deployment Template — the deployment parameters
- In a Resource Group Template — the RGT parameters (received via
templateParameters)
Reaching deployment parameters from RG scope¶
When a deployment template extends an RGT with inline resources or postConfig (see Deployment Template — Extending with Additional Resources), those entries run in resource group scope. There, {{parameters.<name>}} refers to the RGT's parameters, not the deployment's. Use {{deployment.parameters.<name>}} to reach deployment-level parameters from that scope:
# In a Deployment Template
parameters:
- name: appName
type: string
resourceGroups:
- name: db
template: mssqlvm
templateVersion: 1.0.0
templateParameters:
sqlVersion: sql22dev
resources: # inline resources — run in RG scope
- type: serviceAccount
name: svcapp
svcName: "{{deployment.parameters.appName}}-svc" # reach the deployment param
See Expressions for the full expression reference.
Next: Best Practices