diff --git a/internal/services/signalr/signalr_service_resource.go b/internal/services/signalr/signalr_service_resource.go index de24b1cb0b66..a876880ad4f4 100644 --- a/internal/services/signalr/signalr_service_resource.go +++ b/internal/services/signalr/signalr_service_resource.go @@ -88,9 +88,9 @@ func resourceArmSignalRService() *pluginsdk.Resource { Type: pluginsdk.TypeSet, Optional: true, Computed: true, - Deprecated: "Deprecated in favour of `connectivity_logs_enabled`, `messaging_logs_enabled` and `service_mode`", + Deprecated: "Deprecated in favour of `connectivity_logs_enabled`, `messaging_logs_enabled`, `live_trace_enabled` and `service_mode`", ConflictsWith: []string{ - "connectivity_logs_enabled", "messaging_logs_enabled", "service_mode", + "connectivity_logs_enabled", "messaging_logs_enabled", "live_trace_enabled", "service_mode", }, Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ @@ -101,6 +101,7 @@ func resourceArmSignalRService() *pluginsdk.Resource { string(signalr.FeatureFlagsEnableConnectivityLogs), string(signalr.FeatureFlagsEnableMessagingLogs), string(signalr.FeatureFlagsServiceMode), + "EnableLiveTrace", }, false), }, @@ -130,6 +131,15 @@ func resourceArmSignalRService() *pluginsdk.Resource { }, }, + "live_trace_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Computed: true, // TODO remove in 3.0 + ConflictsWith: []string{ + "features", + }, + }, + "service_mode": { Type: pluginsdk.TypeString, Optional: true, @@ -275,6 +285,7 @@ func resourceArmSignalRServiceCreate(d *pluginsdk.ResourceData, meta interface{} featureFlags := d.Get("features").(*pluginsdk.Set).List() connectivityLogsEnabled := d.Get("connectivity_logs_enabled").(bool) messagingLogsEnabled := d.Get("messaging_logs_enabled").(bool) + liveTraceEnabled := d.Get("live_trace_enabled").(bool) serviceMode := d.Get("service_mode").(string) cors := d.Get("cors").([]interface{}) @@ -286,6 +297,7 @@ func resourceArmSignalRServiceCreate(d *pluginsdk.ResourceData, meta interface{} } else { expandedFeatures = append(expandedFeatures, signalRFeature(signalr.FeatureFlagsEnableConnectivityLogs, strconv.FormatBool(connectivityLogsEnabled))) expandedFeatures = append(expandedFeatures, signalRFeature(signalr.FeatureFlagsEnableMessagingLogs, strconv.FormatBool(messagingLogsEnabled))) + expandedFeatures = append(expandedFeatures, signalRFeature("EnableLiveTrace", strconv.FormatBool(liveTraceEnabled))) if serviceMode == "" { serviceMode = "Default" @@ -366,6 +378,7 @@ func resourceArmSignalRServiceRead(d *pluginsdk.ResourceData, meta interface{}) connectivityLogsEnabled := false messagingLogsEnabled := false + liveTraceEnabled := false serviceMode := "Default" for _, feature := range *props.Features { if feature.Flag == signalr.FeatureFlagsEnableConnectivityLogs { @@ -374,12 +387,16 @@ func resourceArmSignalRServiceRead(d *pluginsdk.ResourceData, meta interface{}) if feature.Flag == signalr.FeatureFlagsEnableMessagingLogs { messagingLogsEnabled = strings.EqualFold(feature.Value, "True") } + if feature.Flag == "EnableLiveTrace" { + liveTraceEnabled = strings.EqualFold(feature.Value, "True") + } if feature.Flag == signalr.FeatureFlagsServiceMode { serviceMode = feature.Value } } d.Set("connectivity_logs_enabled", connectivityLogsEnabled) d.Set("messaging_logs_enabled", messagingLogsEnabled) + d.Set("live_trace_enabled", liveTraceEnabled) d.Set("service_mode", serviceMode) if err := d.Set("cors", flattenSignalRCors(props.Cors)); err != nil { @@ -418,7 +435,7 @@ func resourceArmSignalRServiceUpdate(d *pluginsdk.ResourceData, meta interface{} resourceType := signalr.SignalRResource{} - if d.HasChanges("cors", "features", "upstream_endpoint", "connectivity_logs_enabled", "messaging_logs_enabled", "service_mode") { + if d.HasChanges("cors", "features", "upstream_endpoint", "connectivity_logs_enabled", "messaging_logs_enabled", "service_mode", "live_trace_enabled") { resourceType.Properties = &signalr.SignalRProperties{} if d.HasChange("cors") { @@ -431,7 +448,7 @@ func resourceArmSignalRServiceUpdate(d *pluginsdk.ResourceData, meta interface{} resourceType.Properties.Features = expandSignalRFeatures(featuresRaw) } - if d.HasChanges("connectivity_logs_enabled", "messaging_logs_enabled", "service_mode") { + if d.HasChanges("connectivity_logs_enabled", "messaging_logs_enabled", "service_mode", "live_trace_enabled") { features := make([]signalr.SignalRFeature, 0) if d.HasChange("connectivity_logs_enabled") { connectivityLogsEnabled := d.Get("connectivity_logs_enabled").(bool) @@ -443,6 +460,11 @@ func resourceArmSignalRServiceUpdate(d *pluginsdk.ResourceData, meta interface{} features = append(features, signalRFeature(signalr.FeatureFlagsEnableMessagingLogs, strconv.FormatBool(messagingLogsEnabled))) } + if d.HasChange("live_trace_enabled") { + liveTraceEnabled := d.Get("live_trace_enabled").(bool) + features = append(features, signalRFeature("EnableLiveTrace", strconv.FormatBool(liveTraceEnabled))) + } + if d.HasChange("service_mode") { serviceMode := d.Get("service_mode").(string) features = append(features, signalRFeature(signalr.FeatureFlagsServiceMode, serviceMode)) diff --git a/internal/services/signalr/signalr_service_resource_test.go b/internal/services/signalr/signalr_service_resource_test.go index 251a5bb62d57..21d9b42621fc 100644 --- a/internal/services/signalr/signalr_service_resource_test.go +++ b/internal/services/signalr/signalr_service_resource_test.go @@ -327,6 +327,7 @@ func TestAccSignalRService_featureFlags(t *testing.T) { check.That(data.ResourceName).Key("secondary_connection_string").Exists(), check.That(data.ResourceName).Key("connectivity_logs_enabled").HasValue("true"), check.That(data.ResourceName).Key("messaging_logs_enabled").HasValue("true"), + check.That(data.ResourceName).Key("live_trace_enabled").HasValue("true"), check.That(data.ResourceName).Key("service_mode").HasValue("Serverless"), ), }, @@ -345,6 +346,7 @@ func TestAccSignalRService_featureFlags(t *testing.T) { check.That(data.ResourceName).Key("secondary_connection_string").Exists(), check.That(data.ResourceName).Key("connectivity_logs_enabled").HasValue("false"), check.That(data.ResourceName).Key("messaging_logs_enabled").HasValue("false"), + check.That(data.ResourceName).Key("live_trace_enabled").HasValue("false"), check.That(data.ResourceName).Key("service_mode").HasValue("Classic"), ), }, @@ -632,6 +634,7 @@ resource "azurerm_signalr_service" "test" { connectivity_logs_enabled = true messaging_logs_enabled = true + live_trace_enabled = true service_mode = "Serverless" } @@ -661,6 +664,7 @@ resource "azurerm_signalr_service" "test" { connectivity_logs_enabled = false messaging_logs_enabled = false + live_trace_enabled = false service_mode = "Classic" } diff --git a/website/docs/r/signalr_service.html.markdown b/website/docs/r/signalr_service.html.markdown index 9bf5bd6577ea..037d17276198 100644 --- a/website/docs/r/signalr_service.html.markdown +++ b/website/docs/r/signalr_service.html.markdown @@ -61,12 +61,14 @@ The following arguments are supported: * `features` - (Optional) A `features` block as documented below. -~> **NOTE:** The `features` block is deprecated, use `connectivity_logs_enabled`, `messaging_logs_enabled` and `service_mode` instead. +~> **NOTE:** The `features` block is deprecated, use `connectivity_logs_enabled`, `messaging_logs_enabled`, `live_trace_enabled` and `service_mode` instead. * `connectivity_logs_enabled`- (Optional) Specifies if Connectivity Logs are enabled or not. * `messaging_logs_enabled`- (Optional) Specifies if Messaging Logs are enabled or not. +* `live_trace_enabled`- (Optional) Specifies if Live Trace is enabled or not. + * `service_mode`- (Optional) Specifies the service mode. Possible values are `Classic`, `Default` and `Serverless`. * `upstream_endpoint` - (Optional) An `upstream_endpoint` block as documented below. Using this block requires the SignalR service to be Serverless. When creating multiple blocks they will be processed in the order they are defined in. @@ -83,7 +85,7 @@ A `cors` block supports the following: A `features` block supports the following: -* `flag` - (Required) The kind of Feature. Possible values are `EnableConnectivityLogs`, `EnableMessagingLogs`, and `ServiceMode`. +* `flag` - (Required) The kind of Feature. Possible values are `EnableConnectivityLogs`, `EnableMessagingLogs`, `EnableLiveTrace` and `ServiceMode`. * `value` - (Required) A value of a feature flag. Possible values are `Classic`, `Default` and `Serverless`.