azurerm_log_analytics_saved_search : Fix Regex within function_parame… #11341
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…ters validation
The regex requirement in the given resource works for integers, as given in the example in the original PR, however it does not for strings. If a string has a default value supplied it must be in quotes (i.e in powershell New-AzOperationalInsightsSavedSearch, it would be -FunctionParameter "ID:string='g'"). While you can still make a successful apply doing var:string=abc, it will break when using the function as it is essentially going to run (e.g) | where Computer contains abc. abc does not exist. It needs to be "abc" if you where doing a query in LA (just an example).
Example Error:
I have changed two things about the regex, one is to allow single quotes after the ='s if a user wants to set a default string, I have also put an OR so its optional to just not have any default values at all, which are both valid options using powershell / raw api.
One option is just to get rid of this regex check completely and give responsibility to the user rather than having an extensive regex check, it seems this is more just so the users knows how to use the resource.
@mbfrahry
#8253