diff --git a/internal/services/mysql/mysql_flexible_server_data_source.go b/internal/services/mysql/mysql_flexible_server_data_source.go index 871b84757e2d..3dd9189bcbb4 100644 --- a/internal/services/mysql/mysql_flexible_server_data_source.go +++ b/internal/services/mysql/mysql_flexible_server_data_source.go @@ -130,6 +130,11 @@ func dataSourceMysqlFlexibleServer() *pluginsdk.Resource { Computed: true, }, + "iops_auto_scaling": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + "iops": { Type: pluginsdk.TypeInt, Computed: true, @@ -255,6 +260,7 @@ func flattenDataSourceArmServerStorage(storage *servers.Storage) []interface{} { "size_gb": size, "iops": iops, "auto_grow_enabled": *storage.AutoGrow == servers.EnableStatusEnumEnabled, + "iops_auto_scaling": *storage.AutoIoScaling == servers.EnableStatusEnumEnabled, }, } } diff --git a/internal/services/mysql/mysql_flexible_server_resource.go b/internal/services/mysql/mysql_flexible_server_resource.go index 99464198f07a..5907b63d7612 100644 --- a/internal/services/mysql/mysql_flexible_server_resource.go +++ b/internal/services/mysql/mysql_flexible_server_resource.go @@ -254,6 +254,12 @@ func resourceMysqlFlexibleServer() *pluginsdk.Resource { Default: true, }, + "iops_auto_scaling": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, + "iops": { Type: pluginsdk.TypeInt, Optional: true, @@ -760,12 +766,18 @@ func expandArmServerStorage(inputs []interface{}) *servers.Storage { input := inputs[0].(map[string]interface{}) autoGrow := servers.EnableStatusEnumDisabled + iopsAutoScaling := servers.EnableStatusEnumDisabled if v := input["auto_grow_enabled"].(bool); v { autoGrow = servers.EnableStatusEnumEnabled } + if v := input["iops_auto_scaling"].(bool); v { + iopsAutoScaling = servers.EnableStatusEnumEnabled + } + storage := servers.Storage{ - AutoGrow: &autoGrow, + AutoGrow: &autoGrow, + AutoIoScaling: &iopsAutoScaling, } if v := input["size_gb"].(int); v != 0 { @@ -798,6 +810,7 @@ func flattenArmServerStorage(storage *servers.Storage) []interface{} { "size_gb": size, "iops": iops, "auto_grow_enabled": *storage.AutoGrow == servers.EnableStatusEnumEnabled, + "iops_auto_scaling": *storage.AutoIoScaling == servers.EnableStatusEnumEnabled, }, } } diff --git a/internal/services/mysql/mysql_flexible_server_resource_test.go b/internal/services/mysql/mysql_flexible_server_resource_test.go index a563427a9590..f62fe074bf23 100644 --- a/internal/services/mysql/mysql_flexible_server_resource_test.go +++ b/internal/services/mysql/mysql_flexible_server_resource_test.go @@ -704,6 +704,7 @@ resource "azurerm_mysql_flexible_server" "test" { size_gb = 32 iops = 400 auto_grow_enabled = false + iops_auto_scaling = false } delegated_subnet_id = azurerm_subnet.test.id @@ -989,9 +990,10 @@ resource "azurerm_mysql_flexible_server" "test" { size_gb = %d iops = %d auto_grow_enabled = %t + iops_auto_scaling = %t } } -`, r.template(data), data.RandomInteger, sizeGB, iops, enabled) +`, r.template(data), data.RandomInteger, sizeGB, iops, enabled, enabled) } func (r MySqlFlexibleServerResource) failover(data acceptance.TestData, primaryZone string, standbyZone string) string { diff --git a/website/docs/d/mysql_flexible_server.html.markdown b/website/docs/d/mysql_flexible_server.html.markdown index 4290c328aa1f..2a8b21ab7e47 100644 --- a/website/docs/d/mysql_flexible_server.html.markdown +++ b/website/docs/d/mysql_flexible_server.html.markdown @@ -93,6 +93,8 @@ A `storage` block exports the following: * `auto_grow_enabled` - Is Storage Auto Grow enabled? +* `iops_auto_scaling` - Is Iops Auto Scaling enabled? + * `iops` - The storage IOPS of the MySQL Flexible Server. * `size_gb` - The max storage allowed for the MySQL Flexible Server. diff --git a/website/docs/r/mysql_flexible_server.html.markdown b/website/docs/r/mysql_flexible_server.html.markdown index 6d098f1c8a23..a8821b2fbf95 100644 --- a/website/docs/r/mysql_flexible_server.html.markdown +++ b/website/docs/r/mysql_flexible_server.html.markdown @@ -189,6 +189,8 @@ A `storage` block supports the following: * `auto_grow_enabled` - (Optional) Should Storage Auto Grow be enabled? Defaults to `true`. +* `iops_auto_scaling` - (Optional) Should Iops Auto Scaling be enabled? Defaults to `false`. + * `iops` - (Optional) The storage IOPS for the MySQL Flexible Server. Possible values are between `360` and `20000`. * `size_gb` - (Optional) The max storage allowed for the MySQL Flexible Server. Possible values are between `20` and `16384`.