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

Conversation

sean-nixon
Copy link
Contributor

@sean-nixon sean-nixon commented Jun 5, 2019

First time contributing and go rookie so I'm open to feedback and let me know if I'm violating any guidelines.

Took a stab at issue #3421. The documentation doesn't really document the Restore option other than that it is a valid value for createOption. Based on this issue and my own experience in our Azure environment, however, this gets set when a disk is restored from backup or created during failover in Azure Site Recovery. Along with it, the sourceResourceId gets set.

For reference, below is some sanitized output from the Azure CLI of a disk created during Site Recovery failover (Azure to Azure):

az disk show -g rg -n disk --query creationData
{
  "createOption": "Restore",
  "imageReference": null,
  "sourceResourceId": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/rg/providers/Microsoft.Compute/disks/disk-ASRReplica/bookmark/16db43c8-f886-48df-934a-3437e5f4f75c",
  "sourceUri": null,
  "storageAccountId": null
}

Acceptance tests are difficult for this one. I'm not sure if it is actually possible to create a disk using the "Restore" option using the normal disk API since I cannot find IDs in that format anywhere within Azure and it is not documented in the API docs (https://docs.microsoft.com/de-de/azure/templates/microsoft.compute/2018-09-30/disks#creationdata-object).

Fixes #3421

Copy link
Member

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks for this @sean-nixon

@tombuildsstuff
Copy link
Member

@sean-nixon thanks for this PR - as you've mentioned acceptance tests are difficult for this one, since this is just adding another value to the validation I think we should be good without these here (since we can see the CLI returns them) 👍

@tombuildsstuff tombuildsstuff merged commit 9985c3e into hashicorp:master Jun 6, 2019
tombuildsstuff added a commit that referenced this pull request Jun 6, 2019
@sean-nixon sean-nixon deleted the datadisk_restore branch June 6, 2019 14:29
@ghost
Copy link

ghost commented Jun 20, 2019

This has been released in version 1.30.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
	version = "~> 1.30.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Jul 6, 2019

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@hashicorp hashicorp locked and limited conversation to collaborators Jul 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

managed_disk - does not allow create_option = "Restore"
2 participants