Skip to content

Commit

Permalink
cosmosdb account: fixed ip_range_filter validation (#1463)
Browse files Browse the repository at this point in the history
  • Loading branch information
katbyte authored and tombuildsstuff committed Jun 29, 2018
1 parent 75c5f61 commit ab21ad5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions azurerm/resource_arm_cosmos_db_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -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'",
),
},

Expand Down
4 changes: 2 additions & 2 deletions azurerm/resource_arm_cosmos_db_account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
),
},
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit ab21ad5

Please sign in to comment.