able-camera-57198
11/06/2021, 6:26 PMgreen-stone-37839
11/06/2021, 8:33 PMup/preview
. The --config-file {location}
flag is what you're looking for. Just curious, why would you want to use the same configuration file for multiple stacks?able-camera-57198
11/06/2021, 8:54 PMconfiguration.GetObject<Project>("project");
And that value is strongly typed with information about all my regions.Pulumi.stack.yaml
file. I guess what would be really cool is if I could import another .yaml
file. Or alternatively, provide multiple that then get merged together prior to being passed to Pulumi.myorg-core:project:
Debug: true
Name: "myorg-prototype-3"
OrganizationName: "myorg"
OrganizationNameShort: "mp"
EnvironmentNameShort: "mpp3"
DefaultLocation: "us-central1"
Regions:
ca:
Code: "ca"
Global: true
Location: "northamerica-northeast1"
Cidr: "10.8.0.0/28"
us:
Code: "us"
Location: "us-central1"
Global: false
Cidr: "10.9.0.0/28"
gcp:project: myorg-prototype-3
google-native:project: myorg-prototype-3
☝️🏻 This is repeated in all of my stacks.green-stone-37839
11/06/2021, 8:59 PMPulumi.stack.yaml
files are meant to be per stack, so the configuration isn't really designed to do what you'd like, although it will support it.
You're using .net, right? What's stopping you from just using a common appsettings.json file and using .net apis, such as ConfigurationBuilder
to use your shared config file?able-camera-57198
11/06/2021, 9:00 PMgreen-stone-37839
11/06/2021, 9:00 PMable-camera-57198
11/06/2021, 9:01 PMyaml
files?yaml
AND the config.green-stone-37839
11/06/2021, 9:01 PMup/prevew
.
pulumi up --config-file ../my-shared-stack-config.yaml
able-camera-57198
11/06/2021, 9:08 PMgreen-stone-37839
11/06/2021, 9:08 PMable-camera-57198
11/06/2021, 9:08 PMconfig:
my-org-core:project:
green-stone-37839
11/06/2021, 9:09 PMable-camera-57198
11/06/2021, 9:09 PMmy-org-core:project:
seems to influence where configuration.GetObject<Project>("project");
begins looking.green-stone-37839
11/06/2021, 9:10 PMable-camera-57198
11/06/2021, 9:10 PM.csproj
with their own Pulumi.yaml
, in sibling folders.green-stone-37839
11/06/2021, 9:13 PMable-camera-57198
11/06/2021, 9:13 PMpublic class MyStack : Stack
as more like a "stack template", is that right?)green-stone-37839
11/06/2021, 9:15 PMBut the stack code can be reused between multiple stacks, right?There is no such thing as stack code. Projects contain code (program.cs, .csproj, etc). Stacks are instances of a project.
able-camera-57198
11/06/2021, 9:15 PMpublic class MyDevStack : Stack
• public class MyProdStack : Stack
• public class MyStageStack : Stack
• public class MyTestStack : Stack
...right?green-stone-37839
11/06/2021, 9:16 PMMyStack
class with four stacks.
Pulumi.Dev.yaml
Pulumi.Test.yaml
Pulumi.Stage.yaml
Pulumi.Prod.yaml
able-camera-57198
11/06/2021, 9:16 PMpublic class MyStack : Stack
.green-stone-37839
11/06/2021, 9:17 PMable-camera-57198
11/06/2021, 9:17 PMStack
in code risks confusion, might be good to call that base class something like StackTemplate
, I might open a suggestion there 😉 )green-stone-37839
11/06/2021, 9:17 PMable-camera-57198
11/06/2021, 9:18 PMPulumi.yaml
does kind of result in an inference of the entrypoint.green-stone-37839
11/06/2021, 9:18 PMable-camera-57198
11/06/2021, 9:18 PMPulumi.yaml
dictates where things begin, I felt like I should have multiple .csproj
and multiple accompanying Pulumi.yaml
.green-stone-37839
11/06/2021, 9:19 PMPulumi.yaml
file question, that represents the file Pulumi uses to understand what language SDK you're using, what the project name is, and other optional things.
It has nothing to do with individual stacksable-camera-57198
11/06/2021, 9:19 PMmy-git-repo-root/
my-stack-project-one/
MyStackProjectOne.csproj
Pulumi.dev.yaml
my-stack-project-two/
MyStackProjectTwo.csproj
Pulumi.dev.yaml
my-stack-project-three/
MyStackProjectThree.csproj
Pulumi.dev.yaml
Pulumi.yaml
Pulumi.yaml
, above all project dirs.)yaml
files have to be a sibling to Pulumi.yaml
?green-stone-37839
11/06/2021, 9:21 PMPulumi.yaml
file and the .csproj file must be in the same folderable-camera-57198
11/06/2021, 9:21 PM--config-file
option from working here.green-stone-37839
11/06/2021, 9:23 PMpulumi.dev.yaml
which has nothing to do with a Pulumi.yaml
file.able-camera-57198
11/06/2021, 9:23 PMPulumi.yaml
I have.green-stone-37839
11/06/2021, 9:24 PM--config-file
flag.able-camera-57198
11/06/2021, 9:24 PMconfig:
my-org-core:project:
my-org-other-stack-1:project:
my-org-other-stack-2:project:
green-stone-37839
11/06/2021, 9:24 PMable-camera-57198
11/06/2021, 9:25 PMgreen-stone-37839
11/06/2021, 9:25 PMable-camera-57198
11/06/2021, 9:25 PM.yaml
and then have the stack-specific .yaml
files import the common values.green-stone-37839
11/06/2021, 9:28 PMable-camera-57198
11/06/2021, 9:29 PMPulumi.stack.yaml
for each project.green-stone-37839
11/06/2021, 9:29 PMable-camera-57198
11/06/2021, 9:30 PMgreen-stone-37839
11/06/2021, 9:31 PMable-camera-57198
11/06/2021, 9:31 PMgreen-stone-37839
11/06/2021, 9:31 PMable-camera-57198
11/06/2021, 9:32 PMgreen-stone-37839
11/06/2021, 9:33 PMable-camera-57198
11/06/2021, 9:33 PMgreen-stone-37839
11/06/2021, 9:33 PMable-camera-57198
11/06/2021, 9:34 PMgreen-stone-37839
11/06/2021, 9:36 PMable-camera-57198
11/06/2021, 9:36 PMgreen-stone-37839
11/06/2021, 9:37 PMable-camera-57198
11/06/2021, 9:37 PMgreen-stone-37839
11/06/2021, 9:38 PMable-camera-57198
11/06/2021, 9:38 PMgreen-stone-37839
11/06/2021, 9:38 PMable-camera-57198
11/06/2021, 9:38 PMgreen-stone-37839
11/06/2021, 9:39 PMable-camera-57198
11/06/2021, 9:40 PMgreen-stone-37839
11/06/2021, 9:47 PMable-camera-57198
11/06/2021, 9:52 PM