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

What-If stops showing the resource at all when certain ARM functions are used #236

Closed
slavizh opened this issue Oct 27, 2021 · 4 comments
Closed

Comments

@slavizh
Copy link

slavizh commented Oct 27, 2021

Describe the bug
When certain functions are used in properties of a resource that resources stops showing at all in What-If results.
For example I have the following code:

"tasks": {
                    "preTask": "[if( empty( parameters( 'windowsDeploymentSchedule' ).preTask.runbookName ),
                            null(),
                            createObject(
                                'source', parameters( 'windowsDeploymentSchedule' ).preTask.runbookName,
                                'parameters', parameters( 'windowsDeploymentSchedule' ).preTask.parameters
                            )
                        )]",
                    "postTask": "[if( empty( parameters( 'windowsDeploymentSchedule' ).postTask.runbookName ),
                            null(),
                            createObject(
                                'source', parameters( 'windowsDeploymentSchedule' ).postTask.runbookName,
                                'parameters', parameters( 'windowsDeploymentSchedule' ).postTask.parameters
                            )
                        )]"
                }

as soon as I have changed the code to :

"tasks": {
                    "preTask": "[if( empty( parameters( 'windowsDeploymentSchedule' ).preTask.runbookName ),
                            null(),
                            createObject(
                                'source', parameters( 'windowsDeploymentSchedule' ).preTask.runbookName,
                                'parameters', json( replace( string( parameters( 'windowsDeploymentSchedule' ).preTask.parameters ), '[[' , '[') )
                            )
                        )]",
                    "postTask": "[if( empty( parameters( 'windowsDeploymentSchedule' ).postTask.runbookName ),
                            null(),
                            createObject(
                                'source', parameters( 'windowsDeploymentSchedule' ).postTask.runbookName,
                                'parameters', json( replace( string( parameters( 'windowsDeploymentSchedule' ).postTask.parameters ), '[[' , '[') )
                            )
                        )]"
                }

the resources stopped showing in what-if results at all

To Reproduce
above

Expected behavior
To show the resource

Screenshots
If applicable, add screenshots to help explain your problem.

Client [e.g. PowerShell, CLI, API)
PowerShell

@ghost ghost added the Needs Triage 🔍 label Oct 27, 2021
@alex-frankel
Copy link
Contributor

@shenglol -- this looks separate from #157, but I'm assuming this is also causing preflight to short-circuit.

@shenglol
Copy link
Collaborator

Yeah there's no reference function used. I'll investigate this.

@slavizh
Copy link
Author

slavizh commented Oct 28, 2021

A little more information in case it is needed.
Full resource type is Microsoft.Automation/automationAccounts/softwareUpdateConfigurations but I do not think it is resource specific. I specifically tested only with the changes above and concluded that the changes in tasks are the culprit. The reason why I am doing that replace is due to having to add value like

{
                                        "[PARAMETER 1]": "dsds",
                                        "[PARAMETER 2]": "dsds"
                                    }

for parameters which ARM will try to interpreter as ARM function so I have to pass the values like:

{
                                        "[[PARAMETER 1]": "dsds",
                                        "[[PARAMETER 2]": "dsds"
                                    }

and change them via the functions.

@shenglol
Copy link
Collaborator

shenglol commented Nov 2, 2021

Synced offline and provided workarounds. This is basically a limitation in the ARM pre-flight engine. Closing the issue.

@shenglol shenglol closed this as completed Nov 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants