Skip to content

Built-in Properties ​

Besides the properties defined within an environment, references can access three built-in properties: information about the user evaluating an environment (context), other environments in the organization (environments), and imported environments (imports).

context ​

The context built-in property provides information about the environment being evaluated, the user requesting it, and the access token they used.

For a worked example of how currentEnvironment.name and rootEnvironment.name differ inside an imported environment, see How attributes resolve across imported environments.

yaml
values:
  greeting: Hello, ${context.pulumi.organization.login}/${context.pulumi.user.login}!

Differentiating callers by token ​

For an organization token, both user.login and organization.login resolve to the organization name. For a team token, user.login is the login of the team's service principal, in the form team-account:<team-id>, which identifies the team by ID rather than by name. The context.pulumi.token properties are the clearest way to tell those callers apart:

yaml
values:
  callerType: ${context.pulumi.token.type}
  callerTeam: ${context.pulumi.token.team}

token.type and token.team are also available as OIDC subject attributes, which lets a cloud provider's trust policy scope an assumable role to a specific team. token.name is deliberately excluded from subject claims because token names are chosen by the user and could be crafted to forge a subject. See Custom token claim.

environments ​

The environments built-in property provides access to other environments within the same organization. This allows the selective use of values from other environments without explicitly importing them. Reference a value as ${environments.<project>.<environment>.<property-path>}.

yaml
values:
  other: Hello, ${environments.app.dev.name}!

imports ​

The imports built-in property provides access to imported environments, including those that are imported without participating in the merge stack (merge: false). For details on importing environments, see Imports.

yaml
imports:
  - app/dev: { merge: false }
values:
  other: Hello, ${imports["app/dev"].name}!

Content from the official Pulumi documentation (github.com/pulumi/docs).