diff --git a/azurerm/resource_arm_postgresql_server_test.go b/azurerm/resource_arm_postgresql_server_test.go index 9ad39406a6632..974d6d06cc394 100644 --- a/azurerm/resource_arm_postgresql_server_test.go +++ b/azurerm/resource_arm_postgresql_server_test.go @@ -124,7 +124,35 @@ func TestAccAzureRMPostgreSQLServer_updatePassword(t *testing.T) { ri := acctest.RandInt() location := testLocation() config := testAccAzureRMPostgreSQLServer_basicNinePointSix(ri, location) - updatedConfig := testAccAzureRMPostgreSQLServer_basicNinePointSixUpdated(ri, location) + updatedConfig := testAccAzureRMPostgreSQLServer_basicNinePointSixUpdatedPassword(ri, location) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMPostgreSQLServerDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMPostgreSQLServerExists(resourceName), + ), + }, + { + Config: updatedConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMPostgreSQLServerExists(resourceName), + ), + }, + }, + }) +} + +func TestAccAzureRMPostgreSQLServer_updatePassword(t *testing.T) { + resourceName := "azurerm_postgresql_server.test" + ri := acctest.RandInt() + location := testLocation() + config := testAccAzureRMPostgreSQLServer_basicNinePointSix(ri, location) + updatedConfig := testAccAzureRMPostgreSQLServer_basicNinePointSixUpdatedSKU(ri, location) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -271,7 +299,7 @@ resource "azurerm_postgresql_server" "test" { `, rInt, location, rInt) } -func testAccAzureRMPostgreSQLServer_basicNinePointSixUpdated(rInt int, location string) string { +func testAccAzureRMPostgreSQLServer_basicNinePointSixUpdatedPassword(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { name = "acctestRG-%d" @@ -284,8 +312,8 @@ resource "azurerm_postgresql_server" "test" { resource_group_name = "${azurerm_resource_group.test.name}" sku { - name = "B_Gen4_1" - capacity = 1 + name = "B_Gen4_2" + capacity = 2 tier = "Basic" family = "Gen4" } @@ -305,6 +333,39 @@ resource "azurerm_postgresql_server" "test" { `, rInt, location, rInt) } +func testAccAzureRMPostgreSQLServer_basicNinePointSixUpdatedSKU(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_postgresql_server" "test" { + name = "acctestpsqlsvr-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + + sku { + name = "B_Gen4_1" + capacity = 1 + tier = "Basic" + family = "Gen4" + } + + storage_profile { + storage_mb = 51200 + backup_retention_days = 7 + geo_redundant_backup = "Disabled" + } + + administrator_login = "acctestun" + administrator_login_password = "H@Sh1CoR3!" + version = "9.6" + ssl_enforcement = "Enabled" +} +`, rInt, location, rInt) +} + func testAccAzureRMPostgreSQLServer_basicMaxStorage(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" {