https://pulumi.com logo
Title
p

proud-art-41399

05/04/2021, 5:22 AM
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

little-cartoon-10569

05/04/2021, 10:07 AM
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

proud-art-41399

05/04/2021, 10:23 AM
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

bored-oyster-3147

05/04/2021, 12:42 PM
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

proud-art-41399

05/04/2021, 1:07 PM
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

little-cartoon-10569

05/04/2021, 11:50 PM
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

proud-art-41399

05/05/2021, 4:27 AM
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

bored-oyster-3147

05/05/2021, 12:41 PM
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

proud-art-41399

05/05/2021, 12:49 PM
Awesome, thanks!
l

little-cartoon-10569

05/05/2021, 9:03 PM
Yes sorry, I should have been more explicit. In this context, "namespace" means "shared backend URL".