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

azurerm_log_analytics_saved_search : Fix Regex within function_parame… #11341

Merged
merged 1 commit into from
Apr 15, 2021

Conversation

kaovd
Copy link
Contributor

@kaovd kaovd commented Apr 15, 2021

…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:
image

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

…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). 

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
@ghost ghost added the size/XS label Apr 15, 2021
Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @kaovd - LGTM 👍

@katbyte katbyte added this to the v2.56.0 milestone Apr 15, 2021
@katbyte katbyte merged commit 8034ed7 into hashicorp:master Apr 15, 2021
@ghost
Copy link

ghost commented Apr 16, 2021

This has been released in version 2.56.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 2.56.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented May 15, 2021

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators May 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants