Validation for apiVersion should be able to look up variables
See original GitHub issueIt can be convenient to use a variable to set an apiVersion that is used in multiple places:
"variables": {
"storageApiVersion": "2016-01-01"
}
...
"resources": [
{
"apiVersion": "[variables('storageApiVersion')]",
"type": "Microsoft.Storage/storageAccounts",
"name": "StorageAccountName",
"location": "West US 2",
}
]
...
"diagnosticsStorageAccountConfig": {
"blobEndpoint": "[reference(concat('Microsoft.Storage/storageAccounts/StorageAccountName/', variables('storageApiVersion')).primaryEndpoints.blob]",
}
It looks like the API version validation is not able to look up the value of the variable and therefore gives a validation error:
Value must be one of the following values: "2015-05-01-preview", "2015-06-15", "2016-01-01", "2017-06-01", "2017-10-01", "2018-02-01", "2018-11-01", "2019-04-01", "2019-06-01", "2018-03-01-preview", "2018-07-01"arm-template (schema)
The validation message contains the value “2016-01-01” indicating that it is indeed a valid value but does not recognize that this is the value of the variable referenced in the apiVersion element.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
[Bug] apiVersion detection may be incorrect · Issue #3261
Try to create a "good" CronJob using v1 API version. See it's also blocked, and see that the variable in the message shows...
Read more >Solved: Create ARM Deployment API Error for nested resourc...
Hi. I'm using Flow to Create an Azure ARM Deployment. I initialize two variables, one with the Template and one with the Parameters....
Read more >5 - Stack Overflow
Wouldn't this say that it cannot find the resource named "resource not deployed" ?? If anything I would think you'd want an empty...
Read more >Kubernetes Troubleshooting - Fixing Validation Error | Datree.io
When Kubernetes is unable to read and validate from the manifest, ... Unfortunately, you will end up with an `error validating data ...
Read more >Validating Kubernetes YAML for best practice and policies
You can see all available helpers here. By default, it loads the entire input YAML file into the $$ variable and makes it...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@snorrk Thanks. That is a feature that’s on our list, but is not prioritized yet. Can you verify that we’d only need to handle apiVersion strings with a simple variables(‘xxx’) or parameters(‘xxx’) expression and nothing else in it?
cc @neilpeterson
@alexgav This could be done in two ways…
I’m leaning toward #2, what do you think?