-
Notifications
You must be signed in to change notification settings - Fork 171
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
Disk failed to be exported, error says it does not exist (it does) #498
Comments
@825i I've tried to create a VM with a data disk attached, and the tool can successfully export them. Would you please try run If this still gives the same error, then could you try to check the name of the disk appears in the VM's API model and in the resource id are case sensitively identical, as the provider has the following logic when reading (during import) the data disk attachment: virtualMachine, err := client.Get(ctx, id.ResourceGroup, id.VirtualMachineName, "")
if err != nil {
if utils.ResponseWasNotFound(virtualMachine.Response) {
log.Printf("[DEBUG] Virtual Machine %q was not found (Resource Group %q) therefore Data Disk Attachment cannot exist - removing from state", id.VirtualMachineName, id.ResourceGroup)
d.SetId("")
return nil
}
return fmt.Errorf("loading Virtual Machine %q : %+v", id.String(), err)
}
var disk *compute.DataDisk
if profile := virtualMachine.StorageProfile; profile != nil {
if dataDisks := profile.DataDisks; dataDisks != nil {
for _, dataDisk := range *dataDisks {
// since this field isn't (and shouldn't be) case-sensitive; we're deliberately not using `strings.EqualFold`
if *dataDisk.Name == id.Name {
disk = &dataDisk
break
}
}
}
} |
I have no idea how to use
EDIT: Ok, now I think I understand what the problem was (maybe). There is no VM called I'll try and learn a bit how to use |
Ok so I couldn't really get anywhere with Terraform import but it does seem that the disk was scoped in anyway during the initial run. However, it was given a different resource number for some reason. Instead of res-4 it became res-8. No idea why. So the error message was actually a false positive. |
Please note that this is not the |
I tried to export a resource group and 74/75 resources completed successfully which is amazing. However, one disk I never suspected would be a problem, has failed. The error message below also doesn't explain much, as it is also wrong.
This resource absolutely does exist, as shown below:
Any idea why it failed to be recognized and exported? This should have been business as usual.
I'm using:
aztfexport version v0.14.0(fb772ba)
and:
Terraform v1.7.0 on linux_amd64
with:
I found #440
and tried the instructions there to list the resources via AzureCLI first. Here is the failed
appdisk0
resource listed:I tried also
--use-azure-cli-cred
and this too: #440 (comment)Sadly neither have helped with this disk.
Could someone please suggest some more things to try?
The text was updated successfully, but these errors were encountered: