Skip to content

Commit 2d7ec7e

Browse files
committed
Fix
1 parent 8ee16ca commit 2d7ec7e

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

internal/services/mssql/mssql_virtual_machine_resource.go

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,17 +1265,22 @@ func expandSqlVirtualMachineStorageConfigurationSettings(input []interface{}, te
12651265
}
12661266

12671267
func isTempDbLunsInConfig(d *pluginsdk.ResourceData) bool {
1268-
tempDbLunsInConfig := false
1269-
if rawConfig := d.GetRawConfig().AsValueMap(); rawConfig != nil {
1270-
if sc := rawConfig["storage_configuration"]; !sc.IsNull() && sc.LengthInt() > 0 {
1271-
if td := sc.AsValueSlice()[0].AsValueMap()["temp_db_settings"]; !td.IsNull() && td.LengthInt() > 0 {
1272-
if luns := td.AsValueSlice()[0].AsValueMap()["luns"]; !luns.IsNull() {
1273-
tempDbLunsInConfig = true
1274-
}
1275-
}
1276-
}
1268+
rawConfig := d.GetRawConfig().AsValueMap()
1269+
if rawConfig == nil {
1270+
return false
1271+
}
1272+
1273+
sc := rawConfig["storage_configuration"]
1274+
if sc.IsNull() || sc.LengthInt() == 0 {
1275+
return false
1276+
}
1277+
1278+
td := sc.AsValueSlice()[0].AsValueMap()["temp_db_settings"]
1279+
if td.IsNull() || td.LengthInt() == 0 {
1280+
return false
12771281
}
1278-
return tempDbLunsInConfig
1282+
1283+
return !td.AsValueSlice()[0].AsValueMap()["luns"].IsNull()
12791284
}
12801285

12811286
func flattenSqlVirtualMachineStorageConfigurationSettings(input *sqlvirtualmachines.StorageConfigurationSettings, storageWorkloadType string) []interface{} {

website/docs/r/mssql_virtual_machine.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ The `temp_db_settings` block supports the following:
178178

179179
* `default_file_path` - (Required) The SQL Server default path
180180

181-
* `luns` - (Optional) A list of Logical Unit Numbers for the disks. Setting empty list of leaving blank will result in tempdb being created on the same disks as the user databases.
181+
* `luns` - (Optional) A list of Logical Unit Numbers for the disks. Setting it to empty list or leaving it blank will result in tempdb being created on the same disks as the user databases.
182182

183183
* `data_file_count` - (Optional) The SQL Server default file count. This value defaults to `8`
184184

0 commit comments

Comments
 (0)