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

destroy_path and destroy_data don't have any effect #273

Open
dparv opened this issue Aug 13, 2024 · 0 comments
Open

destroy_path and destroy_data don't have any effect #273

dparv opened this issue Aug 13, 2024 · 0 comments

Comments

@dparv
Copy link

dparv commented Aug 13, 2024

This is the config:

 provider "restapi" {
   uri                  = "http://my-portal.com"
   write_returns_object = true
   debug                = true

   headers = {
     "Content-Type" = "application/json"
   }

   create_method  = "POST"
   destroy_method = "POST"
 }


 resource "restapi_object" "notify" {
   provider = restapi
   path = "/api"
   data = "{ \"applicationId\": \"/cloud/test/regions/${var.region}/project/${var.project}/applications/${var.project_unique_string}\", \"provisioningState\": \"Deploying\", \"plan\": \"test\" }"
   destroy_path = "/"
   destroy_method = "POST"
   destroy_data = "{ \"applicationId\": \"/cloud/test/regions/${var.region}/project/${var.project}/applications/${var.project_unique_string}\", \"provisioningState\": \"Deleted\", \"plan\": \"test  \" }"
 }

This is the TF trace output:

id: 321
get_path: /api/{id}
post_path: /api
put_path: /api/{id}
delete_path: /
query_string: 
create_method: POST
read_method: GET
update_method: PUT
destroy_method: POST
debug: false
read_search: (map[string]string) {
}

data: (map[string]interface {}) (len=3) {
 (string) (len=13) "applicationId": (string) (len=102) "/cloud/test/regions/region/project/myproject/applications/testapp",
 (string) (len=17) "provisioningState": (string) (len=9) "Deploying",
 (string) (len=4) "plan": (string) (len=10) "test"
}

read_data: (map[string]interface {}) {
}

update_data: (map[string]interface {}) {
}

destroy_data: (map[string]interface {}) (len=3) {
 (string) (len=13) "applicationId": (string) (len=102) "/cloud/test/regions/region/project/myproject/applications/testapp",
 (string) (len=17) "provisioningState": (string) (len=7) "Deleted",
 (string) (len=4) "plan": (string) (len=10) "test"
}

api_data: (map[string]interface {}) {
}: timestamp="2024-08-13T08:59:44.450+0300"
2024-08-13T08:59:44.451+0300 [INFO]  provider.terraform-provider-restapi_v1.19.1: 2024/08/13 08:59:44 api_client.go: method='GET', path='/api/321', full uri (derived)='http://my-portal.com/api/321', data='': timestamp="2024-08-13T08:59:44.450+0300"

The delete path and method are not changed. The destroy_data is not sent.

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