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_linked_storage_account - fix data_source_type case sensitivity #18116

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package loganalytics
import (
"fmt"
"log"
"strings"
"time"

"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/linkedstorageaccounts"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/features"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation"
"github.com/hashicorp/terraform-provider-azurerm/internal/timeouts"
Expand Down Expand Up @@ -41,14 +41,14 @@ func resourceLogAnalyticsLinkedStorageAccount() *pluginsdk.Resource {
Type: pluginsdk.TypeString,
Required: true,
ForceNew: true,
// https://github.com/Azure/azure-rest-api-specs/issues/20619
ValidateFunc: validation.StringInSlice([]string{
strings.ToLower(string(linkedstorageaccounts.DataSourceTypeCustomLogs)),
strings.ToLower(string(linkedstorageaccounts.DataSourceTypeAzureWatson)),
strings.ToLower(string(linkedstorageaccounts.DataSourceTypeQuery)),
strings.ToLower(string(linkedstorageaccounts.DataSourceTypeAlerts)),
// Value removed from enum in 2020-08-01, but effectively still works
"ingestion",
}, false),
string(linkedstorageaccounts.DataSourceTypeCustomLogs),
string(linkedstorageaccounts.DataSourceTypeAzureWatson),
string(linkedstorageaccounts.DataSourceTypeQuery),
string(linkedstorageaccounts.DataSourceTypeAlerts),
string(linkedstorageaccounts.DataSourceTypeIngestion),
}, !features.FourPointOhBeta()),
},

"resource_group_name": azure.SchemaResourceGroupName(),
Expand Down Expand Up @@ -145,7 +145,6 @@ func resourceLogAnalyticsLinkedStorageAccountRead(d *pluginsdk.ResourceData, met
dataSourceType = string(*props.DataSourceType)
}
d.Set("data_source_type", dataSourceType)

}

return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ resource "azurerm_log_analytics_linked_storage_account" "example" {

The following arguments are supported:

* `data_source_type` - (Required) The data source type which should be used for this Log Analytics Linked Storage Account. Possible values are `customlogs`, `azurewatson`, `query`, `ingestion` and `alerts`. Changing this forces a new Log Analytics Linked Storage Account to be created.
* `data_source_type` - (Required) The data source type which should be used for this Log Analytics Linked Storage Account. Possible values are `CustomLogs`, `AzureWatson`, `Query`, `Ingestion` and `Alerts`. Changing this forces a new Log Analytics Linked Storage Account to be created.

> **Note:** The `data_source_type` is case-insensitive due to [service API issue](https://github.com/Azure/azure-rest-api-specs/issues/20619). After the API issue is fixed, case-sensitivity will be required in 4.0 or later versions.

* `resource_group_name` - (Required) The name of the Resource Group where the Log Analytics Linked Storage Account should exist. Changing this forces a new Log Analytics Linked Storage Account to be created.

Expand Down