https://pulumi.com logo
Title
s

silly-smartphone-71988

08/24/2022, 11:54 AM
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
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

bulky-yacht-13037

08/24/2022, 3:06 PM
This looks like something I’ll need pretty soon. Thanks for sharing!