- 
                Notifications
    You must be signed in to change notification settings 
- Fork 724
Description
Terraform Version
Terraform v0.10.4
OCI Provider Version
terraform-provider-baremetal v1.0.18
Description:
If we have reached the capacity limit of the OCI tenant in terms of storage and we plan to create a resource block volume of 256GB, we use the provided sample below with command :
terraform plan
At this point we don't get any error. This is just a syntax check.
Then we try to apply and we get the following error :
terraform apply
Error applying plan:
1 error(s) occurred:
- 
baremetal_core_volume.DemoBlock0: 1 error(s) occurred: 
- 
baremetal_core_volume.DemoBlock0: Status: 400; Code: LimitExceeded; OPC Request ID: /AC381056F31B4564A1E7A84974561025/097093A4ED071062236E7B53150CFAF4; Message: You have reached your service limit in this Availability Domain for volumes. Please try creating the volume in a different Availability Domain or Region, or try using a smaller volume size. If you have reached all Service limits, please contact Oracle support to request a limit increase. 
Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.
Can we improve the plan command to check if limit are exceeded or not, so that we can avoid failure of the apply command ?
Terraform Plan
resource "baremetal_core_volume" "DemoBlock0" {
availability_domain = "${lookup(data.baremetal_identity_availability_domains.ADs.availability_domains[var.AD - 1],"name")}"
compartment_id = "${var.compartment_ocid}"
display_name = "DemoBlock0"
size_in_mbs = "${var.256GB}"
}
resource "baremetal_core_volume_attachment" "DemoBlock0Attach" {
attachment_type = "iscsi"
compartment_id = "${var.compartment_ocid}"
instance_id = "${baremetal_core_instance.DemoInstance.id}"
volume_id = "${baremetal_core_volume.DemoBlock0.id}"
}