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

Support create option for scale set data disks #6744

Merged
merged 1 commit into from
May 4, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
15 changes: 12 additions & 3 deletions azurerm/internal/services/compute/virtual_machine_scale_set.go
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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