Can anyone point me in the right direction for inf...
# general
m
Can anyone point me in the right direction for information on managing projects and stacks hosted in the cloud? I have an Azure Storage Account hosting a storage container called pulumi that I want to hold multiple projects and allow the use of StackReference between projects. On my first attempt, I ran "pulumi login azblob://pulumi" I could successfully create a new project (with a stack called dev) which set up .pulumi folder in my cloud storage and life was good. I then tried to create a second project, using the same cloud storage, also with a stack called dev I got a warning that a stack with that name already existed. This seems to be because projects aren't stored in subfolders within .pulumi. I could force differences by including project names in stack names but that would get ugly quickly. On my next attempt I ran "pulumi login azblob://pulumi/project1". That initially worked well and I could then create a second project with overlapping stack names by running "pulumi login azblob://pulumi/project2" before creating the project. Each project folder within my cloud storage now has its own .pulumi folder. This is a bit of a pain as I now have to run pulumi login when I switch between projects and I haven't been able to find a way to get StackReference to work so that Project2 can refer to Project1. What is the correct way to do this? Ideally I would like to be able to have a single .pulumi folder with subfolders for each project and their own stacks managed inside them. Also what is the correct way to use a StackReference between cloud hosted projects? Thanks Alan
c
maybe because the .pulumi is only dedicated to only one project ?
m
Thanks for the response but I'm not sure what you are suggesting as a solution? In the first scenario I had a single .pulumi folder but was then getting name conflicts between stacks in different projects (i.e. project1 and project2 couldn't both have a stack called dev). In the second scenario I had subfolders for each project each containing a dedicated .pulumi folder. This avoided the stack name conflicts but I then had to log in separately to each project and I also couldn't work out how to reference one project from the other using stackReference. Can you explain either how to use stackReference with the second scenario or better yet how to avoid the name conflicts in the first scenario so I only have a single login to deal with rather than a login per project? It would be nice to end up with a structure like that below but I'm not sure how to achieve it? .pulumi project1 stacks project2 stacks
w
This is ultimately due to https://github.com/pulumi/pulumi/issues/2522 and https://github.com/pulumi/pulumi/issues/2814, both of which we’d like to see get fixed in the filestate backends. Today - you can only use StackReference within a single backend. And to avoid name conflicts, until 2522 is addressed, most users are generally using
<project>-<stack>
naming convention for their stacks - such as
webapp-prod
.
m
Thanks Luke. Looks like this issue have been recognised for some time then (and recently pulled from the 2.0 release). Hopefully it gets looked at soon.