This message was deleted.
s
This message was deleted.
i
Hello! The go.mod file can be inside the same directory as the Pulumi.yaml, or in a parent directory. These are both valid: Everything in one directory. This is typically the case when the Pulumi project is in a separate repository from the rest of your code.
Copy code
/
├─go.mod
├─main.go
└─Pulumi.yaml
Pulumi project as a subdirectory in an existing project.
Copy code
/
├─go.mod
├─other.go
└─infrastructure/
  ├─main.go
  └─Pulumi.yaml
If you have an existing Go project with its own go.mod, you can delete infrastructure/go.mod and run
go mod tidy
. Go will inspect your code and update go.mod with any missing dependencies like the Pulumi SDK. It's also allowed to keep the infrastructure/go.mod and treat it as a submodule. That requires some more knowledge of Go submodules. Typically, there shouldn't be any issues, but you have to make sure to run
pulumi
inside the infrastructure directory, not outside. One advantage of doing this is that dependencies for your infrastructure (Pulumi and friends) do not become dependencies of your application.
Please be sure to use at least v3.68.0 if you decide to place go.mod in a parent directory of infrastructure/.
h
Hey @incalculable-parrot-23117 - thank you for the response! Yeah I don't know much about submodules so would prefer to keep it dead simple for now. I did end up creating a multi-module workspace to get around my IDE complaining about the nested module Will remove that go.mod in
infrastructure/go.mod
for now as you suggested
@incalculable-parrot-23117 your blog is super helpful! 👌
❤️ 1