Skip to content

Commit

Permalink
Merge pull request #7307 from yupwei68/wyp-mysql-server-ssl
Browse files Browse the repository at this point in the history
  • Loading branch information
jackofallops authored Jul 13, 2020
2 parents 1e37be8 + bca369e commit 2724b4a
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 39 deletions.
1 change: 1 addition & 0 deletions azurerm/internal/services/mysql/mysql_server_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,7 @@ func resourceArmMySqlServerUpdate(d *schema.ResourceData, meta interface{}) erro
AdministratorLoginPassword: utils.String(d.Get("administrator_login_password").(string)),
PublicNetworkAccess: publicAccess,
SslEnforcement: ssl,
MinimalTLSVersion: mysql.MinimalTLSVersionEnum(d.Get("ssl_minimal_tls_version_enforced").(string)),
StorageProfile: storageProfile,
Version: mysql.ServerVersion(d.Get("version").(string)),
},
Expand Down
84 changes: 45 additions & 39 deletions azurerm/internal/services/mysql/tests/mysql_server_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,15 +406,16 @@ resource "azurerm_resource_group" "test" {
}
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"
administrator_login = "acctestun"
administrator_login_password = "H@Sh1CoR3!"
ssl_enforcement_enabled = true
storage_mb = 51200
version = "%s"
name = "acctestmysqlsvr-%d"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
sku_name = "GP_Gen5_2"
administrator_login = "acctestun"
administrator_login_password = "H@Sh1CoR3!"
ssl_enforcement_enabled = true
ssl_minimal_tls_version_enforced = "TLS1_1"
storage_mb = 51200
version = "%s"
}
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, version)
}
Expand All @@ -441,10 +442,11 @@ resource "azurerm_mysql_server" "test" {
storage_mb = 51200
}
administrator_login = "acctestun"
administrator_login_password = "H@Sh1CoR3!"
version = "%s"
ssl_enforcement_enabled = true
administrator_login = "acctestun"
administrator_login_password = "H@Sh1CoR3!"
version = "%s"
ssl_enforcement_enabled = true
ssl_minimal_tls_version_enforced = "TLS1_1"
}
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, version)
}
Expand All @@ -461,19 +463,20 @@ resource "azurerm_resource_group" "test" {
}
resource "azurerm_mysql_server" "test" {
name = "acctestmysqlsvr-%[1]d"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
sku_name = "GP_Gen5_2"
administrator_login = "acctestun"
administrator_login_password = "H@Sh1CoR3!"
auto_grow_enabled = true
backup_retention_days = 7
create_mode = "Default"
geo_redundant_backup_enabled = false
ssl_enforcement_enabled = true
storage_mb = 51200
version = "%[3]s"
name = "acctestmysqlsvr-%[1]d"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
sku_name = "GP_Gen5_2"
administrator_login = "acctestun"
administrator_login_password = "H@Sh1CoR3!"
auto_grow_enabled = true
backup_retention_days = 7
create_mode = "Default"
geo_redundant_backup_enabled = false
ssl_enforcement_enabled = true
ssl_minimal_tls_version_enforced = "TLS1_2"
storage_mb = 51200
version = "%[3]s"
threat_detection_policy {
enabled = true
disabled_alerts = ["Sql_Injection", "Data_Exfiltration"]
Expand Down Expand Up @@ -515,7 +518,7 @@ resource "azurerm_mysql_server" "test" {
backup_retention_days = 7
create_mode = "Default"
geo_redundant_backup_enabled = false
ssl_enforcement_enabled = true
ssl_enforcement_enabled = false
storage_mb = 51200
version = "%[3]s"
threat_detection_policy {
Expand Down Expand Up @@ -556,10 +559,11 @@ resource "azurerm_mysql_server" "test" {
auto_grow = "Enabled"
}
administrator_login = "acctestun"
administrator_login_password = "H@Sh1CoR3!"
version = "%s"
ssl_enforcement_enabled = true
administrator_login = "acctestun"
administrator_login_password = "H@Sh1CoR3!"
version = "%s"
ssl_enforcement_enabled = true
ssl_minimal_tls_version_enforced = "TLS1_2"
}
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, version)
}
Expand Down Expand Up @@ -652,9 +656,10 @@ resource "azurerm_mysql_server" "replica" {
version = "%s"
storage_mb = 51200
create_mode = "Replica"
creation_source_server_id = azurerm_mysql_server.test.id
ssl_enforcement_enabled = true
create_mode = "Replica"
creation_source_server_id = azurerm_mysql_server.test.id
ssl_enforcement_enabled = true
ssl_minimal_tls_version_enforced = "TLS1_1"
}
`, testAccAzureRMMySQLServer_basic(data, version), data.RandomInteger, version)
}
Expand All @@ -670,11 +675,12 @@ resource "azurerm_mysql_server" "restore" {
sku_name = "GP_Gen5_2"
version = "%s"
create_mode = "PointInTimeRestore"
creation_source_server_id = azurerm_mysql_server.test.id
restore_point_in_time = "%s"
ssl_enforcement_enabled = true
storage_mb = 51200
create_mode = "PointInTimeRestore"
creation_source_server_id = azurerm_mysql_server.test.id
restore_point_in_time = "%s"
ssl_enforcement_enabled = true
ssl_minimal_tls_version_enforced = "TLS1_1"
storage_mb = 51200
}
`, testAccAzureRMMySQLServer_basic(data, version), data.RandomInteger, version, restoreTime)
}

0 comments on commit 2724b4a

Please sign in to comment.