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
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:
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}
Inputs
| Property | Type | Description |
|---|---|---|
stacks | map[string]PulumiStack | A map of names to stacks to get outputs from. The names contains all outputs from the stack. |
PulumiStack
| Property | Type | Description |
|---|---|---|
stack | string | The project-qualified name of the stack to get outputs for, e.g. myProject/dev. |
Outputs
The pulumi-stacks provider returns a map of names to raw output values for the specified stacks.
Thank you for your feedback!
If you have a question about how to use Pulumi, reach out in Community Slack.
Open an issue on GitHub to report a problem or suggest an improvement.