Skip to content

Commit

Permalink
Merge pull request #5019 from aqche/support_mysql_server_ver_8.0
Browse files Browse the repository at this point in the history
azurerm_mysql_server - add support for version 8.0
  • Loading branch information
tombuildsstuff authored Nov 28, 2019
2 parents c8a520f + 9ac2842 commit 1ae4792
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 1 deletion.
1 change: 1 addition & 0 deletions azurerm/resource_arm_mysql_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ func resourceArmMySqlServer() *schema.Resource {
ValidateFunc: validation.StringInSlice([]string{
string(mysql.FiveFullStopSix),
string(mysql.FiveFullStopSeven),
"8.0", //TODO: Update to EightFullStopZero ServerVersion constant when available in Azure Go SDK https://github.com/Azure/azure-rest-api-specs/pull/7864
}, true),
DiffSuppressFunc: suppress.CaseDifference,
ForceNew: true,
Expand Down
60 changes: 60 additions & 0 deletions azurerm/resource_arm_mysql_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,33 @@ func TestAccAzureRMMySQLServer_basicFiveSeven(t *testing.T) {
})
}

func TestAccAzureRMMySQLServer_basicEightZero(t *testing.T) {
resourceName := "azurerm_mysql_server.test"
ri := tf.AccRandTimeInt()

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMMySQLServerDestroy,
Steps: []resource.TestStep{
{
Config: testAccAzureRMMySQLServer_basicEightZero(ri, testLocation()),
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMMySQLServerExists(resourceName),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"administrator_login_password", // not returned as sensitive
},
},
},
})
}

func TestAccAzureRMMySqlServer_generalPurpose(t *testing.T) {
resourceName := "azurerm_mysql_server.test"
ri := tf.AccRandTimeInt()
Expand Down Expand Up @@ -391,6 +418,39 @@ resource "azurerm_mysql_server" "test" {
`, rInt, location, rInt)
}

func testAccAzureRMMySQLServer_basicEightZero(rInt int, location string) string {
return fmt.Sprintf(`
resource "azurerm_resource_group" "test" {
name = "acctestRG-%d"
location = "%s"
}
resource "azurerm_mysql_server" "test" {
name = "acctestmysqlsvr-%d"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
sku {
name = "GP_Gen5_2"
capacity = 2
tier = "GeneralPurpose"
family = "Gen5"
}
storage_profile {
storage_mb = 51200
backup_retention_days = 7
geo_redundant_backup = "Disabled"
}
administrator_login = "acctestun"
administrator_login_password = "H@Sh1CoR3!"
version = "8.0"
ssl_enforcement = "Enabled"
}
`, rInt, location, rInt)
}

func testAccAzureRMMySQLServer_requiresImport(rInt int, location string) string {
return fmt.Sprintf(`
%s
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/mysql_server.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ The following arguments are supported:

* `administrator_login_password` - (Required) The Password associated with the `administrator_login` for the MySQL Server.

* `version` - (Required) Specifies the version of MySQL to use. Valid values are `5.6` and `5.7`. Changing this forces a new resource to be created.
* `version` - (Required) Specifies the version of MySQL to use. Valid values are `5.6`, `5.7`, and `8.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`.

Expand Down

0 comments on commit 1ae4792

Please sign in to comment.