hashicorp / terraform-provider-azure-classic

Terraform Azure Classic (Service Management) provider
https://www.terraform.io/docs/providers/azure/
Mozilla Public License 2.0
3 stars 11 forks source link

A lease conflict occurs while using a custom image #30

Closed tombuildsstuff closed 6 years ago

tombuildsstuff commented 7 years ago

Migrating this issue over to the Azure (Service Management) Provider repository as it was mis-tagged. This issue was originally opened by @nikitashalnov as hashicorp/terraform#11941. The original body of the issue is below.


Hello.

I just tried to play with terraform and create a test VM with the Linux Debian Jessie OS from a custom image. The custom image was captured from existed virtual machine by Azure Old Portal (https://manage.windowsazure.com).

But I'm getting an error:

I see that this image is in LEASE STATE Leased and in LEASE STATUS Locked. But this affects noting, because I can create a VM by Azure Cli as usual: azure vm create mretailer-test-service jessie-template-2 nikita -l "West Europe" --ssh --no-ssh-password --ssh-cert /home/n.shalnov/azure_ssh.pem -w net -z ExtraSmall -v -n mretailer-test-service -b subnet-1 -S 10.11.11.68

Terraform successfully creates Cloud Service (resource azure_hosted_service) and fails on stage of creating a VM.

Here is more info.

Terraform Version

Terraform v0.8.6

Affected Resource

azure_instance

Terraform Configuration Files

# Configure the Azure Provider
provider "azure" {
  publish_settings = "${file("Azure.publishsettings")}"
  subscription_id = "XXXX"
}

resource "azure_hosted_service" "mret-test-service" {
    name = "mret-test-service"
    location = "West Europe"
    ephemeral_contents = false
    description = "Hosted service created by Terraform."
    label = "mr-test-01"
}

resource "azure_instance" "test-web-server" {
    name = "mret-test"
    hosted_service_name = "${azure_hosted_service.mret-test-service.name}"
    storage_service_name = "storage-account"
    image = "jessie-template-2"
    size = "ExtraSmall"
    location = "West Europe"
    username = "nikita"
    password = "XXX"
    virtual_network = "net"
    subnet = "subnet-1"
}

There is my image:

n.shalnov@nikita-backupVB:~/azure/terraform$ azure storage blob show -a storage-account vm-images jessie-template-2.vhd -k {KEY}
info:    Executing command storage blob show
+ Getting storage blob information                                             
data:    Property       Value                                 
data:    -------------  --------------------------------------
data:    container      vm-images                             
data:    name           jessie-template-2.vhd                 
data:    blobType       PageBlob                              
data:    contentLength  32212255232                           
data:    contentType    application/octet-stream Charset=UTF-8
data:    contentMD5     undefined                             
info:    storage blob show command OK

n.shalnov@nikita-backupVB:~/azure/terraform$ azure vm image show jessie-template-2
info:    Executing command vm image show
+ Fetching VM image                                                            
data:    category "User"
data:    label "jessie-template-2"
data:    location 0 "West Europe"
data:    logicalSizeInGB 30
data:    mediaLinkUri "https://storage-account.blob.core.windows.net/vm-images/jessie-template-2.vhd"
data:    name "jessie-template-2"
data:    operatingSystemType "Linux"
data:    isPremium false
data:    iOType "Standard"
info:    vm image show command OK

It looks like a bug or maybe I'm wrong. If you need more information and something the written you didn't understand, please just tell me.

vancluever commented 6 years ago

Hello!

Thank you for opening this issue and participating in the discussion. Today (December 19, 2017) we’ve announced the deprecation and archival of the Azure Classic Provider. Matching Microsoft’s commitment to gradually remove access to Azure Classic (or Service Management) which is outlined in this blog post, we are closing all open PR's and Issues here. This repository will remain available here on GitHub, but in an archived state, and no longer receiving support or new releases.

The Azure (Resource Manager) Provider remains fully supported and is our recommended approach for managing Azure with Terraform. More information about this process is available in the blog post linked above.

Thanks! The Terraform Team