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

Handle HTTP 404 Error Response Codes from OPC #44

Open
julianfoi opened this issue Jul 20, 2017 · 2 comments
Open

Handle HTTP 404 Error Response Codes from OPC #44

julianfoi opened this issue Jul 20, 2017 · 2 comments

Comments

@julianfoi
Copy link

Terraform Version

Terraform v0.9.11

Affected Resource(s)

opc_compute_image_list_entry

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", "/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:44:27 [DEBUG] plugin: terraform-provider-opc: 2017/07/20 15:44:27 [DEBUG] No meta timeoutkey found in Apply()
2017/07/20 15:44:27 [DEBUG] plugin: terraform-provider-opc: 2017/07/20 15:44:27 [DEBUG] [go-oracle-terraform]: HTTP POST Req (/storage/volume/):
2017/07/20 15:44:27 [DEBUG] plugin: terraform-provider-opc: 0xc4201023b0
2017/07/20 15:44:27 [DEBUG] plugin: terraform-provider-opc: 2017/07/20 15:44:27 [DEBUG] No meta timeoutkey found in Apply()
2017/07/20 15:44:27 [DEBUG] plugin: terraform-provider-opc: 2017/07/20 15:44:27 [DEBUG] [go-oracle-terraform]: HTTP POST Req (/imagelist/Compute-orcdevtest1/julian.ortiz@oracle.com/imageList3/entry/):
2017/07/20 15:44:27 [DEBUG] plugin: terraform-provider-opc: 0xc420102550
2017/07/20 15:44:31 [DEBUG] dag/walk: vertex "meta.count-boundary (count boundary fixup)", waiting for: "opc_compute_image_list_entry.images"
2017/07/20 15:44:31 [DEBUG] dag/walk: vertex "root", waiting for: "meta.count-boundary (count boundary fixup)"
2017/07/20 15:44:31 [DEBUG] dag/walk: vertex "provider.opc (close)", waiting for: "opc_compute_image_list_entry.images"
2017/07/20 15:44:32 [DEBUG] plugin: terraform-provider-opc: 2017/07/20 15:44:32 [DEBUG] [go-oracle-terraform]: Encountered HTTP (404) Error: {"message": "MachineImage does not exist"}
2017/07/20 15:44:32 [DEBUG] plugin: terraform-provider-opc: 2017/07/20 15:44:32 [DEBUG] [go-oracle-terraform]: 1/3 retries left
2017/07/20 15:44:33 [DEBUG] plugin: terraform-provider-opc: 2017/07/20 15:44:33 [DEBUG] [go-oracle-terraform]: Encountered HTTP (404) Error: {"message": "Image list /Compute-orcdevtest1/julian.ortiz@oracle.com/imageList3 or image list entry 1 does not exist to create boot volume /Compute-orcdevtest1/julian.ortiz@oracle.com/storageVolume3."}
2017/07/20 15:44:33 [DEBUG] plugin: terraform-provider-opc: 2017/07/20 15:44:33 [DEBUG] [go-oracle-terraform]: 1/3 retries left
2017/07/20 15:44:36 [DEBUG] dag/walk: vertex "meta.count-boundary (count boundary fixup)", waiting for: "opc_compute_image_list_entry.images"
2017/07/20 15:44:36 [DEBUG] dag/walk: vertex "root", waiting for: "meta.count-boundary (count boundary fixup)"
2017/07/20 15:44:36 [DEBUG] dag/walk: vertex "provider.opc (close)", waiting for: "opc_compute_image_list_entry.images"
2017/07/20 15:44:37 [DEBUG] root: eval: *terraform.EvalWriteState
2017/07/20 15:44:37 [DEBUG] root: eval: *terraform.EvalApplyProvisioners
2017/07/20 15:44:37 [DEBUG] root: eval: *terraform.EvalIf
2017/07/20 15:44:37 [DEBUG] root: eval: *terraform.EvalWriteState
2017/07/20 15:44:37 [DEBUG] root: eval: *terraform.EvalWriteDiff
2017/07/20 15:44:37 [DEBUG] root: eval: *terraform.EvalApplyPost
2017/07/20 15:44:37 [ERROR] root: eval: *terraform.EvalApplyPost, err: 1 error(s) occurred:

  • opc_compute_storage_volume.dns: Error creating storage volume storageVolume3: Post https://compute.uscom-central-1.oraclecloud.com/storage/volume/: http: ContentLength=306 with Body length 0
    2017/07/20 15:44:37 [ERROR] root: eval: *terraform.EvalSequence, err: 1 error(s) occurred:

  • opc_compute_storage_volume.dns: Error creating storage volume storageVolume3: Post https://compute.uscom-central-1.oraclecloud.com/storage/volume/: http: ContentLength=306 with Body length 0
    2017/07/20 15:44:37 [TRACE] [walkApply] Exiting eval tree: opc_compute_storage_volume.dns
    2017/07/20 15:44:37 [DEBUG] root: eval: *terraform.EvalWriteState
    2017/07/20 15:44:37 [DEBUG] root: eval: *terraform.EvalApplyProvisioners
    2017/07/20 15:44:37 [DEBUG] root: eval: *terraform.EvalIf
    2017/07/20 15:44:37 [DEBUG] root: eval: *terraform.EvalWriteState
    2017/07/20 15:44:37 [DEBUG] root: eval: *terraform.EvalWriteDiff
    2017/07/20 15:44:37 [DEBUG] root: eval: *terraform.EvalApplyPost
    2017/07/20 15:44:37 [ERROR] root: eval: *terraform.EvalApplyPost, err: 1 error(s) occurred:

  • opc_compute_image_list_entry.images: Post https://compute.uscom-central-1.oraclecloud.com/imagelist/Compute-orcdevtest1/julian.ortiz@oracle.com/imageList3/entry/: http: ContentLength=163 with Body length 0
    2017/07/20 15:44:37 [ERROR] root: eval: *terraform.EvalSequence, err: 1 error(s) occurred:

  • opc_compute_image_list_entry.images: Post https://compute.uscom-central-1.oraclecloud.com/imagelist/Compute-orcdevtest1/julian.ortiz@oracle.com/imageList3/entry/: http: ContentLength=163 with Body length 0
    2017/07/20 15:44:37 [TRACE] [walkApply] Exiting eval tree: opc_compute_image_list_entry.images
    2017/07/20 15:44:37 [DEBUG] dag/walk: upstream errored, not walking "meta.count-boundary (count boundary fixup)"
    2017/07/20 15:44:37 [DEBUG] dag/walk: upstream errored, not walking "provider.opc (close)"
    2017/07/20 15:44:37 [DEBUG] dag/walk: upstream errored, not walking "root"

