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

vsphere additional disk datastore selection #4

Closed
hashibot opened this issue Jun 13, 2017 · 7 comments
Closed

vsphere additional disk datastore selection #4

hashibot opened this issue Jun 13, 2017 · 7 comments
Labels
bug Type: Bug

Comments

@hashibot
Copy link

This issue was originally opened by @leonkyneur as hashicorp/terraform#3870. It was migrated here as part of the provider split. The original body of the issue is below.


I'm trying to create a machine in vsphere - so far all works however I then went to add additional disks (vmdk) to the machine and set a specific datastore to target this new disk on.

Result was it created the new disk in the first assign disks (where template was deployed).

e.g.

resource "vsphere_virtual_machine" "oss-mailstore02" {
   name = "mailstore02"
   datacenter = "DSS"
   cluster = "ALT/Apps"
   disk {
      datastore = "datastore-01"
      template = "CentOS 7.1-x86_64 - Min"
   }
   disk {
       datastore = "datastore-02"
       size = 20
   }
   vcpu = 2
   time_zone = "Australia/Sydney"
   memory = 8196
   dns_servers = ["8.8.8.8","8.8.4.4"]
   dns_suffixes = ["mydomain.com"]
   domain = "mydomain.com"
   network_interface {
     label = "serverfarm"
     ip_address = "10.99.1.2"
     subnet_mask = "255.255.224.0"  
   }
}

The result is disk I targeted to datastore-02 is created on datastore-01, nothing is hinted in apply / plan that this will happen.

vsphere_virtual_machine.oss-mailstore02
cluster:                         "" => "ALT/Apps"
datacenter:                      "" => "DSS"
disk.#:                          "" => "3"
disk.0.datastore:                "" => "datastore-01"
disk.0.template:                 "" => "Templates/CentOS 7.1-x86_64 - Min"
disk.1.datastore:                "" => "datastore-02"
disk.1.size:                     "" => "20"
dns_servers.#:                   "" => "2"
dns_servers.0:                   "" => "8.8.8.8"
dns_servers.1:                   "" => "8.8.4.4"
dns_suffixes.#:                  "" => "1"
dns_suffixes.0:                  "" => "mydomain.com"
domain:                          "" => "mydomain.com"
gateway:                         "" => "203.24.100.1"
memory:                          "" => "8196"
name:                            "" => "mailstore02"
network_interface.#:             "" => "1"
network_interface.0.ip_address:  "" => "10.99.1.2"
network_interface.0.label:       "" => "serverfarm"
network_interface.0.subnet_mask: "" => "255.255.224.0"
time_zone:                       "" => "Australia/Sydney"

using vsphere provider from 0.6.6:
$ terraform version
Terraform v0.6.6

Also noted when I also just wanted to add a new disk - it destroyed the entire machine and re-created it with the disk - desired would be just to add the disk.

@hashibot hashibot added the bug Type: Bug label Jun 13, 2017
@hashibot
Copy link
Author

This comment was originally opened by @jen20 as hashicorp/terraform#3870 (comment). It was migrated here as part of the provider split. The original comment is below.


Hi @leonkyneur! I'm not terribly familiar with the underlying API for vSphere to know offhand whether the destroy and create is necessary to add a disk, though it sounds unlikely that this is the case.

The disk order here is interesting though - given the current schema, the ordering is non-deterministic as the disks are a set rather than an array or a list. In the AWS provider the root device (which sounds like the first one in this case) is called out explicitly via a separate block. It may be worth investigating whether that approach is necessary here.

I've tagged this as a bug for now though - thanks for reporting!

@hashibot
Copy link
Author

This comment was originally opened by @chrislovecnm as hashicorp/terraform#3870 (comment). It was migrated here as part of the provider split. The original comment is below.


@jen20 A dev needs to look at it :)

@hashibot
Copy link
Author

This comment was originally opened by @chrislovecnm as hashicorp/terraform#3870 (comment). It was migrated here as part of the provider split. The original comment is below.


@leonkyneur this should be addressed in the dev HEAD branch. If you are able to test, please let me know.

krzkowalczyk pushed a commit to krzkowalczyk/terraform-provider-vsphere that referenced this issue Jul 14, 2017
krzkowalczyk pushed a commit to krzkowalczyk/terraform-provider-vsphere that referenced this issue Jul 14, 2017
@andreabolandrina
Copy link

Hi,

I'm using Terraform v0.9.11 and I'm experiencing this too.
Is the fix going to get merged into Terraform v0.9.12 maybe?

Thanks!

@surajsub
Copy link

Anybody know if this issue was fixed in 0.10.x version ? I'm having this issue as well

@vancluever
Copy link
Contributor

Hey @surajsub, I would imagine, more than likely, that this is still an issue. However, with the work going on in #244, this will be solved as this is one of the very specific things that we are targeting in the new VM resource. The ability to place different disks on different datastores has been specifically added and tested, in addition to the ability to use storage vMotion to migrate a single disk only and pin a disk to a specific datastore.

There is documentation on how to do these things in the virtual machine migration section of the new docs - keep in mind the docs are a WIP and not all of the information there is up to date just yet as per some of the more recent developments on #244 - namely the virtual disk diff UX is much better now.

Thanks!

@vancluever
Copy link
Contributor

This has been fixed with the new version of the resource (additional disks can be added to a clone in pretty much the way you would expect, no special work necessary).

stobias123 pushed a commit to stobias123/terraform-provider-vsphere that referenced this issue Dec 9, 2019
Adding license banner to go-bigip
stobias123 pushed a commit to stobias123/terraform-provider-vsphere that referenced this issue Dec 9, 2019
Adding terraform bigip provider plugin
@ghost ghost locked and limited conversation to collaborators Apr 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Type: Bug
Projects
None yet
Development

No branches or pull requests

4 participants