From 20efa4c760b90020421a18be7ab05b98f1f5110d Mon Sep 17 00:00:00 2001 From: Sean Nixon Date: Tue, 4 Jun 2019 22:57:46 -0500 Subject: [PATCH 1/2] Add Restore as valid createOption for managed disks --- azurerm/resource_arm_managed_disk.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azurerm/resource_arm_managed_disk.go b/azurerm/resource_arm_managed_disk.go index b2997cc09f9c..38b3954cbfa6 100644 --- a/azurerm/resource_arm_managed_disk.go +++ b/azurerm/resource_arm_managed_disk.go @@ -60,6 +60,7 @@ func resourceArmManagedDisk() *schema.Resource { string(compute.Empty), string(compute.FromImage), string(compute.Import), + string(compute.Restore), }, true), }, @@ -183,7 +184,7 @@ func resourceArmManagedDiskCreateUpdate(d *schema.ResourceData, meta interface{} } else { return fmt.Errorf("[ERROR] source_uri must be specified when create_option is `%s`", compute.Import) } - } else if strings.EqualFold(createOption, string(compute.Copy)) { + } else if strings.EqualFold(createOption, string(compute.Copy)) || strings.EqualFold(createOption, string(compute.Restore)) { if sourceResourceId := d.Get("source_resource_id").(string); sourceResourceId != "" { createDisk.CreationData.SourceResourceID = &sourceResourceId } else { From da991d645e8fc6593bf195a0d643e571ccac523b Mon Sep 17 00:00:00 2001 From: Sean Nixon Date: Tue, 4 Jun 2019 23:18:02 -0500 Subject: [PATCH 2/2] Update documentation for managed disk Restore option --- website/docs/r/managed_disk.html.markdown | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/website/docs/r/managed_disk.html.markdown b/website/docs/r/managed_disk.html.markdown index 9b235d3b260f..0dcdea820802 100644 --- a/website/docs/r/managed_disk.html.markdown +++ b/website/docs/r/managed_disk.html.markdown @@ -89,10 +89,12 @@ The following arguments are supported: * `Empty` - Create an empty managed disk. * `Copy` - Copy an existing managed disk or snapshot (specified with `source_resource_id`). * `FromImage` - Copy a Platform Image (specified with `image_reference_id`) + * `Restore` - Set by Azure Backup or Site Recovery on a restored disk (specified with `source_resource_id`). * `source_uri` - (Optional) URI to a valid VHD file to be used when `create_option` is `Import`. -* `source_resource_id` - (Optional) ID of an existing managed disk to copy when `create_option` is `Copy`. +* `source_resource_id` - (Optional) ID of an existing managed disk to copy `create_option` is `Copy` + or the recovery point to restore when `create_option` is `Restore` * `image_reference_id` - (Optional) ID of an existing platform/marketplace disk image to copy when `create_option` is `FromImage`.