diff --git a/azurerm/internal/services/search/resource_arm_search_service.go b/azurerm/internal/services/search/resource_arm_search_service.go index 519af73a2de5..a71b7c694bf4 100644 --- a/azurerm/internal/services/search/resource_arm_search_service.go +++ b/azurerm/internal/services/search/resource_arm_search_service.go @@ -66,14 +66,13 @@ func resourceArmSearchService() *schema.Resource { Type: schema.TypeInt, Optional: true, Computed: true, - ForceNew: true, }, "partition_count": { - Type: schema.TypeInt, - Optional: true, - Computed: true, - ForceNew: true, + Type: schema.TypeInt, + Optional: true, + Computed: true, + ValidateFunc: validation.IntAtMost(12), }, "primary_key": { diff --git a/azurerm/internal/services/search/tests/resource_arm_search_service_test.go b/azurerm/internal/services/search/tests/resource_arm_search_service_test.go index 857a0de509fc..e6801b1ad650 100644 --- a/azurerm/internal/services/search/tests/resource_arm_search_service_test.go +++ b/azurerm/internal/services/search/tests/resource_arm_search_service_test.go @@ -81,7 +81,7 @@ func TestAccAzureRMSearchService_complete(t *testing.T) { }) } -func TestAccAzureRMSearchService_tagUpdate(t *testing.T) { +func TestAccAzureRMSearchService_update(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_search_service", "test") resource.ParallelTest(t, resource.TestCase{ @@ -90,7 +90,7 @@ func TestAccAzureRMSearchService_tagUpdate(t *testing.T) { CheckDestroy: testCheckAzureRMSearchServiceDestroy, Steps: []resource.TestStep{ { - Config: testAccAzureRMSearchService_withCustomTagValue(data, "staging"), + Config: testAccAzureRMSearchService_basic(data), Check: resource.ComposeTestCheckFunc( testCheckAzureRMSearchServiceExists(data.ResourceName), resource.TestCheckResourceAttr(data.ResourceName, "tags.%", "1"), @@ -98,11 +98,11 @@ func TestAccAzureRMSearchService_tagUpdate(t *testing.T) { ), }, { - Config: testAccAzureRMSearchService_withCustomTagValue(data, "production"), + Config: testAccAzureRMSearchService_complete(data), Check: resource.ComposeTestCheckFunc( testCheckAzureRMSearchServiceExists(data.ResourceName), - resource.TestCheckResourceAttr(data.ResourceName, "tags.%", "1"), - resource.TestCheckResourceAttr(data.ResourceName, "tags.environment", "production"), + resource.TestCheckResourceAttr(data.ResourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(data.ResourceName, "tags.environment", "Production"), ), }, }, @@ -166,7 +166,7 @@ func testCheckAzureRMSearchServiceDestroy(s *terraform.State) error { return nil } -func testAccAzureRMSearchService_withCustomTagValue(data acceptance.TestData, tagValue string) string { +func testAccAzureRMSearchService_basic(data acceptance.TestData) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { name = "acctestRG-%d" @@ -180,14 +180,10 @@ resource "azurerm_search_service" "test" { sku = "standard" tags = { - environment = "%s" + environment = "staging" } } -`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, tagValue) -} - -func testAccAzureRMSearchService_basic(data acceptance.TestData) string { - return testAccAzureRMSearchService_withCustomTagValue(data, "staging") +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger) } func testAccAzureRMSearchService_requiresImport(data acceptance.TestData) string { @@ -220,9 +216,11 @@ resource "azurerm_search_service" "test" { location = "${azurerm_resource_group.test.location}" sku = "standard" replica_count = 2 + partition_count = 3 tags = { - environment = "production" + environment = "Production" + residential = "Area" } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger)