provider/vsphere: Add migration for `enable_disk_uuid` on

`virtual_machine`

Fixes #7275 - a state migration was missed when `enable_disk_uuid` was
merged

```
make testacc TEST=./builtin/providers/vsphere
TESTARGS='-run=TestVSphereVirtualMachineMigrateState'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /vendor/)
TF_ACC=1 go test ./builtin/providers/vsphere -v
-run=TestVSphereVirtualMachineMigrateState -timeout 120m
=== RUN   TestVSphereVirtualMachineMigrateState
--- PASS: TestVSphereVirtualMachineMigrateState (0.00s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/vsphere
0.018s
```
This commit is contained in:
stack72 2016-06-22 23:43:44 +01:00
parent 004cec60b3
commit 74ea8697de
2 changed files with 11 additions and 0 deletions

View File

@ -40,6 +40,10 @@ func migrateVSphereVirtualMachineStateV0toV1(is *terraform.InstanceState) (*terr
is.Attributes["skip_customization"] = "false"
}
if is.Attributes["enable_disk_uuid"] == "" {
is.Attributes["enable_disk_uuid"] = "false"
}
for k, _ := range is.Attributes {
if strings.HasPrefix(k, "disk.") && strings.HasSuffix(k, ".size") {
diskParts := strings.Split(k, ".")

View File

@ -20,6 +20,13 @@ func TestVSphereVirtualMachineMigrateState(t *testing.T) {
"skip_customization": "false",
},
},
"enable_disk_uuid before 0.6.16": {
StateVersion: 0,
Attributes: map[string]string{},
Expected: map[string]string{
"enable_disk_uuid": "false",
},
},
"disk controller_type": {
StateVersion: 0,
Attributes: map[string]string{