Subha_26
Subha_26

Reputation: 450

Is it possible to deploy resources directly using Python and Terraform CDK from code and not CLI?

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?

Upvotes: 1

Views: 499

Answers (1)

Nate Norris
Nate Norris

Reputation: 996

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?

Upvotes: 0

Related Questions