I basically want to run "pulumi up" but from withi...
# general
c
I basically want to run "pulumi up" but from within my pulumi golang code and not via a cli
c
c
Kind of rough that that's not a feature. I may go to terraform for this reason alone.
l
@cool-sunset-72357 I'd like to hear more about your scenario here, and how terraform makes this easier for you.
c
@lemon-agent-27707 So I have what I'm coming to understand are very unorthodox network requirements. I'm building software that needs to be able to bring up and down subnets, client vpns, and EC2 instances according to arbitrary events, some of which is started based on the whim of a mathy backend. Users are given access to a subnet through a VPN for a variable amount of hours and then during that time the subnet's possessed EC2 instances and composition changes every so often (according to the aforementioned backend). I can't have this sort of dynamic setup without being able to use an API that initiates a "run", or "pulumi up", because my network architecture needs to be able to programmatically change. I thought I would love the opportunity to use pulumi because the rest of my codebase is golang, and I need to do some pretty arbitrary logic to determine what the network's state is, but since it doesn't support this, I will have to rely on terraform and its input variables.
l
Are you planning on using remote execution through terraform enterprise to solve this? This sort of thing is certainly possible. We have an integration test harness that we use internally to spin up and execute programs in a variety of languages. While it isn't officially supported, it may be interesting to browse. https://github.com/pulumi/pulumi/blob/master/pkg/testing/integration/program.go Ultimately, you can accomplish this by shelling out
pulumi up
commands with exec. I agree that first class support would really improve this experience.
c
I'm planning on executing runs using the terraform cloud API. You don't need enterprise to do that.
Are you suggesting I create a project that executes itself via exec.Command(), or that I have a separate service run a pulumi project in a different folder, for example?
Would that work inside of heroku? Could I just make a docker container with those binaries and "pulumi","up" and there are no large output or interactivity problems I would have to solve?
l
Yup, something like installing pulumi in a docker image, and then having a go program that shells out to exec a
pulumi up
You'd still have to generate the pulumi program you want to run in some manner.
Perhaps a pulumi program that uses config to determine what network resources to create: https://www.pulumi.com/docs/intro/concepts/config/