bland-jackal-6231
09/05/2025, 4:21 PMpreview
?
2. If so, mock all stack references to the shared project.
Is there a better way to do this?many-telephone-49025
09/05/2025, 8:32 PMpulumi about
in both projects? Would help a lotbland-jackal-6231
09/05/2025, 8:41 PMCLI
Version 3.190.0
Go Version go1.25.0
Go Compiler gc
Plugins
KIND NAME VERSION
language nodejs 3.190.0
Host
OS darwin
Version 15.6.1
Arch arm64
This project is written in nodejs: executable='*/.nvm/versions/node/v20.17.0/bin/node' version='v20.17.0'
Current Stack: */uat-shared-infra
...
Found no pending operations associated with uat-shared-infra
Backend
Name <http://pulumi.com|pulumi.com>
URL <https://app.pulumi.com/*>
User *
Organizations *
Token type personal
Dependencies:
NAME VERSION
@types/node 20.14.2
@types/tape 5.6.4
husky 9.0.11
nx 19.3.0
ts-standard 12.0.2
typescript 5.4.5
The Truncated Partner Env
CLI
Version 3.190.0
Go Version go1.25.0
Go Compiler gc
Plugins
KIND NAME VERSION
language nodejs 3.190.0
Host
OS darwin
Version 15.6.1
Arch arm64
This project is written in nodejs: executable='*/.nvm/versions/node/v20.17.0/bin/node' version='v20.17.0'
Current Stack: */uat-bevel
...
Found no pending operations associated with uat-bevel
Backend
Name <http://pulumi.com|pulumi.com>
URL <https://app.pulumi.com/*>
User *
Organizations *
Token type personal
Dependencies:
NAME VERSION
@types/node 20.14.2
@types/tape 5.6.4
husky 9.0.11
nx 19.3.0
ts-standard 12.0.2
typescript 5.4.5
many-telephone-49025
09/05/2025, 8:45 PMbland-jackal-6231
09/05/2025, 8:47 PMconst vpc = new gcp.VCP('name',{....})
export default {vpc}
bland-jackal-6231
09/05/2025, 8:49 PMconst ref = new pulumi.StackReference(`${org}/*/${stack}`)
const vpc = ref.getOuput('vpc')
way over simplified, but you get the point.bland-jackal-6231
09/05/2025, 8:50 PMconst vpc = runningPreview ? getMock('vpc') : ref.getOuput('vpc')
bland-jackal-6231
09/05/2025, 8:51 PMmany-telephone-49025
09/05/2025, 8:52 PMid
or so. The bare minumum of infos needed in the other stack. Or as @salmon-account-74572 wrote:
> exported the essential values
He made a guide of best practices here: https://www.pulumi.com/blog/iac-best-practices-applying-stack-references/bland-jackal-6231
09/05/2025, 8:53 PMmany-telephone-49025
09/05/2025, 8:54 PMmany-telephone-49025
09/05/2025, 9:00 PMimport * as pulumi from "@pulumi/pulumi";
export const test = "engin"
and running pulumi up:
pulumi up -y -f
Updating (dev)
View in Browser (Ctrl+O): <https://app.pulumi.com/dirien/p1/dev/updates/1>
Type Name Status
+ pulumi:pulumi:Stack p1-dev created (1s)
Outputs:
test: "engin"
Resources:
+ 1 created
Duration: 4s
Now Project 2 and stack dev
import * as pulumi from "@pulumi/pulumi";
var stackReference = new pulumi.StackReference("dirien/p1/dev");
export const bucketName = stackReference.getOutput("test");
Running preview:
pulumi preview
Previewing update (dev2)
View in Browser (Ctrl+O): <https://app.pulumi.com/dirien/p2/dev2/previews/9ab0fad0-df3d-4dd0-af80-d57a4021e1e9>
Type Name Plan
+ pulumi:pulumi:Stack p2-dev2 create
Outputs:
bucketName: "engin"
Resources:
+ 1 to create
many-telephone-49025
09/05/2025, 9:01 PMbland-jackal-6231
09/05/2025, 9:09 PM[pulumi preview shared] ==> [pulumi update shared] ==> [pulumi preview partner env] ==> [pulumi update partner env]
But for the Pull Request workflow, which gets run in CI as commits go to a pull request to validate it before the above is ran, it will go:
[pulumi preview shared] ==> [pulumi preview partner env]
So our two solutions are:
• Mock the stack reference output if running preview
• Have to do multiple PR's for any shared infra.
◦ Push Shared Infra with no ref in partner env (updating the shared env)
◦ Push a separate PR to Partner Env so the reference in Shared exists, so it does not break in preview.
Neither makes us totally happy. (mocking results in a little less work and quicker deployments).many-telephone-49025
09/05/2025, 9:11 PMmany-telephone-49025
09/05/2025, 9:35 PMwitty-candle-66007
09/05/2025, 10:01 PMbland-jackal-6231
09/08/2025, 3:00 PMmany-telephone-49025
09/08/2025, 3:52 PM