From a105362a5f75ad7eba33ffd72e8ff6dc3e98b637 Mon Sep 17 00:00:00 2001 From: River Phillips Date: Sun, 17 Feb 2019 10:29:21 +0000 Subject: [PATCH 1/3] Update redux firewall rule name to allow underscores --- azurerm/resource_arm_redis_firewall_rule.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azurerm/resource_arm_redis_firewall_rule.go b/azurerm/resource_arm_redis_firewall_rule.go index daa67cab28c6..42db514c303d 100644 --- a/azurerm/resource_arm_redis_firewall_rule.go +++ b/azurerm/resource_arm_redis_firewall_rule.go @@ -161,7 +161,7 @@ func resourceArmRedisFirewallRuleDelete(d *schema.ResourceData, meta interface{} func validateRedisFirewallRuleName(v interface{}, k string) (warnings []string, errors []error) { value := v.(string) - if matched := regexp.MustCompile(`^[0-9a-zA-Z]+$`).Match([]byte(value)); !matched { + if matched := regexp.MustCompile(`^[0-9a-zA-Z_]+$`).Match([]byte(value)); !matched { errors = append(errors, fmt.Errorf("%q may only contain alphanumeric characters", k)) } From ae6c5991a931026e6d6d926f3daf246703c3cc25 Mon Sep 17 00:00:00 2001 From: River Phillips Date: Sun, 17 Feb 2019 12:36:02 +0000 Subject: [PATCH 2/3] Update message for invalid name to reflect new RegeEx --- azurerm/resource_arm_redis_firewall_rule.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azurerm/resource_arm_redis_firewall_rule.go b/azurerm/resource_arm_redis_firewall_rule.go index 42db514c303d..305c73a35e9f 100644 --- a/azurerm/resource_arm_redis_firewall_rule.go +++ b/azurerm/resource_arm_redis_firewall_rule.go @@ -162,7 +162,7 @@ func validateRedisFirewallRuleName(v interface{}, k string) (warnings []string, value := v.(string) if matched := regexp.MustCompile(`^[0-9a-zA-Z_]+$`).Match([]byte(value)); !matched { - errors = append(errors, fmt.Errorf("%q may only contain alphanumeric characters", k)) + errors = append(errors, fmt.Errorf("%q may only contain alphanumeric characters and underscores", k)) } return warnings, errors From a06784c4de75b8d0bf75c6c1ed6b37bf03dddea6 Mon Sep 17 00:00:00 2001 From: River Phillips Date: Sun, 17 Feb 2019 12:44:06 +0000 Subject: [PATCH 3/3] Update tests to allow underscores in redis firewall --- azurerm/resource_arm_redis_firewall_rule_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azurerm/resource_arm_redis_firewall_rule_test.go b/azurerm/resource_arm_redis_firewall_rule_test.go index c65bf79d7485..5bff79311539 100644 --- a/azurerm/resource_arm_redis_firewall_rule_test.go +++ b/azurerm/resource_arm_redis_firewall_rule_test.go @@ -34,7 +34,7 @@ func TestAzureRMRedisFirewallRuleName_validation(t *testing.T) { }, { Value: "hello_world", - ErrCount: 1, + ErrCount: 0, }, { Value: "helloworld21!",