From 0cbee2f52d6eea3a812692ed7050264a90c17768 Mon Sep 17 00:00:00 2001 From: Jeff Wong Date: Wed, 27 Jun 2018 17:44:04 -0700 Subject: [PATCH 1/4] allow postgres version 10.0 --- azurerm/resource_arm_postgresql_server.go | 1 + 1 file changed, 1 insertion(+) diff --git a/azurerm/resource_arm_postgresql_server.go b/azurerm/resource_arm_postgresql_server.go index 20efde417992..74e18841145f 100644 --- a/azurerm/resource_arm_postgresql_server.go +++ b/azurerm/resource_arm_postgresql_server.go @@ -122,6 +122,7 @@ func resourceArmPostgreSQLServer() *schema.Resource { ValidateFunc: validation.StringInSlice([]string{ string(postgresql.NineFullStopFive), string(postgresql.NineFullStopSix), + "10.0", }, true), DiffSuppressFunc: ignoreCaseDiffSuppressFunc, }, From 19ca7ebedb9c9f9a9339d580bc5ab9dd9eeea28c Mon Sep 17 00:00:00 2001 From: Jeff Wong Date: Wed, 27 Jun 2018 18:50:27 -0700 Subject: [PATCH 2/4] Add docs, and TODO comment --- CHANGELOG.md | 1 + azurerm/resource_arm_postgresql_server.go | 1 + website/docs/r/postgresql_server.html.markdown | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d0fc2d08205..bcf462ce2e7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ IMPROVEMENTS: * `azurerm_route_table` - adding the disable BGP propagation property [GH-1435] * `azurerm_sql_database` - support for importing from a bacpac backup [GH-972] * `azurerm_virtual_machine` - support for setting the TimeZone on Windows [GH-1265] +* `azurerm_postgresql_server` - adding support for version 10.0 [GH-1457] BUG FIXES: diff --git a/azurerm/resource_arm_postgresql_server.go b/azurerm/resource_arm_postgresql_server.go index 74e18841145f..0853bd68e679 100644 --- a/azurerm/resource_arm_postgresql_server.go +++ b/azurerm/resource_arm_postgresql_server.go @@ -122,6 +122,7 @@ func resourceArmPostgreSQLServer() *schema.Resource { ValidateFunc: validation.StringInSlice([]string{ string(postgresql.NineFullStopFive), string(postgresql.NineFullStopSix), + // TODO: Swap for the azure go api enum once supported. "10.0", }, true), DiffSuppressFunc: ignoreCaseDiffSuppressFunc, diff --git a/website/docs/r/postgresql_server.html.markdown b/website/docs/r/postgresql_server.html.markdown index db3b565f9f74..7371d4163c83 100644 --- a/website/docs/r/postgresql_server.html.markdown +++ b/website/docs/r/postgresql_server.html.markdown @@ -61,7 +61,7 @@ The following arguments are supported: * `administrator_login_password` - (Required) The Password associated with the `administrator_login` for the PostgreSQL Server. -* `version` - (Required) Specifies the version of PostgreSQL to use. Valid values are `9.5` and `9.6`. Changing this forces a new resource to be created. +* `version` - (Required) Specifies the version of PostgreSQL to use. Valid values are `9.5`, `9.6`, and `10.0`. Changing this forces a new resource to be created. * `ssl_enforcement` - (Required) Specifies if SSL should be enforced on connections. Possible values are `Enabled` and `Disabled`. From 773906b3fc9ae99230132d6138af38279bbe3229 Mon Sep 17 00:00:00 2001 From: kt Date: Wed, 27 Jun 2018 22:43:42 -0700 Subject: [PATCH 3/4] Added tests for postgres 10.0 --- .../resource_arm_postgresql_server_test.go | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/azurerm/resource_arm_postgresql_server_test.go b/azurerm/resource_arm_postgresql_server_test.go index 053a5775f478..cd42dbf1014e 100644 --- a/azurerm/resource_arm_postgresql_server_test.go +++ b/azurerm/resource_arm_postgresql_server_test.go @@ -56,6 +56,28 @@ func TestAccAzureRMPostgreSQLServer_basicNinePointSix(t *testing.T) { }) } +func TestAccAzureRMPostgreSQLServer_basicTenPointZero(t *testing.T) { + resourceName := "azurerm_postgresql_server.test" + ri := acctest.RandInt() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMPostgreSQLServerDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMPostgreSQLServer_basicTenPointZero(ri, testLocation()), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMPostgreSQLServerExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "administrator_login", "acctestun"), + resource.TestCheckResourceAttr(resourceName, "version", "10.0"), + resource.TestCheckResourceAttr(resourceName, "ssl_enforcement", "Enabled"), + ), + }, + }, + }) +} + func TestAccAzureRMPostgreSQLServer_basicMaxStorage(t *testing.T) { resourceName := "azurerm_postgresql_server.test" ri := acctest.RandInt() @@ -299,6 +321,39 @@ resource "azurerm_postgresql_server" "test" { `, rInt, location, rInt) } +func testAccAzureRMPostgreSQLServer_basicTenPointZero(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_2" + capacity = 2 + 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 = "10.0" + ssl_enforcement = "Enabled" +} +`, rInt, location, rInt) +} + func testAccAzureRMPostgreSQLServer_basicNinePointSixUpdatedPassword(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { From c7a1f4ddc1d7d44bc67fcdb4ad4d3d67975f3236 Mon Sep 17 00:00:00 2001 From: kt Date: Wed, 27 Jun 2018 22:50:00 -0700 Subject: [PATCH 4/4] Update CHANGELOG.md --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bcf462ce2e7a..8d0fc2d08205 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,6 @@ IMPROVEMENTS: * `azurerm_route_table` - adding the disable BGP propagation property [GH-1435] * `azurerm_sql_database` - support for importing from a bacpac backup [GH-972] * `azurerm_virtual_machine` - support for setting the TimeZone on Windows [GH-1265] -* `azurerm_postgresql_server` - adding support for version 10.0 [GH-1457] BUG FIXES: