-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Linked template templateLink object does not create a new scope (#801)
* Regression from 0.10.0: top-level parameters not recognized in nested template properties * PR fix
- Loading branch information
1 parent
c9895e4
commit aebabc0
Showing
5 changed files
with
198 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// ---------------------------------------------------------------------------- | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// ---------------------------------------------------------------------------- | ||
|
||
// tslint:disable:no-unused-expression max-func-body-length promise-function-async max-line-length no-unnecessary-class | ||
// tslint:disable:no-non-null-assertion object-literal-key-quotes variable-name no-constant-condition | ||
|
||
import { testDiagnosticsFromFile } from "./support/diagnostics"; | ||
|
||
suite("Linked templates", () => { | ||
suite("variables and parameters inside templateLink object refer to the parent's scope", () => { | ||
test('Regress #792: Regression from 0.10.0: top-level parameters not recognized in nested template properties', async () => { | ||
await testDiagnosticsFromFile( | ||
'templates/linked-templates-scope.json', | ||
{}, | ||
[ | ||
// Should be no errors | ||
] | ||
); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{ | ||
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", | ||
"contentVersion": "1.0.0.0", | ||
"parameters": { | ||
"linkedTemplatesLocation": { | ||
"type": "string", | ||
"defaultValue": "https://raw.githubusercontent.com/StephenWeatherford/template-examples/master/linkedTemplates/twoLinked/templates/library" | ||
}, | ||
"intvalue": { | ||
"type": "int", | ||
"defaultValue": 123 | ||
} | ||
}, | ||
"variables": { | ||
"firstTemplate": "../linkedTemplate1.json", | ||
"secondTemplate": "linkedTemplate2.json", | ||
"stringValue": "abc", | ||
"nestedDeployment2Name": "nestedDeployment2", | ||
"mode": "Incremental", | ||
"contentVersion": "1.2.3.4" | ||
}, | ||
"resources": [ | ||
{ | ||
"name": "[variables('nestedDeployment2Name')]", | ||
"type": "Microsoft.Resources/deployments", | ||
"apiVersion": "2017-05-10", | ||
"properties": { | ||
"mode": "[variables('mode')]", | ||
"templateLink": { | ||
// THESE REFER TO THE TOP-LEVEL PARAMS/VARS | ||
"uri": "[concat(parameters('linkedTemplatesLocation'), '/', variables('secondTemplate'))]", | ||
"contentVersion": "[variables('contentVersion')]" | ||
}, | ||
"parameters": { | ||
"linked2param1": { | ||
"value": "[variables('stringValue')]" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "nestedDeployment1", | ||
"type": "Microsoft.Resources/deployments", | ||
"apiVersion": "2017-05-10", | ||
"properties": { | ||
"mode": "[variables('mode')]", | ||
"templateLink": { | ||
// THESE REFER TO THE TOP-LEVEL PARAMS/VARS | ||
"uri": "[concat(parameters('linkedTemplatesLocation'), '/', variables('firstTemplate'))]" | ||
}, | ||
"parameters": { | ||
"linked1param1": { | ||
"value": "[parameters('intvalue')]" | ||
} | ||
}, | ||
"debugSetting": { | ||
"detailLevel": "requestContent,responseContent" | ||
} | ||
} | ||
} | ||
], | ||
"outputs": {}, | ||
"functions": [] | ||
} |