-
when I use '{}' or 'null' in below code, I always get deploy error
when use when use but use this directly in resource, it works well, how I can wrap the logic into a func?
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
The output type for func getOsProfile(node object, admin_username string, admin_password string, admin_key_data string) object? => isCvm(node)
? null
: generateOsProfile(node, admin_username, admin_password, admin_key_data)
...
osProfile: getOsProfile(nodes[i], admin_username, admin_password, admin_key_data) |
Beta Was this translation helpful? Give feedback.
The output type for
getOsProfile
is non-nullable. Function parameter and output types are enforced by the ARM engine at runtime, so returningnull
will raise an error. You can allow anull
return by using a?
suffix on the return type to make it nullable (i.e.,object?
instead ofobject
):