commit | e94081f012c368b3e5e5d06faccf67792171a659 | [log] [tgz] |
---|---|---|
author | Cezar Sá Espinola <cezarsa@gmail.com> | Thu Jul 12 05:26:49 2018 -0300 |
committer | Sander van Harmelen <sander@xanzy.io> | Thu Jul 12 10:26:49 2018 +0200 |
tree | 8d80210a47108b12581644388b1e6401c6ad20eb | |
parent | aefe74a0578ebfeb42ddeb0f7edb4ef78484bf88 [diff] |
disk: Read attach field using volume's Virtualmachineid (#38) The `.Attached` field is unreliable, there are situations where cloudstack will return an empty `.Attached` value even if the disk is attached to a VM. So far I've seem this happen when the disk is created alongside with the virtualmachine (deployVirtualMachine called with the `size` attribute) but there may be other situations where this also happens. Checking for the `.Virtualmachineid` field to set the `attach` attribute seems a safer approach as it's always set when the volume is already attached. I came across this when importing an existing infrastructure to terraform by manually creating a state file, the existing VMs have attached volumes that were created with them and these volumes don't have a `.Attached` field. This causes the cloudstack provider to try to attach them to the same VMs they are already attached, raising an error.
Clone repository to: $GOPATH/src/github.com/terraform-providers/terraform-provider-cloudstack
$ mkdir -p $GOPATH/src/github.com/terraform-providers; cd $GOPATH/src/github.com/terraform-providers $ git clone git@github.com:terraform-providers/terraform-provider-cloudstack
Enter the provider directory and build the provider
$ cd $GOPATH/src/github.com/terraform-providers/terraform-provider-cloudstack $ make build
If you wish to work on the provider, you‘ll first need Go installed on your machine (version 1.8+ is required). You’ll also need to correctly setup a GOPATH, as well as adding $GOPATH/bin
to your $PATH
.
To compile the provider, run make build
. This will build the provider and put the provider binary in the $GOPATH/bin
directory.
$ make bin ... $ $GOPATH/bin/terraform-provider-cloudstack ...
In order to test the provider, you can simply run make test
.
$ make test
In order to run the full suite of Acceptance tests, run make testacc
.
Note: Acceptance tests create real resources, and often cost money to run.
$ make testacc