I would like to make a project with two stacks: on...
# getting-started
m
I would like to make a project with two stacks: one for a VM, and one for the stuff that runs on the said VM. I have come up with the following project structure after reading the Pulumi documentation:
Copy code
$ tree -I node_modules $(pwd)
/workspaces/tmnf-do
├── package.json
├── package-lock.json
├── Pulumi.tmnf-server.yaml
├── Pulumi.vm.yaml
├── Pulumi.yaml
├── stacks
│   ├── tmnf-server
│   │   └── index.ts
│   └── vm
│       ├── index.ts
│       └── userdata.sh
└── tsconfig.json
Then I changed the
main
setting of the two stacks to point to the stack directory:
Copy code
$ tail -n +1 Pulumi.*.yaml
==> Pulumi.tmnf-server.yaml <==
main: stacks/tmnf-server

==> Pulumi.vm.yaml <==
main: stacks/vm

config:
  digitalocean:token:
    secure: [redacted]
But when I run
pulumi up --stack vm
I get the following warning:
Copy code
Diagnostics:
  pulumi:pulumi:Stack (tmnf-do-vm):
    We failed to locate the entry point for your program: /workspaces/tmnf-do
    Here's what we think went wrong:
      * Your program's 'main' file (/workspaces/tmnf-do/index.js) does not exist.
Which leads me to think that pulumi is still looking for the program in the project directory, disregarding the
main
setting from stack config files. My question is: should a setup like this be possible, and should it even be possible to override
main
per stack like I am trying to do?
m
+1 to this question, the distinction between projects/programs and stacks (which can be environments - prod/dev/etc. or program) is not at all clear. The docs don't help neither do the YT videos. If I were to guess, stacks were meant to be manifestations of programs for an environment but it's all been bastardized in the name of flexibility. The difference between a stack and a program in a practical sense is unclear because one can do anything with either. I'm pretty confused.