Skip to content

pulumi-stacks ​

The pulumi-stacks provider enables you to import stack outputs from Pulumi into your environment. This includes stacks updated via the Pulumi CLI as well as stacks whose Terraform state is stored in Pulumi Cloud — Terraform root module outputs are mapped to stack outputs and accessible here with no additional tokens or credentials required.

Example ​

Pulumi stack ​

yaml
values:
  stackRefs:
    fn::open::pulumi-stacks:
      stacks:
        vpcInfra:
          stack: vpc-infra/dev
  pulumiConfig:
    # Consume the stack outputs as Pulumi stack configuration (inputs to your program)
    vpcId: ${stackRefs.vpcInfra.vpcId}
    publicSubnetIds: ${stackRefs.vpcInfra.publicSubnetIds}
    privateSubnetIds: ${stackRefs.vpcInfra.privateSubnetIds}

Terraform state stored in Pulumi Cloud ​

When a stack's Terraform state is stored in Pulumi Cloud, the Terraform root module outputs are exposed as stack outputs (using their original snake_case names) and read here with no additional tokens or credentials. You can then map those outputs to either pulumiConfig, to consume them as inputs to a Pulumi program, or environmentVariables, to feed them back into a downstream Terraform run:

yaml
values:
  tfStack:
    fn::open::pulumi-stacks:
      stacks:
        network:
          stack: network-tf/production
  pulumiConfig:
    # Consume the Terraform outputs as Pulumi stack configuration (inputs to your program)
    vpcId: ${tfStack.network.vpc_id}
    subnetIds: ${tfStack.network.subnet_ids}
  environmentVariables:
    # Expose the outputs as TF_VAR_* environment variables to feed a downstream Terraform run
    TF_VAR_vpc_id: ${tfStack.network.vpc_id}

Schema reference ​

Inputs ​

Outputs ​

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