Azure / template-specs

MIT License
31 stars 4 forks source link

Expressions wiped from published template spec #37

Closed Svessir closed 3 years ago

Svessir commented 4 years ago

I have been using new lines and indents in expressions to make them more readable in my templates. Example:

{
    "variables": {
         "myVar": "[if(equals(parameters('kind'), ''), 
                       variables('resources')[variables('provider')][variables('resourceType')],
                       variables('resources')[variables('provider')][variables('resourceType')][parameters('kind')]))]"
    }
}

This works well when I deploy the template normally but when creating a template spec I can see comments and such are removed from the template. Looking at the template in the template spec I would see the above example processed to:

{
    "variables": {
         "myVar": "#Azure Cli#"
    }
}

The worst thing is that the template spec will be created successfully instead of throwing an error.

alex-frankel commented 4 years ago

@Svessir - do you have the full template that you used to reproduce this behavior? Comments & whitespace are not preserved today, but we should not be changing any of the actual code, so this would indeed be very strange if this was happening.

stuartko commented 3 years ago

This is only impacting the Az CLI client. @detienne20 will investigate further.

@Svessir : As a workaround you can utilize the Az Powershell cmdlets until this is fixed...

detienne20 commented 3 years ago

We investigated and found the root cause. A fix should be deployed next week. In the meantime, you can use Az Powershell or escape the newlines with “\n” as a workaround.

alex-frankel commented 3 years ago

Closing - this fix should be deployed in the latest version of Az