I have two stacks, test and prod, and I have two f...
# general
f
I have two stacks, test and prod, and I have two files called Pulumi.test.yaml and Pulumi.prod.yaml with the different config and secrets. However I have one index.ts only with what I want Pulumi to deploy. Can I have two different files instead of the single index.ts and specify which one to use for each stack?
s
I don't know if it's possible, but I think (in general) the idea is to parameterize your
index.ts
(possibly pulling values from your stack configuration) so that your code works as expected for each stack.
f
I am using config and secrets but for some things I am just using args. Should I use config for everything? I think that would be a little less flexible
g
If you are specifying separate infrastructure bits, you could put them in separate files and conditionally toggle which one to pull in from the
index.ts
file
f
Oh, so you mean I have test.ts and prod.ts, and I import one in index.ts? or did I misunderstand?
g
Right. Not sure if Iโ€™m understanding your question correctly, but thatโ€™s a reasonable way to structure it
f
yeah that would work and it's quite simple, I should have thought about that
it's just about uncommenting one line
thanks!
๐Ÿ‘ 1
f
You can also just have if statements to enable/disable resources being rendered in the graph.
f
I think that could get messy easily with many resources etc?
f
yea once you start having a bunch of differences between stacks then it almost makes it it's own project.
f
Ehm lol a stupid question since I am new to Typescript as well ๐Ÿ˜„ How do I import a fine into index.ts if that file doesn't export a class?
be gentle ๐Ÿ˜„
Nevermind, I'm stupid ๐Ÿ˜„
Uhm... I have moved my code into another directory called "vendor" so I can reuse that code in multiple projects if needed, but it doesn't find the modules now because the node_modules is in another directory... So I have this structure:
Copy code
pulumi
  vendor
    cert-manager
    velero
    ..etc
  myproject1
    index.ts
    node_modules
  myproject2
    index.ts
    node_modules
I want to run
pulumi update
from inside myproject1 for example. How can I do that?
Aha, it seems to work if I move node_modules and package.* to the parent directory