Skip to content
This repository has been archived by the owner on Mar 25, 2022. It is now read-only.

Handle of HTTP 409 error messages #43

Open
julianfoi opened this issue Jul 20, 2017 · 1 comment
Open

Handle of HTTP 409 error messages #43

julianfoi opened this issue Jul 20, 2017 · 1 comment

Comments

@julianfoi
Copy link

Terraform Version

Terraform v0.9.11

Affected Resource(s)

opc_compute_image_list.images

Terraform Configuration Files

resource "opc_compute_image_list" "images" {
  name        = "imageList2"
  description = "Description for the Image List"
}

resource "opc_compute_image_list_entry" "images" {
  name           = "${opc_compute_image_list.images.name}"
  machine_images = [ "/oracle/public/OL_7.2_UEKR3_x86_64-17.2.2-20170405-232026", "/Compute-orcdevtest1/opc@oracle.com/myImage"]
  version        = 1
}

resource "opc_compute_storage_volume" "dns" {
  name             = "storageVolume2"
  description      = "Description for the Bootable Storage Volume"
  size             = 500
  bootable         = true
  image_list       = "${opc_compute_image_list.images.name}"
  image_list_entry = "1"
}

Debug Output

2017/07/20 15:24:19 [DEBUG] dag/walk: vertex "provider.opc (close)", waiting for: "opc_compute_storage_volume.dns"
2017/07/20 15:24:20 [DEBUG] plugin: terraform-provider-opc: 2017/07/20 15:24:20 [DEBUG] [go-oracle-terraform]: Encountered HTTP (409) Error: {"message": "Conflict occurred attempting to store object"}
2017/07/20 15:24:20 [DEBUG] plugin: terraform-provider-opc: 2017/07/20 15:24:20 [DEBUG] [go-oracle-terraform]: 1/3 retries left
2017/07/20 15:24:24 [DEBUG] dag/walk: vertex "opc_compute_storage_volume.dns", waiting for: "opc_compute_image_list.images"
2017/07/20 15:24:24 [DEBUG] dag/walk: vertex "opc_compute_image_list_entry.images", waiting for: "opc_compute_image_list.images"
2017/07/20 15:24:24 [DEBUG] dag/walk: vertex "meta.count-boundary (count boundary fixup)", waiting for: "opc_compute_storage_volume.dns"
2017/07/20 15:24:24 [DEBUG] dag/walk: vertex "provider.opc (close)", waiting for: "opc_compute_storage_volume.dns"
2017/07/20 15:24:24 [DEBUG] dag/walk: vertex "root", waiting for: "provider.opc (close)"
2017/07/20 15:24:25 [DEBUG] root: eval: *terraform.EvalWriteState
2017/07/20 15:24:25 [DEBUG] root: eval: *terraform.EvalApplyProvisioners
2017/07/20 15:24:25 [DEBUG] root: eval: *terraform.EvalIf
2017/07/20 15:24:25 [DEBUG] root: eval: *terraform.EvalWriteState
2017/07/20 15:24:25 [DEBUG] root: eval: *terraform.EvalWriteDiff
2017/07/20 15:24:25 [DEBUG] root: eval: *terraform.EvalApplyPost
2017/07/20 15:24:25 [ERROR] root: eval: *terraform.EvalApplyPost, err: 1 error(s) occurred:

  • opc_compute_image_list.images: Post https://compute.uscom-central-1.oraclecloud.com/imagelist/: http: ContentLength=125 with Body length 0
    2017/07/20 15:24:25 [ERROR] root: eval: *terraform.EvalSequence, err: 1 error(s) occurred:

  • opc_compute_image_list.images: Post https://compute.uscom-central-1.oraclecloud.com/imagelist/: http: ContentLength=125 with Body length 0
    2017/07/20 15:24:25 [TRACE] [walkApply] Exiting eval tree: opc_compute_image_list.images
    2017/07/20 15:24:25 [DEBUG] dag/walk: upstream errored, not walking "opc_compute_storage_volume.dns"
    2017/07/20 15:24:25 [DEBUG] dag/walk: upstream errored, not walking "opc_compute_image_list_entry.images"
    2017/07/20 15:24:25 [DEBUG] dag/walk: upstream errored, not walking "meta.count-boundary (count boundary fixup)"
    2017/07/20 15:24:25 [DEBUG] dag/walk: upstream errored, not walking "provider.opc (close)"

Expected Behavior

Handle HTTP error 409 and provide a detailed description that the resource already existed. Instead of

What should have happened?

Actual Behavior

"
Error applying plan:

1 error(s) occurred:

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.
"

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply
  2. delete terraform.tfstate*
  3. Run terraform apply

Important Factoids

The reason for deleting terraform.tfstates is to reproduce messages that are not clear to the end user as of what could have caused a terraform plan NOT to be applied

References

@grubernaut
Copy link
Contributor

Hey @julianfoi, thanks for the issue!

Going to echo much of what I said in #44, as I'm getting the following output from Terraform using the latest version of the OPC provider plugin:

$ tfa
opc_compute_image_list.images: Creating...
  default:     "" => "1"
  description: "" => "Description for the Image List"
  name:        "" => "imageList2"
Error applying plan:

1 error(s) occurred:

* opc_compute_image_list.images: 1 error(s) occurred:

* opc_compute_image_list.images: 409: {"message": "Conflict occurred attempting to store object"}

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.

Does this look like expected output, or should we iterate on this further? Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants