Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameter references should work across the main template and the linked template (and nested templates) #1229

Open
StephenWeatherford opened this issue Mar 2, 2021 · 0 comments
Labels
Milestone

Comments

@StephenWeatherford
Copy link
Contributor

StephenWeatherford commented Mar 2, 2021

1229.json

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "parameter1": { // top-level parameter1 definition in main template
            "type": "string",
            "metadata": {
                "description": "description"
            }
        }
    },
    "resources": [
        {
            "name": "linkedDeployment1",
            "type": "Microsoft.Resources/deployments",
            "apiVersion": "2020-10-01",
            "properties": {
                "mode": "Incremental",
                "templateLink": {
                    "relativePath": "childTemplate.json",
                    "contentVersion": "1.0.0.0"
                },
                "parameters": {
                     "parameter1": { // Value for parameter1 of linked template  <<<<<<<<<<< CLICK ON parameter1 HERE
                        "value": "[parameters('parameter1')]" // Reference to top-level parameter1 in main template
                    }
                }
            }
        }
    ]
}

1229.parameters.json:

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "parameter1": {
            "value": "param1 value in params file"
        }
    }
}

childTemplate.json:

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "parameter1": { // parameter1 definition in child template
            "type": "string",
            "metadata": {
                "description": "description"
            }
        }
    },
    "functions": [],
    "variables": {
        "variable1": "[parameters('parameter1')]" // Use of parameter1 in linked template
    },
    "resources": [],
    "outputs": {}
}

REPRO:

  1. Click on parameter here:
    image
    RESULT:
    image
    EXPECTED:
    The top-level 'parameter1' should not be in the references.
    Possibly the actual definition of 'parameter1' in childTemplate.json should be in the references.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants