Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurerm_mysql_server - add support for version 8.0 #5019

Merged
merged 3 commits into from
Nov 28, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
tombuildsstuff marked this conversation as resolved.
Show resolved Hide resolved
}, 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