Expected Behavior

Standard output should print correct reason as to why the resource fail to be created.

I.ex " opc_compute_image_list_entry.images: 1 error(s) occurred: machine_image does not exist"

What should have happened?

Actual Behavior

"
Error applying plan:

2 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. Create your plan and set value of /oracle/public/OL_7.1_UEKR3_x86_64 as a machine_image name, resource "opc_compute_image_list_entry" "images" {
    name = "${opc_compute_image_list.images.name}"
    machine_images = [ "/oracle/public/OL_7.1_UEKR3_x86_64"]
    version = 1
    }
  1. terraform plan
  2. terraform apply

Important Factoids

References

@grubernaut grubernaut added the bug label Jul 20, 2017
@grubernaut
Copy link
Contributor

Hey @julianfoi, thanks for the issue!

To clarify, which version of the opc provider are you using, which OS/Arch are you using, and how did you compile/install the plugin?

I'm seeing this currently with the latest version of the OPC provider plugin:

opc_compute_image_list.images: Creating...
  default:     "" => "1"
  description: "" => "foo bar baz"
  name:        "" => "jake-image-list"
opc_compute_image_list.images: Creation complete (ID: jake-image-list)
opc_compute_image_list_entry.images: Creating...
  machine_images.#: "" => "1"
  machine_images.0: "" => "/oracle/public/OL_7.1_UEKR3_x86_64"
  name:             "" => "jake-image-list"
  uri:              "" => "<computed>"
  version:          "" => "1"
Error applying plan:

1 error(s) occurred:

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

* opc_compute_image_list_entry.images: 404: {"message": "MachineImage does not exist"}

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 the above look like a decent error message, or should we work to enhance that error message?
Thanks!

@scross01
Copy link
Contributor

scross01 commented Jul 20, 2017

@julianfoi its not clear from the config what you are trying the achieve, are you just trying trying create an storage volume using the public images image /oracle/public/OL_7.1_UEKR3_x86_64

This can be done with just:

resource "opc_compute_storage_volume" "dns" {
  name = "storageVolume2"
  description = "Description for the Bootable Storage Volume"
  size = 500
  bootable = true
  image_list = "/oracle/public/OL_7.1_UEKR3_x86_64"
  image_list_entry = "1"
}

the opc_compute_image_list and opc_compute_image_list_entry resources are for creating a new image list for a private virtual machine images that have been uploaded

@grubernaut I just noticed we don't have a opc_compute_machine_image resource yet (api doc)

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

3 participants