Skip to content

Volume resource, optional parameter size_in_mbs when not provided, forces new resource on subsequent apply.  #222

@jimmycal

Description

@jimmycal

Terraform Version

Terraform v0.9.6
&
Terraform v0.10.0

Baremetal Provider Version

terraform-provider-baremetal v1.0.16

Description:

When applying a configuration with a volume where the optional size_in_mbs parameter is not provided the volume is created with the default 256GB size. Subsequently running terraform plan will show that the volume will be destroy and recreated. The issue is that terraform believes a change needs be applied based the difference between the config and what the service is returning with. Here is results of a terraform plan

-/+ baremetal_core_volume.volume (new resource required)
availability_domain: "pILZ:US-ASHBURN-AD-2" => "pILZ:US-ASHBURN-AD-2"
compartment_id: "ocid1.tenancy.oc1..aaaaaaaay7s6icq755xqlytpl33i7ysjzzb2kv3vk3itg5ilsxanrzqmsaha" => "ocid1.tenancy.oc1..aaaaaaaay7s6icq755xqlytpl33i7ysjzzb2kv3vk3itg5ilsxanrzqmsaha"
display_name: "tf_test_volume" => "tf_test_volume"
size_in_mbs: "262144" => "0" (forces new resource)
state: "AVAILABLE" => ""
time_created: "2017-08-11 03:25:31.259 +0000 UTC" => ""

To reproduce this issue use the config below and simply run

terraform apply
terrafrom plan - this will show what will happen on the next apply
terraform apply - volume is destroyed and recreated.

The workaround is to ensure you specify the size_in_mbs parameter in your configuration.

However when creating a volume from a backup, the expectation is to not specify the size, and thus this issue will occur.

Repro.tf

#BMC Provider Configuration
variable "tenancy_ocid" {}
variable "user_ocid" {}
variable "fingerprint" {}
variable "private_key_path" {}

provider "baremetal" {
region = "us-ashburn-1"
tenancy_ocid = "${var.tenancy_ocid}"
user_ocid = "${var.user_ocid}"
fingerprint = "${var.fingerprint}"
private_key_path = "${var.private_key_path}"
disable_auto_retries = "true"
}

resource "baremetal_core_volume" "volume" {
availability_domain = "pILZ:US-ASHBURN-AD-2"
compartment_id = "${var.tenancy_ocid}"
display_name = "tf_test_volume"
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions