Hi, I'm using `LocalWorkspace.CreateOrSelectStackA...
# automation-api
s
Hi, I'm using
LocalWorkspace.CreateOrSelectStackAsync
which works great. But is there a way to remove a stack (not destroy) using pulumi.automation? Right now I have to do it using the CLI pulumi stack rm
Found it you have to instantiate a Workspace by passing it the same working directory then call
Copy code
LocalWorkspace aPulumiWorkspace = await LocalWorkspace.CreateAsync(new LocalWorkspaceOptions() { WorkDir = path });

var StackArgs = new LocalProgramArgs("StackName", path);
            this.Stack = await LocalWorkspace.CreateOrSelectStackAsync(StackArgs);

aPulumiWorkspace .RemoveStackAsync("StackName")
b
This looks like something I’ll need pretty soon. Thanks for sharing!