chronark / terraform-provider-vercel

A terraform provider for vercel's hosting platform
ff789693-5a72-142e-e45d-326ead4ae7a4.vercel.app
Mozilla Public License 2.0
25 stars 9 forks source link

Use the ID rather than the name when deleting env vars #37

Closed recurser closed 3 years ago

recurser commented 3 years ago

With the current implementation I always get a 404 when deleting env-vars. Playing with the API directly, it seems that it requires the ID rather than the key:

$ curl -X DELETE -H 'content-type: application/json' -H "Authorization: bearer XXX" "https://api.vercel.com/v8/projects/prj_12345/env/DELETE_TEST"
{"error":{"code":"NOT_FOUND","message":"The Environment Variable \"DELETE_TEST\" was not found."}}⏎

vs:

$ curl -X DELETE -H 'content-type: application/json' -H "Authorization: bearer XXX" "https://api.vercel.com/v8/projects/prj_12345/env/oTe3FNJq5oy2WUwd"
{"type":"encrypted","value":"XXX","target":["production"],"configurationId":null,"id":"oTe3FNJq5oy2WUwd","key":"DELETE_TEST","createdAt":1628770103131,"updatedAt":1628770103131,"createdBy":"XXX","updatedBy":null}

Using this locally compiled provider against my terraform project fixes the issue:

Screen Shot 2021-08-12 at 22 39 10

I've also bumped the API version to match the example in the Vercel docs.

chronark commented 3 years ago

Yeah you are right, thanks.