So I split my pulumi files to make the separation ...
# general
d
So I split my pulumi files to make the separation more logical, it seems when I run
pulumi preview
it thinks I deleted all the resources ? I did change my tsconfig file to include the new file..Any other pointers ?
c
are you importing and referencing those resources?
d
You mean referencing them further on ?
Nope
c
you can’t just import them. node.js will not execute the file unless you reference something from that file.
d
What is the import part ? the resources already exist..I just wanted to refactor the structure
c
what are you doing?
Like, you’ve put them in different files right?
How does pulumi know about the second file?
d
the tsconfig file I thought ?
c
It’s just running a node.js program.
d
Exactly so how do I ensure pulumi knows about it ?
c
it will execute
index.ts
Whatever is in
index.ts
will be executed.
d
I added all files in the tsconfig.json file
c
That doesn’t matter.
d
Copy code
"files": [
        "index.ts",
        "helm-config.ts",
        "config.ts",
        "util.ts"
    ]
c
Pulumi is executing
index.ts
d
Okay so how do I ensure that it executes further
c
import them into
index.ts
d
I see..so to maintain the sequential flow it needs to flow through index.ts
c
So, Pulumi isn’t doing anything magic, it’s literally just executing a nodejs app that happens to register a bunch of resources.
Nodejs apps require an index.js or (in our case) an index.ts
d
Yup..I was under the impression it will combine all ts files and then figure out the dependencies and stuff
c
That’s understandable.
d
Got it..
Thanks
c
sure
w
You will typically want to have an
index.ts
file that imports everything you want to include and exports everything you wants to expose. If there are components that file wants to include but not otherwise reference, you can use
import "./something.ts"
to ensure they are imported.
d
Got it..I will try this out
Thanks Luke