Skip to content

Commit

Permalink
Update openstack provider with multiattach functionality
Browse files Browse the repository at this point in the history
This update adds multiattach functionality for volumes (Issue terraform-provider-openstack#432)
  • Loading branch information
jamesmmccarthy committed Sep 26, 2018
1 parent 2e81bbb commit 191230c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
5 changes: 5 additions & 0 deletions openstack/resource_openstack_blockstorage_volume_v3.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ func resourceBlockStorageVolumeV3() *schema.Resource {
Optional: true,
ForceNew: true,
},
"multiattach": &schema.Schema{
Type: schema.TypeBool,
Optional: true,
},
"attachment": &schema.Schema{
Type: schema.TypeSet,
Computed: true,
Expand Down Expand Up @@ -143,6 +147,7 @@ func resourceBlockStorageVolumeV3Create(d *schema.ResourceData, meta interface{}
SourceReplica: d.Get("source_replica").(string),
SourceVolID: d.Get("source_vol_id").(string),
VolumeType: d.Get("volume_type").(string),
Multiattach: d.Get("multiattach").(bool),
}

log.Printf("[DEBUG] Create Options: %#v", createOpts)
Expand Down
29 changes: 29 additions & 0 deletions openstack/resource_openstack_blockstorage_volume_v3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,26 @@ func TestAccBlockStorageV3Volume_image(t *testing.T) {
})
}

func TestAccBlockStorageV3Volume_image_multiattach(t *testing.T) {
var volume volumes.Volume

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckBlockStorageV3VolumeDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccBlockStorageV3Volume_image_multiattach,
Check: resource.ComposeTestCheckFunc(
testAccCheckBlockStorageV3VolumeExists("openstack_blockstorage_volume_v3.volume_1", &volume),
resource.TestCheckResourceAttr(
"openstack_blockstorage_volume_v3.volume_1", "name", "volume_1"),
),
},
},
})
}

func TestAccBlockStorageV3Volume_timeout(t *testing.T) {
var volume volumes.Volume

Expand Down Expand Up @@ -273,6 +293,15 @@ resource "openstack_blockstorage_volume_v3" "volume_1" {
}
`, OS_IMAGE_ID)

var testAccBlockStorageV3Volume_image_multiattach = fmt.Sprintf(`
resource "openstack_blockstorage_volume_v3" "volume_1" {
name = "volume_1"
size = 5
image_id = "%s"
multiattach = true
}
`, OS_IMAGE_ID)

const testAccBlockStorageV3Volume_timeout = `
resource "openstack_blockstorage_volume_v3" "volume_1" {
name = "volume_1"
Expand Down

0 comments on commit 191230c

Please sign in to comment.