https://pulumi.com logo
m

modern-bear-85657

06/28/2019, 1:52 PM
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

gentle-diamond-70147

06/28/2019, 1:56 PM
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

modern-bear-85657

06/28/2019, 1:57 PM
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

gentle-diamond-70147

06/28/2019, 3:05 PM
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

modern-bear-85657

06/28/2019, 9:46 PM
I’m not sure I follow. It looks like the company and department are separate stacks with outputs.
g

gentle-diamond-70147

06/28/2019, 9:48 PM
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

modern-bear-85657

06/28/2019, 10:02 PM
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

gentle-diamond-70147

07/01/2019, 5:12 PM
Cross org capable as long as the user executing pulumi has appropriate access to all the orgs/stacks.
👍 1