terraform-provider-terracurl icon indicating copy to clipboard operation
terraform-provider-terracurl copied to clipboard

creating and deleting an API object that is referenced as a UUID explicitely in the URL path

Open fchmainy opened this issue 1 year ago • 4 comments

the API i am using can creates (POST) an object, the result of the creation is a UUID returned in a JSON response. The suppression of the same objet (DELETE) is done using the object UUID referenced in the delete_url request.

for example

resource "terracurl_request" "myobject" {
    ...
    url = "https://10.1.11.111/api/v1/objects"
    ...
}
output "id" {
    value = jsondecode(terracurl_request.myobject.response.id)
}

the "id" is the UUID of the object which is used as the reference for the object suppression.

the destroy_url is then

destroy_url = "https://10.1.11.111/api/v1/objects/<UUIDv4_value>"
destroy_method = "DELETE"

could you help me understand is there are any way moving forward?

fchmainy avatar Apr 06 '23 16:04 fchmainy

I have the same issue. Did you manage to find a solution, @fchmainy ?

m0ps avatar Jul 12 '23 03:07 m0ps

hi @m0ps nope!

fchmainy avatar Jul 13 '23 15:07 fchmainy

@fchmainy @m0ps I switched to https://github.com/Mastercard/terraform-provider-restapi for this exact reason

nwhobart avatar Jul 14 '23 18:07 nwhobart

Nice! Thanks @m0ps for sharing

fchmainy avatar Jul 14 '23 18:07 fchmainy