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

Add support for creation_option "Restore" on managed disks (issue #3421) #3598

Merged
merged 2 commits into from
Jun 6, 2019
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
3 changes: 2 additions & 1 deletion azurerm/resource_arm_managed_disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ func resourceArmManagedDisk() *schema.Resource {
string(compute.Empty),
string(compute.FromImage),
string(compute.Import),
string(compute.Restore),
}, true),
},

Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion website/docs/r/managed_disk.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand Down