https://pulumi.com logo
Title
h

happy-grass-18954

06/26/2022, 8:51 PM
Hi, I’m new to Pulumi and have a basic question. How would I convert the command
pulumi stacks ls
to C#?
I can use the API, but I’m guessing there’s a way to do this with the SDK
h

happy-grass-18954

06/26/2022, 9:42 PM
thanks!
To list stacks I’m able to do something like this
var stackArgs = new InlineProgramArgs(projectName, stackName, program);
var stack = await LocalWorkspace.CreateOrSelectStackAsync(stackArgs);
var pulumistacks = stack.Workspace.ListStacksAsync().GetAwaiter().GetResult();
I’m trying to figure out a better way to set the project. I’d like to have a function that can list all stacks, without setting a stack itself.
Do you know if there’s a better way to do that?