Skip to content

Commit 0b4e7be

Browse files
authored
Block volume supports size in gigabytes (#289)
* Block volume supports size in gigabytes * Adds block volume example * Remove size param where not required in tests * Update vendor manifest
1 parent 0b3d2b1 commit 0b4e7be

24 files changed

+252
-94
lines changed

data_source_obmcs_core_volume.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ func (s *VolumeDatasourceCrud) SetData() {
9595
"display_name": v.DisplayName,
9696
"id": v.ID,
9797
"size_in_mbs": v.SizeInMBs,
98+
"size_in_gbs": v.SizeInGBs,
9899
"state": v.State,
99100
"time_created": v.TimeCreated.String(),
100101
}

data_source_obmcs_core_volume_attachment_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ func (s *DatasourceCoreVolumeAttachmentTestSuite) SetupTest() {
2929
resource "oci_core_volume" "t" {
3030
availability_domain = "${data.oci_identity_availability_domains.ADs.availability_domains.0.name}"
3131
compartment_id = "${var.compartment_id}"
32-
display_name = "display_name"
33-
size_in_mbs = 51200
32+
display_name = "-tf-volume"
3433
}
3534
resource "oci_core_volume_attachment" "t" {
3635
attachment_type = "iscsi"

data_source_obmcs_core_volume_backup.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ func (s *VolumeBackupDatasourceCrud) SetData() {
9595
"id": v.ID,
9696
"state": v.State,
9797
"size_in_mbs": v.SizeInMBs,
98+
"size_in_gbs": v.SizeInGBs,
9899
"time_created": v.TimeCreated.String(),
99100
"time_request_received": v.TimeRequestReceived.String(),
100101
"unique_size_in_mbs": v.UniqueSizeInMBs,

data_source_obmcs_core_volume_backup_test.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,10 @@ func (s *DatasourceCoreVolumeBackupTestSuite) SetupTest() {
3333
resource "oci_core_volume" "t" {
3434
availability_domain = "${data.oci_identity_availability_domains.ADs.availability_domains.0.name}"
3535
compartment_id = "${var.compartment_id}"
36-
display_name = "display_name"
37-
size_in_mbs = 51200
3836
}
3937
resource "oci_core_volume_backup" "t" {
4038
volume_id = "${oci_core_volume.t.id}"
41-
display_name = "display_name"
39+
display_name = "-tf-volume-backup"
4240
}`
4341
s.ResourceName = "data.oci_core_volume_backups.t"
4442
}
@@ -62,8 +60,16 @@ func (s *DatasourceCoreVolumeBackupTestSuite) TestAccDatasourceCoreVolumeBackup_
6260
}`,
6361
Check: resource.ComposeTestCheckFunc(
6462
resource.TestCheckResourceAttrSet(s.ResourceName, "volume_id"),
65-
resource.TestCheckResourceAttrSet(s.ResourceName, "volume_backups.0.id"),
6663
resource.TestCheckResourceAttr(s.ResourceName, "volume_backups.#", "1"),
64+
resource.TestCheckResourceAttrSet(s.ResourceName, "volume_backups.0.id"),
65+
resource.TestCheckResourceAttrSet(s.ResourceName, "volume_backups.0.volume_id"),
66+
resource.TestCheckResourceAttrSet(s.ResourceName, "volume_backups.0.time_created"),
67+
resource.TestCheckResourceAttr(s.ResourceName, "volume_backups.0.display_name", "-tf-volume-backup"),
68+
resource.TestCheckResourceAttr(s.ResourceName, "volume_backups.0.state", baremetal.ResourceAvailable),
69+
resource.TestCheckResourceAttr(s.ResourceName, "volume_backups.0.size_in_mbs", "51200"),
70+
resource.TestCheckResourceAttr(s.ResourceName, "volume_backups.0.size_in_gbs", "50"),
71+
resource.TestCheckResourceAttrSet(s.ResourceName, "volume_backups.0.unique_size_in_mbs"),
72+
resource.TestCheckResourceAttrSet(s.ResourceName, "volume_backups.0.unique_size_in_gbs"),
6773
),
6874
},
6975
},

data_source_obmcs_core_volume_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ func (s *DatasourceCoreVolumeTestSuite) SetupTest() {
3232
resource "oci_core_volume" "t" {
3333
availability_domain = "${data.oci_identity_availability_domains.ADs.availability_domains.0.name}"
3434
compartment_id = "${var.compartment_id}"
35-
display_name = "display_name"
36-
size_in_mbs = 262144
35+
display_name = "-tf-volume"
36+
size_in_gbs = 50
3737
}
3838
data "oci_core_volumes" "t" {
3939
availability_domain = "${data.oci_identity_availability_domains.ADs.availability_domains.0.name}"

docs/datasources/core/volume_backups.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ The following attributes are exported:
3131
* `display_name` - A user-friendly name. Does not have to be unique.
3232
* `id` - The OCID of the Volume backup.
3333
* `state` - The current state of the volume. [CREATING,AVAILABLE,TERMINATING,TERMINATED,FAULTY,REQUEST_RECEIVED]
34-
* `size_in_mbs` - The size of the volume, in MBs.
34+
* `size_in_mbs` - (Deprecated) The size of the volume, in MBs.
35+
* `size_in_gbs` - The size of the volume, in GBs.
3536
* `time_created` - The date and time the Volume was created.
3637
* `time_requested` - The date and time the request to create the volume backup was received.
37-
* `unique_size_in_mbs` - The size used by the backup, in MBs. It is typically smaller than sizeInMBs, depending on the space consumed on the volume and whether the backup is full or incremental.
38+
* `unique_size_in_mbs` - (Deprecated) The size used by the backup, in MBs. It is typically smaller than sizeInMBs, depending on the space consumed on the volume and whether the backup is full or incremental.
39+
* `unique_size_in_gbs` - The size used by the backup, in GBs. It is typically smaller than sizeInGBs, depending on the space consumed on the volume and whether the backup is full or incremental.
3840
* `volume_id` - The OCID of the Volume.
39-

docs/datasources/core/volumes.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,6 @@ The following attributes are exported:
3232
* `display_name` - A user-friendly name. Does not have to be unique.
3333
* `id` - The OCID of the Volume.
3434
* `state` - The current state of the volume. [PROVISIONING,RESTORING,AVAILABLE,TERMINATING,TERMINATED,FAULTY]
35-
* `size_in_mbs` - The size of the volume, in MBs.
35+
* `size_in_mbs` - (Deprecated) The size of the volume, in MBs.
36+
* `size_in_gbs` - The size of the volume, in GBs.
3637
* `time_created` - The date and time the Volume was created.

docs/examples/compute/instance/block.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ resource "oci_core_volume" "TFBlock0" {
22
availability_domain = "${lookup(data.oci_identity_availability_domains.ADs.availability_domains[var.AD - 1],"name")}"
33
compartment_id = "${var.compartment_ocid}"
44
display_name = "TFBlock0"
5-
size_in_mbs = "${var.256GB}"
5+
size_in_gbs = "${var.DBSize}"
66
}
77

88
resource "oci_core_volume_attachment" "TFBlock0Attach" {

docs/examples/compute/instance/variables.tf

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,8 @@ variable "InstanceOSVersion" {
2727
default = "7.3"
2828
}
2929

30-
variable "2TB" {
31-
default = "2097152"
32-
}
33-
34-
variable "256GB" {
35-
default = "262144"
30+
variable "DBSize" {
31+
default = "50" // size in GBs
3632
}
3733

3834
variable "BootStrapFile" {

docs/examples/storage/block/README.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)