Skip to content

Parameters & Outputs

Use CoreParameter from the core package to define ARM template parameters. These become parameters in the output JSON.

import { CoreParameter } from "@intentius/chant";
export const environment = new CoreParameter({
name: "environment",
type: "string",
default: "dev",
allowedValues: ["dev", "staging", "production"],
});
export const location = new CoreParameter({
name: "location",
type: "string",
default: "[resourceGroup().location]",
});
export const nodeCount = new CoreParameter({
name: "nodeCount",
type: "int",
default: 3,
});
{
"parameters": {
"environment": {
"type": "string",
"defaultValue": "dev",
"allowedValues": ["dev", "staging", "production"]
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]"
},
"nodeCount": {
"type": "int",
"defaultValue": 3
}
}
}

Parameters are referenced via ARM bracket expressions:

export const storage = new StorageAccount({
name: "[parameters('storageName')]",
location: "[parameters('location')]",
});

Use StackOutput from the core package to define ARM template outputs.

import { StackOutput } from "@intentius/chant";
import { Reference } from "@intentius/chant-lexicon-azure";
export const storageEndpoint = new StackOutput({
name: "storageEndpoint",
value: Reference("myStorage").primaryEndpoints.blob,
});
export const storageId = new StackOutput({
name: "storageAccountId",
value: "[resourceId('Microsoft.Storage/storageAccounts', 'myStorage')]",
});
{
"outputs": {
"storageEndpoint": {
"type": "string",
"value": "[reference('myStorage').primaryEndpoints.blob]"
},
"storageAccountId": {
"type": "string",
"value": "[resourceId('Microsoft.Storage/storageAccounts', 'myStorage')]"
}
}
}

ARM supports these parameter types, mapped from CoreParameter:

CoreParameter typeARM typeNotes
"string"stringMost common
"int"intInteger values
"bool"boolBoolean values
"array"arrayJSON arrays
"object"objectJSON objects
"secureString"secureStringPasswords, keys (not logged)
"secureObject"secureObjectSensitive objects