I am new to pulumi, and I want to organize my code...
# typescript
b
I am new to pulumi, and I want to organize my codes as image. However, I do not know how to configure my
index.ts
, which acts as a main entrypoint for pulumi. Any help would be appreciated!
t
You don’t want to export everything as outputs or what would you like to change in your
index.ts
?
b
I don't know what I am supposed to export on
index.ts
, and what
index.ts
is for!
t
Every Pulumi program needs an entrypoint. Your
index.ts
act as the entrypoint of your program. Exporting ressource output in your entrypoint will print them in stdout where you run your pulumi program. I suggest not exporting your full modules as your pulumi run outputs will be hard to understand. Just export what is necessary for you to read after your program has been run đź‘Ť
b
I see. But I have one more question; how do I make pulumi stack to recognize my resources that I have wrote in Typescript?
t
Just import them in your index like that:
import './src/cloudwatch/log-groups
b
And then run
pulumi up
??
t
yes
b
oh I meant
pulumi refresh
t
if everything is rightfully setup, you shouldn’t have diff except from your program outputs
b
Hmm, only the first resource that I import seems to be recognized by running
pulumi up
. For example, I have a loadbalancer as below in
src/alb/load-balancers.ts
Copy code
export const planit_dev_ecs_bg_alb = new aws.alb.LoadBalancer(
  "planit-dev-ecs-bg-alb",
  // other options
);
And running
pulumi refresh
only recognizes this Load balancer, but not any other resources.