devops-rob / terraform-provider-terracurl

A flexible Terraform provider for making API calls
https://www.hashicorp.com/blog/writing-terraform-for-unsupported-resources
Mozilla Public License 2.0
134 stars 10 forks source link

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

Open fchmainy opened 1 year ago

fchmainy commented 1 year ago

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?

m0ps commented 1 year ago

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

fchmainy commented 1 year ago

hi @m0ps nope!

nwhobart commented 1 year ago

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

fchmainy commented 1 year ago

Nice! Thanks @m0ps for sharing