I just created a new API project. After committing...
# general
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:
Copy code
</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?
What is "actual code" in this case? Your Pulumi application, or another application that you want to deploy using Pulumi?
Another application that I want to deploy using Pulumi.
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.
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?
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.
So there would be nothing preventing me from having a
folder at the root of my repo? It’s an Elixir project, so there’s no concern about
collision, but when I get around to creating the repo for the front-end project, that would apply.
Yes, you would want different directories for your front-end javascript and Pulumi typescript code, so they can run npm independently, or whatever.
is a good way to manage that.
Cool, that seems pretty clean. Thanks for your insight 🙂
(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...)
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.
I think that
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