gorgeous-horse-97952
08/23/2024, 1:50 PMgetStack()
and getProject()
return the literal strings stack
and project
since it looks like they are normally sourced from env vars which are not available to the provider's processgorgeous-horse-97952
08/23/2024, 11:51 PMconstruct
method, but not without being hacky and accessing a private/internal method. Still would like to figure out a better way to do this.
async construct(
name: string,
type: string,
inputs: pulumi.Inputs,
options: pulumi.ComponentResourceOptions
): Promise<provider.ConstructResult> {
const [, , stack, , program] = (
await (<any>options.parent?.urn)["promise"]()
).split(":");
// more code
}
gorgeous-horse-97952
08/25/2024, 1:50 PMruntime.settings.LocalStore
sets stack/project using env var values as I mentioned above. If not set they default to literal strings project
and stack
. When running in context of a provider, the `Server`'s construct
method configures the runtime based on the values in the ConstructRequest
.
tl;dr - instead of calling getProject()
and getStack()
to set the name
value in my class from its constructor, I made name
a getter and now it works as expectedNo matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.
Powered by