https://pulumi.com logo
#general
Title
# general
f

famous-kite-69533

03/27/2020, 7:43 PM
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

salmon-account-74572

03/27/2020, 7:47 PM
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

famous-kite-69533

03/27/2020, 7:48 PM
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

gorgeous-egg-16927

03/27/2020, 7:48 PM
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

famous-kite-69533

03/27/2020, 7:49 PM
Oh, so you mean I have test.ts and prod.ts, and I import one in index.ts? or did I misunderstand?
g

gorgeous-egg-16927

03/27/2020, 7:49 PM
Right. Not sure if Iโ€™m understanding your question correctly, but thatโ€™s a reasonable way to structure it
f

famous-kite-69533

03/27/2020, 7:49 PM
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

fast-dinner-32080

03/27/2020, 7:50 PM
You can also just have if statements to enable/disable resources being rendered in the graph.
f

famous-kite-69533

03/27/2020, 7:50 PM
I think that could get messy easily with many resources etc?
f

fast-dinner-32080

03/27/2020, 7:51 PM
yea once you start having a bunch of differences between stacks then it almost makes it it's own project.
f

famous-kite-69533

03/27/2020, 7:52 PM
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