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

damp-book-35965

03/21/2019, 11:26 PM
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

creamy-potato-29402

03/21/2019, 11:26 PM
are you importing and referencing those resources?
d

damp-book-35965

03/21/2019, 11:27 PM
You mean referencing them further on ?
Nope
c

creamy-potato-29402

03/21/2019, 11:27 PM
you can’t just import them. node.js will not execute the file unless you reference something from that file.
d

damp-book-35965

03/21/2019, 11:28 PM
What is the import part ? the resources already exist..I just wanted to refactor the structure
c

creamy-potato-29402

03/21/2019, 11:28 PM
what are you doing?
Like, you’ve put them in different files right?
How does pulumi know about the second file?
d

damp-book-35965

03/21/2019, 11:29 PM
the tsconfig file I thought ?
c

creamy-potato-29402

03/21/2019, 11:29 PM
It’s just running a node.js program.
d

damp-book-35965

03/21/2019, 11:29 PM
Exactly so how do I ensure pulumi knows about it ?
c

creamy-potato-29402

03/21/2019, 11:29 PM
it will execute
index.ts
Whatever is in
index.ts
will be executed.
d

damp-book-35965

03/21/2019, 11:30 PM
I added all files in the tsconfig.json file
c

creamy-potato-29402

03/21/2019, 11:30 PM
That doesn’t matter.
d

damp-book-35965

03/21/2019, 11:30 PM
Copy code
"files": [
        "index.ts",
        "helm-config.ts",
        "config.ts",
        "util.ts"
    ]
c

creamy-potato-29402

03/21/2019, 11:30 PM
Pulumi is executing
index.ts
d

damp-book-35965

03/21/2019, 11:30 PM
Okay so how do I ensure that it executes further
c

creamy-potato-29402

03/21/2019, 11:31 PM
import them into
index.ts
d

damp-book-35965

03/21/2019, 11:32 PM
I see..so to maintain the sequential flow it needs to flow through index.ts
c

creamy-potato-29402

03/21/2019, 11:33 PM
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

damp-book-35965

03/21/2019, 11:33 PM
Yup..I was under the impression it will combine all ts files and then figure out the dependencies and stuff
c

creamy-potato-29402

03/21/2019, 11:34 PM
That’s understandable.
d

damp-book-35965

03/21/2019, 11:34 PM
Got it..
Thanks
c

creamy-potato-29402

03/21/2019, 11:34 PM
sure
w

white-balloon-205

03/22/2019, 12:17 AM
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

damp-book-35965

03/22/2019, 12:19 AM
Got it..I will try this out
Thanks Luke