https://pulumi.com logo
Title
s

straight-magician-37467

06/28/2021, 12:57 AM
I just created a new API project. After committing the initial code, I tried to run
pulumi new gcp-typescript
in that folder, but it errored out:
</path/to/project> is not empty; rerun in an empty directory, pass the path to an empty directory to --dir, or use --force
Am I misunderstanding how Pulumi is intended to be used? Would I not want to keep my Pulumi config in the same folder/repo as my actual code?
l

little-cartoon-10569

06/28/2021, 12:59 AM
What is "actual code" in this case? Your Pulumi application, or another application that you want to deploy using Pulumi?
s

straight-magician-37467

06/28/2021, 1:03 AM
Another application that I want to deploy using Pulumi.
l

little-cartoon-10569

06/28/2021, 1:04 AM
Then generally, no, you wouldn't want to keep them in the same place. You can keep them in the same monorepo, which is what I do. There are a few gotchas, but it's mostly fine.
But for most node.js and go apps, whether Pulumi or not, the path of least resistance seems to be one repo each, or at least one top-level dir and separately-managed node_modules each.
Your Pulumi app and your deployed app will have completely unrelated dependencies, so they shouldn't have the same pacakges.json or node_modules.
s

straight-magician-37467

06/28/2021, 1:06 AM
Is there a convention for where a given (non-Pulumi) project’s corresponding Pulumi code should live and be named, in relation to it? I’m trying to get the mental model right.
And then would you keep the Pulumi code in its own git repo?
l

little-cartoon-10569

06/28/2021, 1:08 AM
That all depends on where you want your node_modules directory / directories to do. You don't need to have separate git repos (I think they should be in the same repo, because the coupling is so high) but separate git repos is the default (especially for golang).
My repo is set out with a top-level directory that has almost nothing in it, just a readme.md explaining other dirs. Then the various app dirs, Pulumi dirs, SQL-code dirs and all that are off the one top-level directory.
But whatever works for you. Just be aware of each language's preferences wrt project directories, dependency management, config-file locations, etc.
Almost nothing is imposed by Pulumi; just the location of some yaml files, which might not even apply in your case since it's an autoamtion-api project.
Each language imposes its own set of constraints that you need to be aware of.
s

straight-magician-37467

06/28/2021, 1:11 AM
So there would be nothing preventing me from having a
/pulumi
folder at the root of my repo? It’s an Elixir project, so there’s no concern about
node_modules
collision, but when I get around to creating the repo for the front-end project, that would apply.
l

little-cartoon-10569

06/28/2021, 1:12 AM
Yes, you would want different directories for your front-end javascript and Pulumi typescript code, so they can run npm independently, or whatever.
Having
/pulumi
is a good way to manage that.
s

straight-magician-37467

06/28/2021, 1:13 AM
Cool, that seems pretty clean. Thanks for your insight 🙂
l

little-cartoon-10569

06/28/2021, 1:14 AM
(Though from the point of view of conveying meaning through naming, pulumi isn't helpful for people who don't know what Pulumi is. Maybe deployment or infra or something with more "behaviour" in the name...)
s

straight-magician-37467

06/28/2021, 1:15 AM
Fair point! I’m going to be the sole dev, so that won’t be an issue, but I totally see what you’re saying.
a

agreeable-eye-87399

06/28/2021, 2:17 AM
I think that
/infra
is the convention for a pulumi program in a subfolder that way
(This is implied in the example here: https://www.pulumi.com/docs/reference/pulumi-yaml/)
👀 1