Skip to content

Commit

Permalink
Merge pull request #749 from terraform-providers/refactoring-alertrule
Browse files Browse the repository at this point in the history
`azurerm_metric_alertrule` - Refactoring/removing unused code
  • Loading branch information
tombuildsstuff authored Jan 24, 2018
2 parents 47388e1 + 071ddbb commit a3923a9
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions azurerm/resource_arm_metric_alertrule.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,10 @@ func resourceArmMetricAlertRuleRead(d *schema.ResourceData, meta interface{}) er

d.Set("name", name)
d.Set("resource_group_name", resourceGroup)
d.Set("location", azureRMNormalizeLocation(*resp.Location))

if location := resp.Location; location != nil {
d.Set("location", azureRMNormalizeLocation(*location))
}

if alertRule := resp.AlertRule; alertRule != nil {
d.Set("description", alertRule.Description)
Expand Down Expand Up @@ -256,21 +259,15 @@ func resourceArmMetricAlertRuleRead(d *schema.ResourceData, meta interface{}) er

webhook_action["service_uri"] = *webhookAction.ServiceURI

//var properties map[string]string;

if webhookAction.Properties != nil {
properties := make(map[string]string, len(*webhookAction.Properties))

for k, v := range *webhookAction.Properties {
properties := make(map[string]string, 0)
if props := webhookAction.Properties; props != nil {
for k, v := range *props {
if k != "$type" {
properties[k] = *v
}
}
webhook_action["properties"] = properties
}
//else {
// properties = make(map[string]string, 0)
//}
webhook_action["properties"] = properties

webhook_actions = append(webhook_actions, webhook_action)
}
Expand Down

0 comments on commit a3923a9

Please sign in to comment.