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_workspace_table : support plan property #24341

Merged
merged 4 commits into from Jan 4, 2024

Conversation

sinbai
Copy link
Contributor

@sinbai sinbai commented Dec 27, 2023

Swagger: https://github.com/Azure/azure-rest-api-specs/blob/d1eb3c20113d1018f25a8d97fdfa5f8bb5c659ea/specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2022-10-01/Tables.json#L730

  • Change retention_in_days to optional because API does not accept setting this value in Basic plan.

  • There is no test case for updating plan since changing the plan is limited to once a week.

Test results:
PASS: TestAccLogAnalyticsWorkspaceTable_plan (267.83s)
PASS: TestAccLogAnalyticsWorkspaceTable_updateTableRetention (253.40s)

Fix #16889

@zioproto
Copy link
Contributor

Related to issue #16889

@@ -41,9 +41,15 @@ The following arguments are supported:

* `workspace_id` - (Required) The object ID of the Log Analytics Workspace that contains the table.

* `retention_in_days` - (Required) The table's retention in days. Possible values are either 7 (Free Tier only) or range between 30 and 730.
* `plan` - (Optional) Specify the system how to handle and charge the logs ingested to the table. Possible values are `Analytics` and `Basic. Defaults to `Analytics`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Basic is missing the closing backtick `


