Can a stack have several projects? It seems a litt...
# general
r
Can a stack have several projects? It seems a little odd to see already existing stacks suggested for new projects (my understanding of a project is just an index file and a mapped runtime (i.e. nodejs).
w
No. A stack is an instance of one project.
It seems a little odd to see already existing stacks suggested for new projects
Where are you seeing this? As written, that indeed seems odd.
my understanding of a project is just an index file and a mapped runtime (i.e. nodejs).
That's right - a project is a
Pulumi.yaml
file (which includes what runtime to use, a name for the project, and optionally a pointer to a non-default location for the entrypoint to load using the language runtime).
r
When running
pulumi up
on a new project (or one without an associated stack) a prompt to select a stack is given. It defaults to an already-associated stack. I always scroll down and type a new name.
w
Oh - is the project name the same across these? The identity of the project is based on project name - and if you have multiple projects with the same "name", you may see this?
r
No. The project names are all different. I have a tree like this: ``````
Copy code
00-base/
  Pulumi.yaml
01-identity/
  Pulumi.yaml
02-platform/
  Pulumi.yaml
w
And just to make sure - are the
name
fields in those
Pulumi.yaml
files each different?
e
@white-balloon-205 same issue is described here: https://github.com/pulumi/pulumi/issues/2814#issuecomment-512723246
that happens for gcs and s3 backends (when projects share the same S3/GCS path for state)
same path is used to be able to use StackReference which works well only with pulumi service backend where you can refer to stack by org/project/stack. For GCS/S3 you can refer only by stack name and both stack states should be under the same path
w
Ahh - yes - if this is a local/s3/GCS backend that could definitely be the issue. FWIW - this issue is more directly tracking fixing this: https://github.com/pulumi/pulumi/issues/2522
e
thanks @white-balloon-205 , will follow it
side note: it's better to make
backend
to be a stack property, not project property.
w
Agreed - backend should very much be associated with a stack not a project.