Documentation menu

resources

Defining resources

Resources

Azure resources are defined inside the resources array (ignore the $schema field, it provides the autocomplete functionalities in your IDE but is ignored at compile time)

{
	"$schema": "https://hulk.cyncly-platform.com/schemas/main.json",
	"team": "your team identifier",
	"project": "Your project name",
	"envs": {
		"name": "NAME OF THE ENVIRONMENT",
		"rg": "NAME OF THE RESOURCE GROUP",
		"subscription": "NAME OF THE AZURE SUBSCRIPTION",
		"abbr": "NAME OF THE ENVIRONMENT ABBREVIATION"
	},
	"resources": ["Here!"]
}

Modules

Modules are used to split your templates in multiple files. To define a module, include the path to the file you want to include inside your project.

Modules can only be defined inside the main.json file. If you try to nest modules the transpiler will exit with an error.

main.json

{
	"$schema": "https://hulk.cyncly-platform.com/schemas/main.json",
	"team": "argvengers",
	"project": "demo",
	"envs": [
		{
			"name": "prod",
			"rg": "argvengerstools-prod-rg",
			"subscription": "2020-prod",
			"abbr": "prod",
		}
	],
	"resources": [
		{
			"storage_account": {
				"name": "safirststorage{env}",
				"kind": "StorageV2",
				"sku": "Standard_LRS"
			}
		}
	],
	"modules": ["./my-file.json"]
}

my-file.json

{
	"$schema": "https://hulk.cyncly-platform.com/schemas/module.json",
	"resources": [
		{
			"storage_account": {
				"name": "sasecondstorage{env}",
				"kind": "StorageV2",
				"sku": "Standard_LRS"
			}
		}
	]
}

At compile time, the main.json file would expand to this:

{
	"$schema": "https://hulk.cyncly-platform.com/schemas/main.json",
	"team": "your team identifier",
	"project": "Your project name",
	"envs": {
		"name": "NAME OF THE ENVIRONMENT",
		"rg": "NAME OF THE RESOURCE GROUP",
		"subscription": "NAME OF THE AZURE SUBSCRIPTION",
		"abbr": "NAME OF THE ENVIRONMENT ABBREVIATION"
	},
	"resources": [
		{
			"storage_account": {
				"name": "safirststorage{env}",
				"kind": "StorageV2",
				"sku": "Standard_LRS",
				"containers": []
			}
		},
		{
			"storage_account": {
				"name": "sasecondstorage{env}",
				"kind": "StorageV2",
				"sku": "Standard_LRS",
				"containers": []
			}
		}
	]
}

Example

File structure

├── main.json
└── modules
    ├── functions.json
    └── storage.json

main.json

{
	"$schema": "https://hulk.cyncly-platform.com/schemas/main.json",
	"team": "argvengers",
	"project": "doc-basics-demo",
	"envs": [
		{
			"name": "prod",
			"rg": "argvengerstools-prod-rg",
			"subscription": "2020-prod",
			"abbr": "prod",
		}
	],
	"resources": [],
	"modules": ["modules/appservice.json", "storage.json"]
}

appservice.json

This file creates a Windows Consumption plan and links a Function App to it. The Function App references a storage account, which Azure Functions requires for host data, trigger synchronization, and logging.

{
	"$schema": "https://hulk.cyncly-platform.com/schemas/module.json",
	"resources": [
		{
			"app_service_plan": {
				"name": "plan-consump-{env}-eus",
				"os": "windows",
				"kind": "Consumption",
				"type": "function_app"
			}
		},
		{
			"function_app": {
				"name": "func-app-{env}-eus",
				"@plan_name": "plan-consump-{env}-eus",
				"@storage_account_name": "ststorage{env}",
				"runtime": "dotnetisolated8",
				"https_only": true
			}
		}
	]
}

storage.json

{
	"$schema": "https://hulk.cyncly-platform.com/schemas/module.json",
	"resources": [
		{
			"storage_account": {
				"name": "ststorage{env}",
				"kind": "StorageV2",
				"sku": "Standard_LRS"
			}
		}
	]
}

Output

To validate the project locally, run check with the path to your main file:

$ hulk check ./main.json --env prod
✨  Checked 3 resources for prod and compiled the generated Bicep

This validates variables, modules, references, and resource definitions without changing .hulk or contacting Azure. Use hulk synth when you also need the authenticated permission check.

To see the generated Bicep, run the transpile command with the same path:

$ hulk transpile ./main.json --env prod

Found 2 module(s) in main.json

Found 2 resource(s) inside module: functions.json
Found 1 resource(s) inside module: storage.json


✨  Transpiled file written to: .hulk/main.bicep