From ab21ad57bd59f928f6c481756b4d6135d2fa3761 Mon Sep 17 00:00:00 2001 From: kt Date: Fri, 29 Jun 2018 02:28:51 -0700 Subject: [PATCH] cosmosdb account: fixed ip_range_filter validation (#1463) --- azurerm/resource_arm_cosmos_db_account.go | 4 ++-- azurerm/resource_arm_cosmos_db_account_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/azurerm/resource_arm_cosmos_db_account.go b/azurerm/resource_arm_cosmos_db_account.go index 3b5628f3027a..231c9676d0f6 100644 --- a/azurerm/resource_arm_cosmos_db_account.go +++ b/azurerm/resource_arm_cosmos_db_account.go @@ -72,8 +72,8 @@ func resourceArmCosmosDBAccount() *schema.Resource { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringMatch( - regexp.MustCompile(`^(\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b[,]?){1,}$`), - "Cosmos DB ip_range_filter must be a set of CIDR IP addresses separated by commas with no spaces: '10.0.0.1,10.0.0.2'", + regexp.MustCompile(`^(\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\/[1-2][0-9])?\b[,]?){1,}$`), + "Cosmos DB ip_range_filter must be a set of CIDR IP addresses separated by commas with no spaces: '10.0.0.1,10.0.0.2,10.20.0.0/16'", ), }, diff --git a/azurerm/resource_arm_cosmos_db_account_test.go b/azurerm/resource_arm_cosmos_db_account_test.go index 8c28527c0854..31a82819dd54 100644 --- a/azurerm/resource_arm_cosmos_db_account_test.go +++ b/azurerm/resource_arm_cosmos_db_account_test.go @@ -393,7 +393,7 @@ func TestAccAzureRMCosmosDBAccount_complete(t *testing.T) { Config: testAccAzureRMCosmosDBAccount_complete(ri, testLocation(), testAltLocation()), Check: resource.ComposeAggregateTestCheckFunc( checkAccAzureRMCosmosDBAccount_basic(resourceName, testLocation(), string(documentdb.BoundedStaleness), 2), - resource.TestCheckResourceAttr(resourceName, "ip_range_filter", "104.42.195.92,40.76.54.131,52.176.6.30,52.169.50.45,52.187.184.26"), + resource.TestCheckResourceAttr(resourceName, "ip_range_filter", "104.42.195.92,40.76.54.131,52.176.6.30,52.169.50.45,52.187.184.26,10.20.0.0/16"), resource.TestCheckResourceAttr(resourceName, "enable_automatic_failover", "true"), ), }, @@ -527,7 +527,7 @@ func testAccAzureRMCosmosDBAccount_geoReplicated_customId(rInt int, location str func testAccAzureRMCosmosDBAccount_complete(rInt int, location string, altLocation string) string { return testAccAzureRMCosmosDBAccount_basic(rInt, location, string(documentdb.BoundedStaleness), "", fmt.Sprintf(` - ip_range_filter = "104.42.195.92,40.76.54.131,52.176.6.30,52.169.50.45,52.187.184.26" + ip_range_filter = "104.42.195.92,40.76.54.131,52.176.6.30,52.169.50.45,52.187.184.26,10.20.0.0/16" enable_automatic_failover = true geo_location {