Skip to content

Commit

Permalink
Merge pull request #6744 from clearbank/data_disk_create_option
Browse files Browse the repository at this point in the history
Support create option for scale set data disks
  • Loading branch information
tombuildsstuff committed May 4, 2020
2 parents 9853ea5 + 7707160 commit 2e5b100
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
15 changes: 12 additions & 3 deletions azurerm/internal/services/compute/virtual_machine_scale_set.go
Expand Up @@ -730,6 +730,16 @@ func VirtualMachineScaleSetDataDiskSchema() *schema.Schema {
}, false),
},

"create_option": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{
string(compute.DiskCreateOptionTypesEmpty),
string(compute.DiskCreateOptionTypesFromImage),
}, false),
Default: string(compute.DiskCreateOptionTypesEmpty),
},

"disk_encryption_set_id": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -787,9 +797,7 @@ func ExpandVirtualMachineScaleSetDataDisk(input []interface{}) *[]compute.Virtua
StorageAccountType: compute.StorageAccountTypes(raw["storage_account_type"].(string)),
},
WriteAcceleratorEnabled: utils.Bool(raw["write_accelerator_enabled"].(bool)),

// AFAIK this is required to be Empty
CreateOption: compute.DiskCreateOptionTypesEmpty,
CreateOption: compute.DiskCreateOptionTypes(raw["create_option"].(string)),
}

if id := raw["disk_encryption_set_id"].(string); id != "" {
Expand Down Expand Up @@ -838,6 +846,7 @@ func FlattenVirtualMachineScaleSetDataDisk(input *[]compute.VirtualMachineScaleS

output = append(output, map[string]interface{}{
"caching": string(v.Caching),
"create_option": string(v.CreateOption),
"lun": lun,
"disk_encryption_set_id": diskEncryptionSetId,
"disk_size_gb": diskSizeGb,
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/linux_virtual_machine_scale_set.html.markdown
Expand Up @@ -246,6 +246,8 @@ A `data_disk` block supports the following:

* `caching` - (Required) The type of Caching which should be used for this Data Disk. Possible values are `None`, `ReadOnly` and `ReadWrite`.

* `create_option` - (Optional) The create option which should be used for this Data Disk. Possible values are `Empty` and `FromImage`. Defaults to `Empty`. (`FromImage` should only be used if the source image includes data disks).

* `disk_size_gb` - (Required) The size of the Data Disk which should be created.

* `lun` - (Required) The Logical Unit Number of the Data Disk, which must be unique within the Virtual Machine.
Expand Down
Expand Up @@ -238,6 +238,8 @@ A `data_disk` block supports the following:

* `caching` - (Required) The type of Caching which should be used for this Data Disk. Possible values are `None`, `ReadOnly` and `ReadWrite`.

* `create_option` - (Optional) The create option which should be used for this Data Disk. Possible values are `Empty` and `FromImage`. Defaults to `Empty`. (`FromImage` should only be used if the source image includes data disks).

* `disk_size_gb` - (Required) The size of the Data Disk which should be created.

* `lun` - (Required) The Logical Unit Number of the Data Disk, which must be unique within the Virtual Machine.
Expand Down

0 comments on commit 2e5b100

Please sign in to comment.