Hi, is it possible to run just a part of the Pulum...
# general
p
Hi, is it possible to run just a part of the Pulumi program? Let's say I have a React app and want to send logs to AWS CloudWatch. First I'd like to create a log group and an IAM user that can create log streams and send logs in that log group. Then I need to expose the log group name and user credentials to the React app during build step. Finally I'd like to provision the infrastructure for the app and deploy it.
l
Use separate projects for that. It is equally possible to use separate stacks to achieve the same result.
And if most of the time you want to run all 3, but sometimes just one or two of them, then you can use a script or automation-api to tie them together most of the time, or run them separately when necessary.
p
Thanks. I was thinking about this, but it didn't make me sense semantically. It's all related to the same application which makes me think it should be the same stack.
b
That's true but doesn't work with pulumi conceptually. Because every
pulumi up
should declare all expected state, so if different iterations are declaring subsets of expected state than you are going to be creating and deleting infrastructure as your expected state changes
p
That makes sense. I should better align my mental model with how it actually works and split it into two stacks as you suggest. Thanks!
l
You can use a single organization (in app.pulumi.com) or namespace (for all other backends) to group related projects, if it's important.
👍 1
p
Is there any Pulumi concept for namespaces like you say? Or is it just using some prefix for naming projects/stacks? I tried to find it in the docs (https://www.pulumi.com/docs/intro/concepts/stack/) but didn't find it. I'm using S3 backend if it's important.
b
There is no first class concept of namespacing. With the pulumi API backend, stack names are unique to the project. With all other file-state backends (which includes S3, local, or any other blob storage) stack names are unique globally. This means that when you name your stacks in an S3 backend you should name them
projectName-stackName
or something, so you do the namespacing yourself. Here is a relevant issue tracking this behavior: https://github.com/pulumi/pulumi/issues/2522
p
Awesome, thanks!
l
Yes sorry, I should have been more explicit. In this context, "namespace" means "shared backend URL".