if string(tables.TablePlanEnumBasic) == rd.Get("plan").(string) {
if _, ok := rd.GetOk("retention_in_days"); ok {
return fmt.Errorf("cannot set retention_in_days as it is immutabl on Basic plan")
Copy link
Contributor

Choose a reason for hiding this comment

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

immutabl -> immutable

Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of "immutable" should we use the wording is "Retention is fixed at eight days".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zioproto thanks for your feedback. I'm using immutable because I'm not sure if "8 days" would change to something else in the future. If changes might occur, TF may not be able to modify it in time, thus giving users wrong prompts. Of course, I'd be happy to put "8 days" in the message if the service team could confirm that this number won't change in the future. Could you help confirm this? Thanks in advance.

Copy link
Contributor

Choose a reason for hiding this comment

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

The context is that the error messages should give information that helps the customer to find the documentation searching on the web.

The problem here is that a customer searching on Google "retention_in_days as it is immutable on Basic Plan" will not find anything in the Azure documentation. Instead searching "retention_in_days fixed at 8 days" will return the correct Azure documentation page where this is explained.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the explanation. The code has been updated.


-> **Note:** `retention_in_days` will revert back to the value of azurerm_log_analytics_workspace retention_in_days when a azurerm_log_analytics_workspace_table is deleted.

-> **Note:** The `retention_in_days` cannot be specified when the `plan` is `Basic` because it is immutable.
Copy link
Contributor

Choose a reason for hiding this comment

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

"because the retention is fixed to 8 days" would give a better information to the user.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same as above.

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe it is safe to mention the 8 days. The product is GA and this value is mentioned multiple times in the documentation:

https://learn.microsoft.com/en-us/azure/azure-monitor/logs/basic-logs-configure?tabs=portal-1#compare-the-basic-and-analytics-log-data-plans

Screenshot 2023-12-29 at 10 35 02

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the explanation. The code has been updated.

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 1 comment LGTM 🍰

website/docs/r/log_analytics_workspace_table.html.markdown Outdated Show resolved Hide resolved
@katbyte katbyte merged commit 728dda2 into hashicorp:main Jan 4, 2024
32 checks passed
@github-actions github-actions bot added this to the v3.86.0 milestone Jan 4, 2024
katbyte added a commit that referenced this pull request Jan 4, 2024
dduportal pushed a commit to jenkins-infra/azure that referenced this pull request Jan 6, 2024
<Actions>
<action
id="f410411e63aff4bb73a81c2aec1d373cf8a903e63b30dee2006b0030d8a94cc8">
        <h3>Bump Terraform `azurerm` provider version</h3>
<details
id="1d9343c012f5434ac9fe8a98135bae3667b399259be16d9b14302ea3bd424a24">
            <summary>Update Terraform lock file</summary>
<p>&#34;hashicorp/azurerm&#34; updated from &#34;3.85.0&#34; to
&#34;3.86.0&#34; in file &#34;.terraform.lock.hcl&#34;</p>
            <details>
                <summary>3.86.0</summary>
<pre>Changelog retrieved
from:&#xA;&#x9;https://github.com/hashicorp/terraform-provider-azurerm/releases/tag/v3.86.0&#xA;FEATURES:&#xA;&#xA;*
New Data Source: `azurerm_dashboard_grafana`
([#24243](https://github.com/hashicorp/terraform-provider-azurerm/issues/24243))&#xA;*
New Resource: `azurerm_log_analytics_workspace_table`
([#24229](https://github.com/hashicorp/terraform-provider-azurerm/issues/24229))&#xA;*
New Resource: `azurerm_automation_powershell72_module`
([#23980](https://github.com/hashicorp/terraform-provider-azurerm/issues/23980))&#xA;*
New Resource: `azurerm_data_factory_credential_user_managed_identity`
([#24307](https://github.com/hashicorp/terraform-provider-azurerm/issues/24307))&#xA;&#xA;ENHANCEMENTS:&#xA;&#xA;*
dependencies: updating to `v0.20231215.1114251` of
`hashicorp/go-azure-sdk`
([#24251](https://github.com/hashicorp/terraform-provider-azurerm/issues/24251))&#xA;*
dependencies: `azurerm_spring_cloud_api_portal` - update to use
`hashicorp/go-azure-sdk`
([#24321](https://github.com/hashicorp/terraform-provider-azurerm/issues/24321))&#xA;*
Data Source: `azurerm_kusto_cluster` - now exports the `identity` block
([#24314](https://github.com/hashicorp/terraform-provider-azurerm/issues/24314))&#xA;*
`azurerm_data_protection_backup_policy_postgresql` - support for the
`time_zone` property
([#24312](https://github.com/hashicorp/terraform-provider-azurerm/issues/24312))&#xA;*
`azurerm_data_protection_backup_policy_disk` - support for the
`time_zone` property
([#24312](https://github.com/hashicorp/terraform-provider-azurerm/issues/24312))&#xA;*
`azurerm_key_vault_managed_hardware_security_module` -the `tags`
property can now be updated
([#24333](https://github.com/hashicorp/terraform-provider-azurerm/issues/24333))&#xA;*
`azurerm_logic_app_standard` - support for the
`site_config.0.public_network_access_enabled` property
([#24257](https://github.com/hashicorp/terraform-provider-azurerm/issues/24257))&#xA;*
`azurerm_log_analytics_workspace_table` - support for the `plan`
property
([#24341](https://github.com/hashicorp/terraform-provider-azurerm/issues/24341))&#xA;*
`azurerm_linux_web_app` - support the value `20-lts` for the
`node_version` property
([#24289](https://github.com/hashicorp/terraform-provider-azurerm/issues/24289))&#xA;*
`azurerm_recovery_services_vault` - support creation with immutability
set to locked
([#23806](https://github.com/hashicorp/terraform-provider-azurerm/issues/23806))&#xA;*
`azurerm_spring_cloud_service` - support for the `sku_tier` property
([#24103](https://github.com/hashicorp/terraform-provider-azurerm/issues/24103))&#xA;&#xA;BUG
FIXES:&#xA;&#xA;* Data Source: `azurerm_role_definition` - correctly
export the `role_definition_id` attribute
([#24320](https://github.com/hashicorp/terraform-provider-azurerm/issues/24320))&#xA;*
`azurerm_bot_service` - fixing a bug where
`public_network_access_enabled` was always set to `true`
([#24255](https://github.com/hashicorp/terraform-provider-azurerm/issues/24255))&#xA;*
`azurerm_bot_service_azure_bot` - `tags` can now be updated
([#24332](https://github.com/hashicorp/terraform-provider-azurerm/issues/24332))&#xA;*
`azurerm_cosmosdb_account` - fix validation for the `ip_range_filter`
property
([#24306](https://github.com/hashicorp/terraform-provider-azurerm/issues/24306))&#xA;*
`azurerm_linux_virtual_machine` - the
`additional_capabilities.0.ultra_ssd_enabled` can now be changed during
the update
([#24274](https://github.com/hashicorp/terraform-provider-azurerm/issues/24274))&#xA;*
`azurerm_logic_app_standard` - update the default value of `version`
from `~3` which is no longer supported to `~4`
([#24134](https://github.com/hashicorp/terraform-provider-azurerm/issues/24134))&#xA;*
`azurerm_logic_app_standard` - fix a crash when setting the default
`version` 4.0 flag
([#24322](https://github.com/hashicorp/terraform-provider-azurerm/issues/24322))&#xA;*
`azurerm_iothub_device_update_account` - changing the `sku` property now
creates a new resource
([#24324](https://github.com/hashicorp/terraform-provider-azurerm/issues/24324))&#xA;*
`azurerm_iothub` - prevent an inconsistant value after an apply
([#24326](https://github.com/hashicorp/terraform-provider-azurerm/issues/24326))&#xA;*
`azurerm_orchestrated_virtual_machine_scale_set` - correctly update the
resource when hotpatch is enabled
([#24335](https://github.com/hashicorp/terraform-provider-azurerm/issues/24335))&#xA;*
`azurerm_windows_virtual_machine` - the
`additional_capabilities.0.ultra_ssd_enabled` can now be changed during
the update
([#24274](https://github.com/hashicorp/terraform-provider-azurerm/issues/24274))&#xA;*
`azurerm_scheduled_query_rules_alert` - changing the `data_source_id`
now creates a new resource
([#24327](https://github.com/hashicorp/terraform-provider-azurerm/issues/24327))&#xA;*
`azurerm_scheduled_query_rules_log` - changing the `data_source_id` now
creates a new resource
([#24327](https://github.com/hashicorp/terraform-provider-azurerm/issues/24327))&#xA;&#xA;&#xA;</pre>
            </details>
        </details>
<a
href="https://infra.ci.jenkins.io/job/terraform-jobs/job/azure/job/main/985/">Jenkins
pipeline link</a>
    </action>
</Actions>

---

<table>
  <tr>
    <td width="77">
<img src="https://www.updatecli.io/images/updatecli.png" alt="Updatecli
logo" width="50" height="50">
    </td>
    <td>
      <p>
Created automatically by <a
href="https://www.updatecli.io/">Updatecli</a>
      </p>
      <details><summary>Options:</summary>
        <br />
<p>Most of Updatecli configuration is done via <a
href="https://www.updatecli.io/docs/prologue/quick-start/">its
manifest(s)</a>.</p>
        <ul>
<li>If you close this pull request, Updatecli will automatically reopen
it, the next time it runs.</li>
<li>If you close this pull request and delete the base branch, Updatecli
will automatically recreate it, erasing all previous commits made.</li>
        </ul>
        <p>
Feel free to report any issues at <a
href="https://github.com/updatecli/updatecli/issues">github.com/updatecli/updatecli</a>.<br
/>
If you find this tool useful, do not hesitate to star <a
href="https://github.com/updatecli/updatecli/stargazers">our GitHub
repository</a> as a sign of appreciation, and/or to tell us directly on
our <a
href="https://matrix.to/#/#Updatecli_community:gitter.im">chat</a>!
        </p>
      </details>
    </td>
  </tr>
</table>

Co-authored-by: Jenkins Infra Bot (updatecli) <60776566+jenkins-infra-bot@users.noreply.github.com>
@sinbai sinbai deleted the loganalytics/support_plan branch March 28, 2024 02:42
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 29, 2024
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.

Support for az log analytics basic logging plan for tables name
3 participants