ARM template outputs in Azure - Time & Space Complexity
When deploying resources with ARM templates, outputs help us get information after deployment.
We want to know how the time to get outputs changes as we add more outputs.
Analyze the time complexity of retrieving outputs from an ARM template deployment.
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"outputs": {
"output1": { "type": "string", "value": "value1" },
"output2": { "type": "int", "value": 123 },
"outputN": { "type": "string", "value": "valueN" }
}
}
This template defines multiple outputs that return values after deployment.
Look at what happens when outputs are processed:
- Primary operation: Reading each output value from the deployment result.
- How many times: Once per output defined in the template.
Each output adds one more value to retrieve after deployment.
| Input Size (n) | Approx. API Calls/Operations |
|---|---|
| 10 | 10 output retrieval operations |
| 100 | 100 output retrieval operations |
| 1000 | 1000 output retrieval operations |
Pattern observation: The number of retrievals grows directly with the number of outputs.
Time Complexity: O(n)
This means the time to get outputs grows linearly as you add more outputs.
[X] Wrong: "Getting outputs happens instantly no matter how many there are."
[OK] Correct: Each output requires a separate retrieval step, so more outputs take more time.
Understanding how output retrieval scales helps you design templates that stay efficient as they grow.
"What if outputs included nested objects instead of simple values? How would the time complexity change?"