This message was deleted.
# general
s
This message was deleted.
f
Copy code
await workspace.createStack(stackName);
			await workspace.selectStack(stackName);
			const stack = await workspace.stack();
I'm able to create a stack, select it, and get a summary about it if it is an instance but I don't see how to effect the state of it to do a stack up or down
f
await workspace.stack()
returns a StackSummary type
Whereas something like
const stack = await LocalWorkspace.createOrSelectStack(localProgramArgs, workspaceArgs);
would return a Stack type
f
@full-eve-52536 thank you for the reply. Are there methods to take an instance of a stack and do an
.up()
with it, or is this only available using the static methods
LocalWorkspace
f
I've myself have been only dabbling with the Pulumi automation API. As far as I know, the
up()
method exists on the
Stack
type objects. So something like this should work:
Copy code
const stack = await workspace.selectStack(stackName);
await stack.up();
f
I think using the static method this would work, but for an instance
.selectStack
returns a
void
with typescript
That's why I'm guessing I'm misunderstanding some sort of design choice
it's like if you have an instance of a workspace the expectation seems to be that you'd
await
all your operations but don't expect a response
f
Yeah I found it to be a little strange as well. Ultimately I ended up representing "instances" of
workspace
as
WorkspaceArgs
. I.e:
Copy code
const workspaceArgs: LocalWorkspaceOptions = {
    workDir: infraDir,
    envVars: {
      PULUMI_K8S_ENABLE_PATCH_FORCE: 'true',
      NODE_OPTIONS: '',
    },
  };
f
I also see there is some option to supply a callback, maybe the idea is I do things more
async
and hit a callback
I like your approach I'll probably do that