https://pulumi.com logo
Title
r

rapid-receptionist-28528

12/29/2022, 1:16 PM
Using
automation api
is it possible to retrieve the project name ? which exists in the
pulumi.yaml
? I have the stack:
const stack = await LocalWorkspace.selectStack(args)
b

bored-oyster-3147

12/29/2022, 4:33 PM
You are looking for some variation of workspace.projectSettings or workspace.getProjectSettings depending on your language
It is not a method on the stack but rather the parent workspace
r

rapid-receptionist-28528

12/29/2022, 5:49 PM
but I don’t have access to parent workspace
b

bored-oyster-3147

12/29/2022, 5:50 PM
Yes you do. The static selectStack function is an API that handles setting up the workspace for you. So there are other APIs that you can use to construct your LocalWorkspace before you instantiate your stack, or you can access the Workspace property in your stack
r

rapid-receptionist-28528

12/30/2022, 7:05 AM
The stack that I’m trying to access is already being initiated. I wan’t to
select
the stack using some
args
it’s true that I can add this info (project name) inside the args but that make it de-coupled from the name inside the
pulumi.yaml
file. I don’t want to write the name of the project twice. just want to read it from the yaml file. if I could read the value from the
pulumi.yaml
before creating the
args
object i would be good also. again, I’m using automation api.
b

bored-oyster-3147

12/30/2022, 8:36 PM
You can do that. Just look at the APIs to construct a LocalWorkspace that return the workspace instead of pre-selecting the stack. Make sure you are giving it only the directory with the existing pulumi.yaml