Skip to content

Commit

Permalink
Swap Relay parser and validator with EventHub (#14277)
Browse files Browse the repository at this point in the history
  • Loading branch information
koikonom authored Nov 19, 2021
1 parent 4a5d256 commit d9eb19f
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ import (
"strings"
"time"

"github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces"

"github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2021-07-01-preview/insights"
"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
authRuleParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces"
eventhubValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/validate"
logAnalyticsParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/parse"
logAnalyticsValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/validate"
Expand Down Expand Up @@ -68,7 +67,7 @@ func resourceMonitorDiagnosticSetting() *pluginsdk.Resource {
Type: pluginsdk.TypeString,
Optional: true,
ForceNew: true,
ValidateFunc: namespaces.ValidateAuthorizationRuleID,
ValidateFunc: authRuleParse.ValidateAuthorizationRuleID,
},

"log_analytics_workspace_id": {
Expand Down Expand Up @@ -316,7 +315,8 @@ func resourceMonitorDiagnosticSettingRead(d *pluginsdk.ResourceData, meta interf
d.Set("eventhub_name", resp.EventHubName)
eventhubAuthorizationRuleId := ""
if resp.EventHubAuthorizationRuleID != nil && *resp.EventHubAuthorizationRuleID != "" {
parsedId, err := namespaces.ParseAuthorizationRuleIDInsensitively(*resp.EventHubAuthorizationRuleID)
authRuleId := utils.NormalizeNilableString(resp.EventHubAuthorizationRuleID)
parsedId, err := authRuleParse.ParseAuthorizationRuleID(authRuleId)
if err != nil {
return err
}
Expand Down

0 comments on commit d9eb19f

Please sign in to comment.