Skip to content

Commit 5d86aba

Browse files
committed
support for mutli-attach block storage
1 parent d8024b2 commit 5d86aba

File tree

6 files changed

+325
-38
lines changed

6 files changed

+325
-38
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
### Added
44
- Support Etag for ListObjects
55
- Support for Network Security Groups in `oci_file_storage_mount_target` resource
6+
- Support for multi-attach for block storage
67

78
## 3.54.0 (November 27, 2019)
89

examples/compute/instance/pv_encryption_enabled_volume_attachment.tf

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@
33
# Instance with encryption in transit enabled
44

55
resource "oci_core_instance" "test_instance_with_pv_encryption_in_transit" {
6+
count = 2
67
availability_domain = "${data.oci_identity_availability_domain.ad.name}"
78
compartment_id = "${var.compartment_ocid}"
8-
display_name = "TestInstance"
9+
display_name = "TestInstance${count.index}"
910
shape = "${var.instance_shape}"
1011

1112
create_vnic_details {
1213
subnet_id = "${oci_core_subnet.test_subnet.id}"
1314
display_name = "Primaryvnic"
1415
assign_public_ip = true
15-
hostname_label = "testinstance"
16+
hostname_label = "testinstance${count.index}"
1617
}
1718

1819
source_details {
@@ -38,12 +39,14 @@ resource "oci_core_volume" "test_volume" {
3839
}
3940

4041
resource "oci_core_volume_attachment" "test_volume_attachment" {
42+
count = 2
4143
attachment_type = "paravirtualized"
42-
instance_id = "${oci_core_instance.test_instance_with_pv_encryption_in_transit.id}"
44+
instance_id = "${oci_core_instance.test_instance_with_pv_encryption_in_transit.*.id[count.index]}"
4345
volume_id = "${oci_core_volume.test_volume.id}"
4446
display_name = "TestVolumeAttachment"
4547
is_read_only = true
4648
is_pv_encryption_in_transit_enabled = true
49+
is_shareable = "true"
4750
}
4851

4952
# Gets a list of all Oracle Linux 7.5 images that support a given Instance shape

oci/core_volume_attachment_resource.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ func CoreVolumeAttachmentResource() *schema.Resource {
7171
Computed: true,
7272
ForceNew: true,
7373
},
74+
"is_shareable": {
75+
Type: schema.TypeBool,
76+
Optional: true,
77+
Computed: true,
78+
ForceNew: true,
79+
},
7480
"use_chap": {
7581
Type: schema.TypeBool,
7682
Optional: true,
@@ -379,6 +385,10 @@ func (s *CoreVolumeAttachmentResourceCrud) populateTopLevelPolymorphicAttachVolu
379385
tmp := isReadOnly.(bool)
380386
details.IsReadOnly = &tmp
381387
}
388+
if isShareable, ok := s.D.GetOkExists("is_shareable"); ok {
389+
tmp := isShareable.(bool)
390+
details.IsShareable = &tmp
391+
}
382392
if volumeId, ok := s.D.GetOkExists("volume_id"); ok {
383393
tmp := volumeId.(string)
384394
details.VolumeId = &tmp
@@ -406,6 +416,10 @@ func (s *CoreVolumeAttachmentResourceCrud) populateTopLevelPolymorphicAttachVolu
406416
tmp := isReadOnly.(bool)
407417
details.IsReadOnly = &tmp
408418
}
419+
if isShareable, ok := s.D.GetOkExists("is_shareable"); ok {
420+
tmp := isShareable.(bool)
421+
details.IsShareable = &tmp
422+
}
409423
if volumeId, ok := s.D.GetOkExists("volume_id"); ok {
410424
tmp := volumeId.(string)
411425
details.VolumeId = &tmp

0 commit comments

Comments
 (0)