Skip to content

Commit effc6f5

Browse files
committed
Revert "Make size of volume updatable"
This reverts commit d472e9a
1 parent 0024e07 commit effc6f5

File tree

4 files changed

+8
-29
lines changed

4 files changed

+8
-29
lines changed

docs/core/volumes.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ The following arguments support updates:
6666
* `defined_tags` - Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm). Example: `{"Operations.CostCenter": "42"}`
6767
* `display_name` - A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
6868
* `freeform_tags` - Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm). Example: `{"Department": "Finance"}`
69-
* `size_in_gbs` - The size of the volume in GBs.
7069

7170

7271
** IMPORTANT **

provider/core_volume_resource.go

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ func VolumeResource() *schema.Resource {
6767
Type: schema.TypeString,
6868
Optional: true,
6969
Computed: true,
70+
ForceNew: true,
7071
ValidateFunc: validateInt64TypeString,
7172
DiffSuppressFunc: int64StringDiffSuppressFunction,
7273
},
@@ -208,18 +209,6 @@ func (s *VolumeResourceCrud) DeletedTarget() []string {
208209
}
209210
}
210211

211-
func (s *VolumeResourceCrud) UpdatedPending() []string {
212-
return []string{
213-
string(oci_core.VolumeLifecycleStateProvisioning),
214-
}
215-
}
216-
217-
func (s *VolumeResourceCrud) UpdatedTarget() []string {
218-
return []string{
219-
string(oci_core.VolumeLifecycleStateAvailable),
220-
}
221-
}
222-
223212
func (s *VolumeResourceCrud) Create() error {
224213
request := oci_core.CreateVolumeRequest{}
225214

@@ -342,15 +331,6 @@ func (s *VolumeResourceCrud) Update() error {
342331
request.FreeformTags = objectMapToStringMap(freeformTags.(map[string]interface{}))
343332
}
344333

345-
if sizeInGBs, ok := s.D.GetOkExists("size_in_gbs"); ok {
346-
tmp := sizeInGBs.(string)
347-
tmpInt64, err := strconv.ParseInt(tmp, 10, 64)
348-
if err != nil {
349-
return fmt.Errorf("unable to convert sizeInGBs string: %s to an int64 and encountered error: %v", tmp, err)
350-
}
351-
request.SizeInGBs = &tmpInt64
352-
}
353-
354334
tmp := s.D.Id()
355335
request.VolumeId = &tmp
356336

provider/core_volume_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ func TestCoreVolumeResource_basic(t *testing.T) {
149149
variable "volume_defined_tags_value" { default = "updatedValue" }
150150
variable "volume_display_name" { default = "displayName2" }
151151
variable "volume_freeform_tags" { default = {"Department"= "Accounting"} }
152-
variable "volume_size_in_gbs" { default = 52 }
152+
variable "volume_size_in_gbs" { default = 51 }
153153
variable "volume_source_details_type" { default = "volume" }
154154
variable "volume_state" { default = "AVAILABLE" }
155155
@@ -162,8 +162,8 @@ variable "volume_state" { default = "AVAILABLE" }
162162
resource.TestCheckResourceAttr(resourceName, "display_name", "displayName2"),
163163
resource.TestCheckResourceAttr(resourceName, "freeform_tags.%", "1"),
164164
resource.TestCheckResourceAttrSet(resourceName, "id"),
165-
resource.TestCheckResourceAttr(resourceName, "size_in_gbs", "52"),
166-
resource.TestCheckResourceAttr(resourceName, "size_in_mbs", "53248"),
165+
resource.TestCheckResourceAttr(resourceName, "size_in_gbs", "51"),
166+
resource.TestCheckResourceAttr(resourceName, "size_in_mbs", "52224"),
167167
resource.TestCheckResourceAttr(resourceName, "source_details.#", "1"),
168168
resource.TestCheckResourceAttr(resourceName, "source_details.0.type", "volume"),
169169
resource.TestCheckResourceAttrSet(resourceName, "state"),
@@ -186,7 +186,7 @@ variable "volume_state" { default = "AVAILABLE" }
186186
variable "volume_defined_tags_value" { default = "updatedValue" }
187187
variable "volume_display_name" { default = "displayName2" }
188188
variable "volume_freeform_tags" { default = {"Department"= "Accounting"} }
189-
variable "volume_size_in_gbs" { default = 52 }
189+
variable "volume_size_in_gbs" { default = 51 }
190190
variable "volume_source_details_type" { default = "volume" }
191191
variable "volume_state" { default = "AVAILABLE" }
192192
@@ -221,8 +221,8 @@ data "oci_core_volumes" "test_volumes" {
221221
resource.TestCheckResourceAttr(datasourceName, "volumes.0.display_name", "displayName2"),
222222
resource.TestCheckResourceAttr(datasourceName, "volumes.0.freeform_tags.%", "1"),
223223
resource.TestCheckResourceAttrSet(datasourceName, "volumes.0.id"),
224-
resource.TestCheckResourceAttr(datasourceName, "volumes.0.size_in_gbs", "52"),
225-
resource.TestCheckResourceAttr(datasourceName, "volumes.0.size_in_mbs", "53248"),
224+
resource.TestCheckResourceAttr(datasourceName, "volumes.0.size_in_gbs", "51"),
225+
resource.TestCheckResourceAttr(datasourceName, "volumes.0.size_in_mbs", "52224"),
226226
resource.TestCheckResourceAttrSet(datasourceName, "volumes.0.state"),
227227
resource.TestCheckResourceAttrSet(datasourceName, "volumes.0.time_created"),
228228
),

website/docs/r/core_volume.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ The following arguments are supported:
5858
* `defined_tags` - (Optional) (Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm). Example: `{"Operations.CostCenter": "42"}`
5959
* `display_name` - (Optional) (Updatable) A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
6060
* `freeform_tags` - (Optional) (Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm). Example: `{"Department": "Finance"}`
61-
* `size_in_gbs` - (Optional) (Updatable) The size of the volume in GBs.
61+
* `size_in_gbs` - (Optional) The size of the volume in GBs.
6262
* `size_in_mbs` - (Optional) The size of the volume in MBs. The value must be a multiple of 1024. This field is deprecated. Use `size_in_gbs` instead.
6363
* `source_details` - (Optional) Specifies the volume source details for a new Block volume. The volume source is either another Block volume in the same Availability Domain or a Block volume backup. This is an optional field. If not specified or set to null, the new Block volume will be empty. When specified, the new Block volume will contain data from the source volume or backup.
6464
* `id` - (Required) The OCID of the volume or volume backup.

0 commit comments

Comments
 (0)