-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
New Resource: azurerm_log_analytics_saved_search
#8253
Conversation
Nice, was looking into this but at that time the API wasn’t ready :) Looking forward to use it! |
azurerm_log_analytics_saved_search
azurerm_log_analytics_saved_search
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments inline - but this otherwise LGTM 👍
Type: schema.TypeString, | ||
Required: true, | ||
ForceNew: true, | ||
ValidateFunc: azure.ValidateResourceID, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add a more specific parser here to check this is a Log Analytics Workspace ID?
Type: schema.TypeString, | ||
Required: true, | ||
ForceNew: true, | ||
DiffSuppressFunc: suppress.CaseDifference, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this case-insensitive?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, any Log Analytics path doesn't honor casing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we open an issue on the SDK and throw in a link here?
return err | ||
} | ||
|
||
if features.ShouldResourcesBeImported() && d.IsNewResource() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we remove the call to this deprecated method:
if features.ShouldResourcesBeImported() && d.IsNewResource() { | |
if d.IsNewResource() { |
} | ||
|
||
if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, name, parameters); err != nil { | ||
return err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we wrap this error:
return err | |
return fmt.Errorf("creating Saved Search %q (Log Analytics Workspace %q / Resource Group %q): %+v", name, id.Name, id.ResourceGroup, err) |
|
||
read, err := client.Get(ctx, id.ResourceGroup, id.Name, name) | ||
if err != nil { | ||
return err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we wrap this error:
return err | |
return fmt.Errorf("retrieving Saved Search %q (Log Analytics Workspace %q / Resource Group %q): %+v", name, id.Name, id.ResourceGroup, err) |
} | ||
|
||
_, err = client.Delete(ctx, id.ResourceGroup, id.WorkspaceName, id.Name) | ||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor we can combine these into a single line
|
||
_, err = client.Delete(ctx, id.ResourceGroup, id.WorkspaceName, id.Name) | ||
if err != nil { | ||
return fmt.Errorf("issuing AzureRM delete request for Log Analytics Saved Search %q (WorkSpace %q / Resource Group %q): %s", id.Name, id.WorkspaceName, id.ResourceGroup, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return fmt.Errorf("issuing AzureRM delete request for Log Analytics Saved Search %q (WorkSpace %q / Resource Group %q): %s", id.Name, id.WorkspaceName, id.ResourceGroup, err) | |
return fmt.Errorf("deleting Saved Search %q (Log Analytics Workspace %q / Resource Group %q): %s", id.Name, id.WorkspaceName, id.ResourceGroup, err) |
website/azurerm.erb
Outdated
@@ -1903,6 +1903,10 @@ | |||
<a href="/docs/providers/azurerm/r/log_analytics_linked_service.html">azurerm_log_analytics_linked_service</a> | |||
</li> | |||
|
|||
<li> | |||
<a href="/docs/providers/azurerm/r/log_analytics_saved_search.html">azurerm_log_analytics_saved_search/a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<a href="/docs/providers/azurerm/r/log_analytics_saved_search.html">azurerm_log_analytics_saved_search/a> | |
<a href="/docs/providers/azurerm/r/log_analytics_saved_search.html">azurerm_log_analytics_saved_search</a> |
|
||
* `name` - (Required) Specifies the name of the Log Analytics Saved Search. Changing this forces a new resource to be created. | ||
|
||
* `log_analytics_workspace_id` - (Required) Specifies the ID of the Log Analytics Work Space that the Saved Search will be associated with. Changing this forces a new resource to be created. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* `log_analytics_workspace_id` - (Required) Specifies the ID of the Log Analytics Work Space that the Saved Search will be associated with. Changing this forces a new resource to be created. | |
* `log_analytics_workspace_id` - (Required) Specifies the ID of the Log Analytics Workspace that the Saved Search will be associated with. Changing this forces a new resource to be created. |
|
||
## Import | ||
|
||
Log Analytics Saved Search can be imported using the `resource id`, e.g. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be plural:
Log Analytics Saved Search can be imported using the `resource id`, e.g. | |
Log Analytics Saved Searches can be imported using the `resource id`, e.g. |
Review addressed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from one comment LGTM 👍
Type: schema.TypeString, | ||
Required: true, | ||
ForceNew: true, | ||
DiffSuppressFunc: suppress.CaseDifference, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we open an issue on the SDK and throw in a link here?
This has been released in version 2.26.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.26.0"
}
# ... other configuration ... |
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 👉 [email protected]. Thanks! |
Dependent on #8234