Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete API not triggered on destroy (redux) #249

Open
shawnchapla-8451 opened this issue Nov 28, 2023 · 0 comments
Open

Delete API not triggered on destroy (redux) #249

shawnchapla-8451 opened this issue Nov 28, 2023 · 0 comments

Comments

@shawnchapla-8451
Copy link

I've also run into a similar issue as described in this issue, working with an API which doesn't have a true "GET /other-things/{id}/things/{id}" URL for the pre-destroy read action. It has a general "GET /other-things/{id}/things" API which returns all resources of this type, including their IDs.

I've looked at whether I could use the read_path and read_search parameters of this provider, which I think would be something along the lines of:

resource "restapi_object" "thing" {
  for_each  = local.list-of-other-things
...
  path = "/other-things/${each.value}/things"
  read_path = "/other-things/${each.value}/things"
  read_search = {
    "search_key": "id",
    "search_value": "<ID returned on create of this resource>"
  }

However, I essentially need to be able to reference the current object (i.e., "self") to get the ID that was returned when it was created. Essentially I want to be able to allow the restapi provider to confirm that a resource exists so it can delete it with destroy.

It doesn't appear Terraform has any notion of "self" (at least that I can find), so wondering if there's another way this might be achieved with the features of this provider?

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

No branches or pull requests

1 participant