https://pulumi.com logo
r

rough-byte-99113

09/13/2023, 8:46 PM
Does anyone know how I can clear/delete a project from my pulumi setup? I'm storing state in my own aws s3 bucket and I ran this command:
pulumi new aws-typescript -n nginx-simple --dir ./projects/nginx-simple
Then I deleted the
./projects/nginx-simple
directory, then ran the same exact
pulumi new
command as before and it's telling me:
error: a project with this name already exists: nginx-simple
I checked through the state in the s3 bucket, and I don't see anything related to projects, only stacks. And there's no CLI option to remove or list what projects exist. According to the documentation:
A Pulumi project is any folder which contains a
Pulumi.yaml
file. When in a subfolder, the closest enclosing folder with a
Pulumi.yaml
file determines the current project. A new project can be created with
pulumi new
. A project specifies which runtime to use and determines where to look for the program that should be executed during deployments. Supported runtimes are
nodejs
,
python
,
dotnet
,
go
,
java
, and
yaml
.
So why is it that I deleted the directory that contains the project, but the pulumi CLI tells me that the project
nginx-simple
already exists? Where exactly is it storing the information about what projects have been created? How do I remove
nginx-simple
from that list, so I can run
pulumi new aws-typescript -n nginx-simple --dir ./projects/nginx-simple
again without receiving an error?
b

billowy-army-68599

09/13/2023, 8:47 PM
pulumi stack rm
all the stacks
r

rough-byte-99113

09/13/2023, 8:47 PM
But I'm trying to remove a project, not a stack
b

billowy-army-68599

09/13/2023, 8:48 PM
to remove a project, you remove all stacks from it 🙂
r

rough-byte-99113

09/13/2023, 8:52 PM
Removed all my stacks:
Copy code
pulumi stack ls
NAME  LAST UPDATE  RESOURCE COUNT
And tried the
pulumi new
command again and I still get the error saying that a project with this name already exists: nginx-simple
b

billowy-army-68599

09/13/2023, 8:54 PM
what does
pulumi stack ls -a
show?
r

rough-byte-99113

09/13/2023, 8:56 PM
ohhh that helped shine some light on the situation
Copy code
pulumi stack ls -a   
NAME                           LAST UPDATE  RESOURCE COUNT
organization/nginx-simple/dev  n/a          n/a
weird that it wasn't visible when doing a normal
ls
or even doing
pulumi stack select
b

billowy-army-68599

09/13/2023, 8:58 PM
pulumi stack ls
only shows you the stacks in your current org, you need the
-a
to show everything
r

rough-byte-99113

09/13/2023, 9:00 PM
Well.. I was hopeful, but after explicitly deleting that stack via
pulumi stack rm organization/nginx-simple/dev
and
pulumi stack ls -a
shows no stacks at all:
Copy code
pulumi stack ls -a                                                                                                                                         
NAME  LAST UPDATE  RESOURCE COUNT
Running the
pulumi new aws-typescript -n nginx-simple
command still tells me that
nginx-simple
project exists somehow??
b

billowy-army-68599

09/13/2023, 9:01 PM
There’s likely a directory still in your bucket
r

rough-byte-99113

09/13/2023, 9:04 PM
Ahh that was it! Thanks so much for your help! I probably would have been stuck on this at least another day or two before figuring this out
b

billowy-army-68599

09/13/2023, 9:05 PM
My pleasure!
Reminder that if you use Pulumi enterprise and above you get a dedicated slack channel with help like this 😝