From 4daaacd2923c428f2a7d858720ac9c57588df7f4 Mon Sep 17 00:00:00 2001 From: Joe Topjian Date: Thu, 14 May 2015 02:06:21 +0000 Subject: [PATCH] Minor volume fixes This commit follows suit of #1897 by fixing volume-related parameters which allow the volume attach acceptance test to work. It also re-enables the volume attach test. --- .../openstack/resource_openstack_blockstorage_volume_v1.go | 1 + .../openstack/resource_openstack_compute_instance_v2.go | 2 -- .../openstack/resource_openstack_compute_instance_v2_test.go | 3 ++- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/builtin/providers/openstack/resource_openstack_blockstorage_volume_v1.go b/builtin/providers/openstack/resource_openstack_blockstorage_volume_v1.go index 97a7325c7..2da5ee8bf 100644 --- a/builtin/providers/openstack/resource_openstack_blockstorage_volume_v1.go +++ b/builtin/providers/openstack/resource_openstack_blockstorage_volume_v1.go @@ -53,6 +53,7 @@ func resourceBlockStorageVolumeV1() *schema.Resource { Type: schema.TypeMap, Optional: true, ForceNew: false, + Computed: true, }, "snapshot_id": &schema.Schema{ Type: schema.TypeString, diff --git a/builtin/providers/openstack/resource_openstack_compute_instance_v2.go b/builtin/providers/openstack/resource_openstack_compute_instance_v2.go index 02dafe5ae..44fca923f 100644 --- a/builtin/providers/openstack/resource_openstack_compute_instance_v2.go +++ b/builtin/providers/openstack/resource_openstack_compute_instance_v2.go @@ -209,7 +209,6 @@ func resourceComputeInstanceV2() *schema.Resource { Schema: map[string]*schema.Schema{ "id": &schema.Schema{ Type: schema.TypeString, - Optional: true, Computed: true, }, "volume_id": &schema.Schema{ @@ -955,7 +954,6 @@ func resourceComputeVolumeAttachmentHash(v interface{}) int { var buf bytes.Buffer m := v.(map[string]interface{}) buf.WriteString(fmt.Sprintf("%s-", m["volume_id"].(string))) - buf.WriteString(fmt.Sprintf("%s-", m["device"].(string))) return hashcode.String(buf.String()) } diff --git a/builtin/providers/openstack/resource_openstack_compute_instance_v2_test.go b/builtin/providers/openstack/resource_openstack_compute_instance_v2_test.go index 540232da5..95b3b446f 100644 --- a/builtin/providers/openstack/resource_openstack_compute_instance_v2_test.go +++ b/builtin/providers/openstack/resource_openstack_compute_instance_v2_test.go @@ -46,7 +46,7 @@ func TestAccComputeV2Instance_basic(t *testing.T) { }) } -func _TestAccComputeV2Instance_volumeAttach(t *testing.T) { +func TestAccComputeV2Instance_volumeAttach(t *testing.T) { var instance servers.Server var volume volumes.Volume @@ -229,6 +229,7 @@ var testAccComputeV2Instance_volumeAttach = fmt.Sprintf(` resource "openstack_compute_instance_v2" "foo" { region = "%s" name = "terraform-test" + security_groups = ["default"] volume { volume_id = "${openstack_blockstorage_volume_v1.myvol.id}" }