I am looking for a App.deploy() function that can directly deploy/provision infra, just like we have App.synth(). Is it possible to directly deploy resources from code itself without having to deal with CLI for deployment?
Asked
Active
Viewed 393 times
1
-
You can execute CLI commands with code, yes. https://stackoverflow.com/questions/89228/how-to-execute-a-program-or-call-a-system-command – gshpychka Mar 13 '22 at 21:00
1 Answers
0
The short answer is: no. Even though, as @gshpychka mentioned, you can use code to execute shell commands, that still involves "dealing with the CLI".
The larger question is -- why do you want to avoid using the CLI? Generally speaking, deploying infra is either going to be a one-off task you perform locally, in which case it makes sense to use the CLI, or it is going to be a frequently repeated task performed by a pipeline...in which case it also makes sense for it to be triggered via CLI. What problem are you trying to solve by not interacting with shell commands?

Nate Norris
- 836
- 7
- 14
-
This is an older question, but the reason I was looking into this was because I want to create a self-service API for infrastructure for developers, I want to reuse existing Terraform modules, and I was hoping not to need anything "out of band" (HTTP API that adds a row to database, then cronjob pipeline that pulls that as an external data source). – iamchris Sep 20 '22 at 03:28