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

New Resource: azurerm_log_analytics_saved_search #8253

Merged
merged 13 commits into from
Sep 3, 2020

Conversation

mbfrahry
Copy link
Member

@mbfrahry mbfrahry commented Aug 26, 2020

Dependent on #8234

--- PASS: TestAccAzureRMLogAnalyticsSavedSearch_complete (139.56s)
--- PASS: TestAccAzureRMLogAnalyticsSavedSearch_basic (140.36s)
--- PASS: TestAccAzureRMLogAnalyticsSavedSearch_requiresImport (144.51s)

@aristosvo
Copy link
Collaborator

Nice, was looking into this but at that time the API wasn’t ready :) Looking forward to use it!

@mbfrahry mbfrahry changed the title [WIP] New Resource: azurerm_log_analytics_saved_search New Resource: azurerm_log_analytics_saved_search Aug 26, 2020
Copy link
Contributor

@tombuildsstuff tombuildsstuff left a 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,
Copy link
Contributor

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,
Copy link
Contributor

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?

Copy link
Member Author

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

Copy link
Collaborator

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() {
Copy link
Contributor

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:

Suggested change
if features.ShouldResourcesBeImported() && d.IsNewResource() {
if d.IsNewResource() {

}

if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, name, parameters); err != nil {
return err
Copy link
Contributor

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:

Suggested change
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
Copy link
Contributor

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:

Suggested change
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 {
Copy link
Contributor

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)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
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)

@@ -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>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<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.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* `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.
Copy link
Contributor

Choose a reason for hiding this comment

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

this can be plural:

Suggested change
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.

@mbfrahry
Copy link
Member Author

mbfrahry commented Sep 1, 2020

Review addressed!

@katbyte katbyte added this to the v2.26.0 milestone Sep 2, 2020
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.

Aside from one comment LGTM 👍

Type: schema.TypeString,
Required: true,
ForceNew: true,
DiffSuppressFunc: suppress.CaseDifference,
Copy link
Collaborator

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?

@tombuildsstuff tombuildsstuff modified the milestones: v2.26.0, v2.27.0 Sep 3, 2020
@mbfrahry mbfrahry merged commit d710350 into master Sep 3, 2020
@mbfrahry mbfrahry deleted the f-log-analytics-saved-searche branch September 3, 2020 17:44
mbfrahry added a commit that referenced this pull request Sep 3, 2020
@mbfrahry mbfrahry modified the milestones: v2.27.0, v2.26.0 Sep 3, 2020
@ghost
Copy link

ghost commented Sep 4, 2020

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

@ghost
Copy link

ghost commented Oct 4, 2020

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!

@ghost ghost locked as resolved and limited conversation to collaborators Oct 4, 2020
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.

4 participants