sincecutoff.com
← all changes

Pulumi provider resources support EnvVarMappings

Introduced 2026-02-10 · score 0.95

HOW TO USE IT

When two instances of the same provider need different values for the same environment variable, define a distinct source variable for each instance and map it to the name the provider expects.

providerOne, err := foo.NewProvider(ctx, "foo-provider-one", &foo.ProviderArgs{}, pulumi.EnvVarMappings(map[string]string{"PASSWORD_ONE": "PASSWORD"})) if err != nil { return err } providerTwo, err := foo.NewProvider(ctx, "foo-provider-two", &foo.ProviderArgs{}, pulumi.EnvVarMappings(map[string]string{"PASSWORD_TWO": "PASSWORD"})) if err != nil { return err }

WHY THIS HELPS

Configure two instances of the same provider with different environment variable values in one environment.

BEFORE THIS CHANGE

The release note says users previously had to put the differing values in provider configuration; this option lets them use separate environment variables instead.

REQUIREMENTS AND LIMITATIONS

  • Version: v3.220.0
  • pulumi.EnvVarMappings(map[string]string{...}): Resource option for remapping environment variables on provider resources.
  • map key (source environment variable) (required): Name of the custom environment variable defined in the environment; its value is used for the mapping.
  • map value (target environment variable) (required): Name of the environment variable the provider expects; the provider sees the source variable's value under this name.
  • Prerequisite: Use Pulumi v3.220.0 or later for this resource option.
  • Prerequisite: Define the custom environment variables in the environment where Pulumi runs.
  • Prerequisite: Set the option on explicitly configured provider resources; it does not apply to ordinary resources or components.
  • The option applies to provider resources and remaps environment variable names passed to provider processes.
  • Mappings are stored in `__internal` state; values are not stored anywhere.

FIRST-PARTY EVIDENCE

Check the installed version and the source before using it. Entry JSON

Report a problem with this card