Does anyone know how I can clear/delete a project ...
# getting-started
r
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
pulumi stack rm
all the stacks
r
But I'm trying to remove a project, not a stack
b
to remove a project, you remove all stacks from it 🙂
r
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
what does
pulumi stack ls -a
show?
r
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
pulumi stack ls
only shows you the stacks in your current org, you need the
-a
to show everything
r
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
There’s likely a directory still in your bucket
r
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
My pleasure!
Reminder that if you use Pulumi enterprise and above you get a dedicated slack channel with help like this 😝