Synthesize and Apply without CDKTF CLI

Hi,

I’m starting to explore with CDKTF using Go building a simple app that spawns docker container through REST API requests utilizing kreuzwerker/docker provider.

Is there any better way to synthesize and apply the stack in my application without explicit calling exec cdktf apply or terraform apply?

Because that would mean that the host of the application would have to have either CDKTF CLI or Terraform binary installed in the system.

Why can’t I just app.Synth() and app.Apply("./cdktf.out/stacks/go/cdk.tf.json")?

Or is there any way to compile CDKTF CLI or Terraform binary inside the application and call the methods?

Thanks!

Hi,

Your host system will need to have the CDKTF CLI, the Terraform binary and Node.js installed to run CDKTF currently. If you want to trigger CDKTF from within your application exec is your best choice.

We are aiming to make this a bit easier and remove the dependency to terraform, but getting CDKTF to run from inside a language is a bigger effort, I’d encourage you to open an issue to help us understand your motivation and to find other people interested in this use-case.

Hope you are having a great time with CDKTF besides this issue :slight_smile:

1 Like