Regarding reusability: I’m wanting to build a reu...
# general
m
Regarding reusability: I’m wanting to build a reusable library of sensible defaults for the various teams in my org, such as account number, default tags, etc. If I define these in stacks, will they be available/reusable when imported into another project?
g
Yes, if you define them in stacks you can use the outputs in other stacks with
StackReference
. There’s an example of this at https://github.com/pulumi/examples/blob/master/aws-ts-stackreference/.
m
Thanks, I’ll see if that works for us.
We’re wanting to share our default library(-ies) via nexus. We’re wanting to move away from a global infra repository.
g
If they’re truly just constants and defaults, you could just publish them as a library (into nexus) and use them as an import into your pulumi application.
They wouldn’t need to be a separate stack.
But as a stack you’d get better control over sensitive values and role based access control features from our service.
m
I’m not sure I follow. It looks like the company and department are separate stacks with outputs.
g
Yes, that's how it's implemented in that example.
As a library you would just do
import * as gc3 from "@yourco/gc3-defaults"
as an example.
👍 1
m
Thanks, that’s the concept. I’ve just been exploring core Pulumi concepts to avoid reinventing the wheel.
The
StackReference
functionality will definitely be helpful, too.
@gentle-diamond-70147 When using
StackReference
is it limited to the user’s account and organizations? Is it cross org capable? Thanks!
g
Cross org capable as long as the user executing pulumi has appropriate access to all the orgs/stacks.
👍 1