Skip to content

ResourceGroup Template

A Resource Group Template (.dunergt.yaml) defines a reusable group of infrastructure resources. It is referenced by one or more Deployment Templates and receives parameter values from them.

Resource Group Templates are designed to be reusable — a genericsql RGT can be used by any Deployment Template that needs a SQL Server.

Structure

---
schemaVersion: 1
name: genericsql                     # kebab-case identifier
displayName: Generic SQL Server      # human-readable name
version: 1.0.0                       # semantic version
description: SQL Server on Windows   # template description
parameters:                          # optional — values received from the DPT
  - name: cpu
    type: number
    default: 4
  - name: memory
    type: number
    default: 32
variables:                           # optional — key/value pairs
  MY_VAR: some-value
tags:                                # optional — metadata tags
  tier: database
resources:                           # required — at least one resource
  - type: computeNode
    computeType: virtualMachine
    name: vmdb
    image: win2022
    cpu: "{{parameters.cpu}}"
    memory: "{{parameters.memory}}"
    domain: yourdomain.local
postConfig:                          # optional — runs after all resources deploy
  - name: invoke-psscript
    limit: "{{computenode.vmdb.fqdn}}"
    variables:
      script: |
        Write-Host "RG post-config complete"

Parameters

Parameters defined in an RGT receive their values from the parent Deployment Template's templateParameters. They follow the same syntax as deployment parameters — see Parameters.

# In the RGT:
parameters:
  - name: cpu
    type: number
    default: 4

# In the DPT that references this RGT:
resourceGroups:
  - name: db
    template: genericsql
    templateVersion: 1.0.0
    templateParameters:
      cpu: "{{parameters.dbCpu}}"    # passed from DPT parameter

If an RGT parameter has a default value and the DPT doesn't pass a value for it via templateParameters, the default is used.

Resources

The resources array defines the infrastructure that Dune provisions. Five resource types are supported:

Type Description Reference
computeNode Virtual machines (Windows/Linux) ComputeNode
serviceAccount Active Directory service accounts ServiceAccount
rbacResourceGroup Active Directory DomainLocal security groups RbacResourceGroup
cluster Windows Server Failover Clusters (WSFC) Cluster
azureResource Generic Azure resources (Key Vault, etc.) AzureResource

Deployment Order

  • Resources are deployed in parallel by default
  • Resources that reference other resources via expressions (e.g., {{computenode.vmdb.fqdn}}) or have a dependsOn property will wait for the referenced resources to be fully deployed first
  • After all resources are deployed, postConfig tasks execute

PostConfig

The postConfig block defines tasks that run after all resources in this resource group have been deployed. Use the limit key to target a specific compute node:

postConfig:
  - name: invoke-psscript
    limit: "{{computenode.vmdb.fqdn}}"
    variables:
      script: |
        Write-Host "Configuration after resource staging"

See Config Tasks for all available tasks.

Expressions

A Resource Group Template runs in resourcegroup scope, where resources of the current RG are accessed flat (without any resourcegroup.<rg>. prefix). The expressions below are the RGT-scope-specific ones — see Expressions for the full reference (including tenant, collection, deployment, and resource provider expressions, which are available in all scopes).

Resource Group properties

Expression Description
{{resourcegroup.name}} Resource group identifier
{{resourcegroup.displayname}} Resource group display name
{{resourcegroup.shortid}} Short unique ID of the resource group
{{resourcegroup.environment}} Resource group environment

RGT parameters

Expression Description
{{parameters.<name>}} Value of an RGT parameter (received via templateParameters)
{{deployment.parameters.<name>}} Value of a deployment-level parameter

Resources within the current RG

Expression Description
{{computenode.<vm>}} Compute node hostname (shorthand for .hostname)
{{computenode.<vm>.<property>}} Any compute node property (fqdn, displayname, alias[0], etc.)
{{serviceaccount.<svc>.svcname}} Service account name
{{serviceaccount.<svc>.svcpassword}} Service account password (secure)
{{rbacresourcegroup.<rbac>.groupname}} Rbac group name
{{cluster.<name>.listeners.<listener>.hostname}} Cluster listener hostname

Resources in other resource groups are not accessible from RGT scope.

Variables and Tags

Variables and tags work the same as in Deployment Templates. Variables defined here apply only within this resource group's scope.


Next: ComputeNode