Closed hashibot closed 6 years ago
This comment was originally opened by @kbxkb as https://github.com/hashicorp/terraform/issues/3428#issuecomment-152737357. It was migrated here as part of the provider split. The original comment is below.
Facing the same issue. Issue, most probably is this: the directive "virtual_machine" for the azure_data_disk resource is looking for a deployment by that name instead of just looking for a virtual machine. Would like to have this fixed quickly, thanks!
This comment was originally opened by @progre55 as https://github.com/hashicorp/terraform/issues/3428#issuecomment-152779441. It was migrated here as part of the provider split. The original comment is below.
Yup, facing the same problem here.
This comment was originally opened by @kbxkb as https://github.com/hashicorp/terraform/issues/3428#issuecomment-155678868. It was migrated here as part of the provider split. The original comment is below.
Just tested that this problem only exists if you are trying to add the data disk to a VM that was added to a separately created cloud service ("hosted service"). But If you create a VM without creating a separate cloud service first, the add-disk on that VM works. Details are as follows:
When we create a VM without creating a separate cloud service first, 3 things get created (in addition to the VM itself): (a) A cloud service by the same name as the VM (b) A "deployment" by the same name as the VM (c) A "role" as the same name as the VM
Now, The function resourceAzureDataDiskCreate(...) in resource_azure_data_disk.go calls AddDataDisk(...), which is defined here: https://github.com/Azure/azure-sdk-for-go/blob/master/management/virtualmachinedisk/client.go
During that call, it passes the same VM name as 'service', 'deployment' and 'role' parameters. Hence, that piece of code is written assuming that the add-data-disk functionality will always be called upon VM-s which are part of a cloud service by the same name, deployment by the same name and role by the same name (which is the case for VM-s that are created WITHOUT creating a separate cloud service first).
Thus, how to resolve this issue? One easy way is to expand the resource parameters for "azure_data_disk" resource to include (optional) cloud service name, deployment name and role name. Actually, the role name is not needed, as the role name is always the same as the virtual machine name in both methods of instance creation. It may be a good practice, however, to have role name as parameter just to avoid similar situations down the line.
Thus, this problem can be solved inside terraform code (as opposed to waiting for azure-sdk-for-go to be fixed first).
But again, unless this bug gets fixed first (https://github.com/hashicorp/terraform/issues/3568) - just fixing the data disk issue won't buy us much.
This comment was originally opened by @kbxkb as https://github.com/hashicorp/terraform/issues/3428#issuecomment-158590096. It was migrated here as part of the provider split. The original comment is below.
Update - this bug is now fixed on my fork (https://github.com/kbxkb/terraform) (see last two commits above). @rksinghal please feel free to test. You will need corresponding changes in azure-sdk-for-go to compile, see below.
Will submit pull request on master after this pull request on azure-sdk-for-go is accepted: https://github.com/Azure/azure-sdk-for-go/pull/238
This comment was originally opened by @davehodgson as https://github.com/hashicorp/terraform/issues/3428#issuecomment-162263795. It was migrated here as part of the provider split. The original comment is below.
Sorry for an ill informed question @kbxkb I have the same problem with a script just now and updated to the most recent version 0.6.8 of terraform. I haven't got a dev environment set up to build (or probably the expertise to build it correctly).
How does the process work for your fix to be incorporated into the release and any eta for when it happens?
This comment was originally opened by @kbxkb as https://github.com/hashicorp/terraform/issues/3428#issuecomment-162410090. It was migrated here as part of the provider split. The original comment is below.
@davehodgson as far as steps to set up a dev environment for building, you can follow the step by step guide I have in the README.md file on my terraform starter repo: https://github.com/kbxkb/provision-azure-with-terraform. Follow the README, and you should be able to set everything up easily.
My fix for this bug will not be incorporated into the official release unless I submit a pull request and it gets reviewed and accepted.
I am unable to do that unless my changes to underlying "azure-sdk-for-go" repository are accepted, because the fix to this bug in terraform depends on those fixes in azure-sdk-for-go. I have already submitted a pull request for those changes, here: https://github.com/Azure/azure-sdk-for-go/pull/238
Once that is accepted, I will then submit a pull request for my fixes in the terraform repository.
In the meantime, if you plan to use my fix, you have to do the following:
Thanks, hope this helps!
This comment was originally opened by @kbxkb as https://github.com/hashicorp/terraform/issues/3428#issuecomment-162691762. It was migrated here as part of the provider split. The original comment is below.
@davehodgson good news! My changes for azure-sdk-for-go (https://github.com/Azure/azure-sdk-for-go/pull/238) have been accepted and merged. Consequently, I have created a pull request on Terraform to address this specific bug (and another bug as well). Here is the pull request: https://github.com/hashicorp/terraform/pull/4199
So keep an eye on the pull request. Terraform master will have this fix as soon as it is accepted and merged! Thanks!
This comment was originally opened by @kbxkb as https://github.com/hashicorp/terraform/issues/3428#issuecomment-162695401. It was migrated here as part of the provider split. The original comment is below.
Update: A fix for this bug is awaiting to be reviewed, accepted and merged: https://github.com/hashicorp/terraform/pull/4199
This comment was originally opened by @davehodgson as https://github.com/hashicorp/terraform/issues/3428#issuecomment-162697023. It was migrated here as part of the provider split. The original comment is below.
@kbxkb great news, thanls for the update. I had it on my list for later in the week so I'll just watch the pull. Thanks again for sorting it out
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
This issue was originally opened by @rksinghal as hashicorp/terraform#3428. It was migrated here as part of the provider split. The original body of the issue is below.
I am not able to attach data disk to vm. Able to create host service, storage service and vm but not able to attach data disk. Getting following error:
tf file: