I am trying to read data from an external source (...
# typescript
n
I am trying to read data from an external source (I have created earlier in the pipeline) in Typescript and based on that build the pulumi with state (from the external source where I have customers and users) for the resources needed for each user and customer. I will then only call the Pulumi Pipeline when changes happen. Is it possible at all ? I have not gotten it to work but it might be something I am missing. Mainly it is from index.ts call the async function and get that to work. Is there any example of something like this ? #typescript
a
if by pipeline you mean earlier in the same pulumi program I don't think that is possible - it sounds like you would need two separate projects with a stack reference from the second one to the first one
n
Ok. I will see if I need to abandon Pulumi altogether then as it seems to be easier just to call the rest endpoints for resource creation instead using Pulumi
a
I would say that using multiple projects should not be seen as some negative point or hurdle to adopting pulumi - it’s pretty standard/expected once you’re deploying both infrastructure (your external source) and apps/customer resources to have those in separate projects
s
it seems to be easier just to call the rest endpoints for resource creation instead
I'd be very cautious of this opinion. If you create the resources yourself, you'll also have to handle state management yourself. You'll end up building something like Pulumi internally. I'm not 100% sure exactly what you are saying, but here's how I interpret it: You have a database with a list of customers and users. Based on this data, you want to maintain a representation of these customers and users that you create from Pulumi. If the customers/users in the db change, you want Pulumi to add/delete them as well when you run
pulumi up
against the stack If that's the case, this is totally doable with just a single Pulumi Stack. What sort of issues are you running into?
n
I have found a way to do it. My problem with Pulumi (and IAC in general) is that in more advanced senarios it takes over everything typically because of the state system. Pulumi in typescript has been dictated and if possible I should use it. External state systems are quite easy to make and I need to make that for my solution anyway which is what I load
Thank you for your replies 🙂 and your concerns
p 1