diff --git a/internal/services/loganalytics/log_analytics_datasource_windows_event_resource.go b/internal/services/loganalytics/log_analytics_datasource_windows_event_resource.go index 611591e7dc42..b7f0cdc00795 100644 --- a/internal/services/loganalytics/log_analytics_datasource_windows_event_resource.go +++ b/internal/services/loganalytics/log_analytics_datasource_windows_event_resource.go @@ -4,7 +4,6 @@ import ( "encoding/json" "fmt" "log" - "strings" "time" "github.com/hashicorp/go-azure-helpers/lang/response" @@ -199,7 +198,7 @@ func flattenLogAnalyticsDataSourceWindowsEventEventType(eventTypes []dataSourceW for _, e := range eventTypes { // The casing isn't preserved by the API for event types, so we need to normalise it here until // https://github.com/Azure/azure-rest-api-specs/issues/18163 is fixed - output = append(output, strings.ToLower(e.EventType)) + output = append(output, e.EventType) } return output } diff --git a/internal/services/loganalytics/log_analytics_linked_storage_account_resource.go b/internal/services/loganalytics/log_analytics_linked_storage_account_resource.go index d3e2ba109ebd..a15045574197 100644 --- a/internal/services/loganalytics/log_analytics_linked_storage_account_resource.go +++ b/internal/services/loganalytics/log_analytics_linked_storage_account_resource.go @@ -3,7 +3,6 @@ package loganalytics import ( "fmt" "log" - "strings" "time" "github.com/hashicorp/go-azure-helpers/lang/response" @@ -11,14 +10,16 @@ import ( "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/suppress" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceLogAnalyticsLinkedStorageAccount() *pluginsdk.Resource { - return &pluginsdk.Resource{ + resource := &pluginsdk.Resource{ Create: resourceLogAnalyticsLinkedStorageAccountCreateUpdate, Read: resourceLogAnalyticsLinkedStorageAccountRead, Update: resourceLogAnalyticsLinkedStorageAccountCreateUpdate, @@ -42,12 +43,11 @@ func resourceLogAnalyticsLinkedStorageAccount() *pluginsdk.Resource { Required: true, ForceNew: true, 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", + string(linkedstorageaccounts.DataSourceTypeAlerts), + string(linkedstorageaccounts.DataSourceTypeAzureWatson), + string(linkedstorageaccounts.DataSourceTypeCustomLogs), + string(linkedstorageaccounts.DataSourceTypeIngestion), + string(linkedstorageaccounts.DataSourceTypeQuery), }, false), }, @@ -71,6 +71,25 @@ func resourceLogAnalyticsLinkedStorageAccount() *pluginsdk.Resource { }, }, } + + // TODO 4.0: remove this block to respect correct casing + if !features.FourPointOhBeta() { + resource.Schema["data_source_type"] = &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + string(linkedstorageaccounts.DataSourceTypeAlerts), + string(linkedstorageaccounts.DataSourceTypeAzureWatson), + string(linkedstorageaccounts.DataSourceTypeCustomLogs), + string(linkedstorageaccounts.DataSourceTypeIngestion), + string(linkedstorageaccounts.DataSourceTypeQuery), + }, true), + DiffSuppressFunc: suppress.CaseDifference, + } + } + + return resource } func resourceLogAnalyticsLinkedStorageAccountCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error {