From a9f12ae274ee65ead140e0f94c5bbb31225bd447 Mon Sep 17 00:00:00 2001 From: Jochen Rauschenbusch Date: Mon, 2 Mar 2020 17:17:19 +0100 Subject: [PATCH] fixing tflint and lintrest violations --- .../resource_arm_eventgrid_event_subscription.go | 13 ++++++------- .../resource_arm_eventgrid_domain_topic_test.go | 8 ++++---- ...esource_arm_eventgrid_event_subscription_test.go | 12 ++++++------ 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/azurerm/internal/services/eventgrid/resource_arm_eventgrid_event_subscription.go b/azurerm/internal/services/eventgrid/resource_arm_eventgrid_event_subscription.go index 75d4bb9d69cf..086e4129fd1f 100644 --- a/azurerm/internal/services/eventgrid/resource_arm_eventgrid_event_subscription.go +++ b/azurerm/internal/services/eventgrid/resource_arm_eventgrid_event_subscription.go @@ -233,7 +233,7 @@ func resourceArmEventGridEventSubscription() *schema.Resource { Type: schema.TypeString, Required: true, DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { - if strings.ToLower(old) == strings.ToLower(new) { + if strings.EqualFold(old, new) { return true } else if o, err := strconv.ParseFloat(old, 64); err == nil { n, err := strconv.ParseFloat(new, 64) @@ -285,7 +285,7 @@ func resourceArmEventGridEventSubscription() *schema.Resource { Type: schema.TypeString, ValidateFunc: validation.StringIsNotEmpty, DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { - if strings.ToLower(old) == strings.ToLower(new) { + if strings.EqualFold(old, new) { return true } else if o, err := strconv.ParseFloat(old, 64); err == nil { n, err := strconv.ParseFloat(new, 64) @@ -394,7 +394,7 @@ func resourceArmEventGridEventSubscriptionCreateUpdate(d *schema.ResourceData, m return fmt.Errorf("Error creating/updating EventGrid Event Subscription %q (Scope %q): %s", name, scope, err) } - expirationTime := date.Time{parsedTime} + expirationTime := date.Time{Time: parsedTime} eventSubscriptionProperties := eventgrid.EventSubscriptionProperties{ Destination: destination, @@ -463,7 +463,7 @@ func resourceArmEventGridEventSubscriptionRead(d *schema.ResourceData, meta inte d.Set("scope", id.Scope) if props := resp.EventSubscriptionProperties; props != nil { - d.Set("expiration_time_utc", props.ExpirationTimeUtc) + d.Set("expiration_time_utc", props.ExpirationTimeUtc.Format(time.RFC3339)) if props.Topic != nil && *props.Topic != "" { d.Set("topic_name", props.Topic) @@ -712,9 +712,8 @@ func expandEventGridEventSubscriptionFilter(d *schema.ResourceData) (*eventgrid. } } - if advancedFilterCompound, ok := d.GetOk("advanced_filter_array"); ok { - - for _, v := range advancedFilterCompound.([]interface{}) { + if advancedFilterArray, ok := d.GetOk("advanced_filter_array"); ok { + for _, v := range advancedFilterArray.([]interface{}) { config := v.(map[string]interface{}) key := config["key"].(string) diff --git a/azurerm/internal/services/eventgrid/tests/resource_arm_eventgrid_domain_topic_test.go b/azurerm/internal/services/eventgrid/tests/resource_arm_eventgrid_domain_topic_test.go index 4420852b2f08..552ca9f4084c 100644 --- a/azurerm/internal/services/eventgrid/tests/resource_arm_eventgrid_domain_topic_test.go +++ b/azurerm/internal/services/eventgrid/tests/resource_arm_eventgrid_domain_topic_test.go @@ -139,10 +139,10 @@ resource "azurerm_eventgrid_domain" "test" { } resource "azurerm_eventgrid_domain_topic" "test" { - name = "acctestegtopic-%d" - domain_name = azurerm_eventgrid_domain.test.name - resource_group_name = azurerm_resource_group.test.name - } + name = "acctestegtopic-%d" + domain_name = azurerm_eventgrid_domain.test.name + resource_group_name = azurerm_resource_group.test.name +} `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger) } diff --git a/azurerm/internal/services/eventgrid/tests/resource_arm_eventgrid_event_subscription_test.go b/azurerm/internal/services/eventgrid/tests/resource_arm_eventgrid_event_subscription_test.go index f804d2f06374..695d018cb4d5 100644 --- a/azurerm/internal/services/eventgrid/tests/resource_arm_eventgrid_event_subscription_test.go +++ b/azurerm/internal/services/eventgrid/tests/resource_arm_eventgrid_event_subscription_test.go @@ -521,15 +521,15 @@ resource "azurerm_eventgrid_event_subscription" "test" { } advanced_filter_scalar { - key = "data.filesize" - operator_type = "NumberLessThan" - value = 2000.0 + key = "data.filesize" + operator_type = "NumberLessThan" + value = 42.0 } advanced_filter_array { - key = "topic" - operator_type = "StringBeginsWith" - value = ["topic_prefix"] + key = "topic" + operator_type = "StringBeginsWith" + value = ["topic_prefix"] } } `, data.RandomInteger, data.Locations.Primary, data.RandomString, data.RandomInteger, data.RandomInteger)