|
User-defined function is an amazing feature of Bicep. It makes it easy to implement naming convention across all Bicep modules for example. Function overloading would lead to a cleaner like I could write a function. For example, I'm implementing a function to get / generate the name of a resource. I put some parameters that could be null: func getResourceName(resourceType resourceTypeType, workload string, env string, region string, instance string?) => ...If I don't use the instance, I need to call it like this: param resourceGroupName string = getResourceName('resourceGroup', 'my-workload', 'dev', 'gwc', null)If I could overload function, I would have defined 2 functions: func getResourceName(resourceType resourceTypeType, workload string, env string, region string, instance string?) => ...
func (resourceType resourceTypeType, workload string, env string, region string) => ...Therefore I can call now this function like this: param resourceGroupName string = getResourceName('resourceGroup', 'my-workload', 'dev', 'gwc') |
Answered by
jeskew
May 28, 2024
Replies: 1 comment
|
There's no way to do this today (besides using different names for each function variant). Converting this to an issue for triage as a feature request. |
0 replies
Answer selected by
pmalarme
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There's no way to do this today (besides using different names for each function variant). Converting this to an issue for triage as a feature request.