https://pulumi.com logo
#typescript
Title
# typescript
e

early-island-95310

05/05/2023, 1:08 PM
Hello, Pulumi community! I need some help with a problem I’m facing while using Pulumi with Kanbanize. I’ve published my code to a public GitHub repo to make it easier for you to see the problem: https://github.com/artur-shlyapnikov/pulumi-kanbanize, There is also a ready-made stack with the API key, so that you can run
pulumi up
right away. I’ve implemented a custom Pulumi provider for Kanbanize boards. The create and update methods work just fine, but I’m having trouble with the delete method. For some reason, it doesn’t pass the API key to Kanbanize, resulting in an error. I’ve tried debugging the issue and logging the headers, but I can’t seem to figure out why the API key is not being passed. Any help or insights on how to resolve this issue would be greatly appreciated. Thank you in advance!
e

echoing-dinner-19531

05/06/2023, 10:01 AM
The props passed to delete are the outputs of the resource not the inputs. Because "create" and "update" don't return the apikey in their props (which define the outputs) it's not passed into "delete"
e

early-island-95310

05/07/2023, 6:37 PM
Thanks! But despite explicitly passing the apiKey in the outputs of the create, update, and archive functions, the issue remains unresolved. Here’s a link to the commit.
e

echoing-dinner-19531

05/08/2023, 8:57 AM
Are the other properties being passed to delete? Is it just apiKey missing? If you run
pulumi stack export
what properties does the "outputs" block contain for the board resource?
e

early-island-95310

05/08/2023, 10:05 AM
If you run
pulumi stack export
what properties does the “outputs” block contain for the board resource?
I removed the
provider
filed for clarity , as it contains the whole compiled code:
Copy code
❯ pulumi stack export | jq '.deployment.resources[] | select(.id == "25") | .outputs | del(.__provider)'
{
  "description": "",
  "is_archived": 0,
  "name": "AAA",
  "workspace_id": 2
}
apiKey is not in the output
e

echoing-dinner-19531

05/08/2023, 10:08 AM
Are you sure the resource has actually rerun Create/Update since you changed the code to return apiKey from those methods?
e

early-island-95310

05/08/2023, 10:34 AM
No, I’m not sure. Looking at the output of the command above, I guess I figured out the main point that was getting in my way of debugging: for custom resources, pulumi output and input contain the full provider code. Consequently, the previous run must contain the correct code.
Thank you, @echoing-dinner-19531 I think in my case it’s better to create a new stack from scratch, and try to do CRUD operations there with the corrected code.
e

echoing-dinner-19531

05/08/2023, 10:41 AM
Consequently, the previous run must contain the correct code
Only for destroy. For Diff/Update/Create it will always use the latest code from the program. But the engine only calls Create/Update if it thinks there's a diff and has you haven't implemented a Diff method I think the default is no diff (probably not the best default given cases like this, but back compatibility means hard to change)
e

early-island-95310

05/08/2023, 10:42 AM
But the engine only calls Create/Update if it thinks there’s a diff and has you haven’t implemented a Diff method I think the default is no diff
And now I finally get it!
I’m not sure it’s possible to find that out from the documentation; so thank you for pointing out the problem.
e

echoing-dinner-19531

05/08/2023, 11:52 AM
no worries, the documentations a bit lacking here so def a good use of slack 🙂