Is it possible to pass a jar file to cdktf deploy

I have a aws stack that creates vpc, subnets, ec2 using cdktf java library. I would like to package this code into a Jar file and run this from another java application using the
ProcessBuilder, something like this

ProcessBuilder processBuilder = new ProcessBuilder(
                "cdk",
                "deploy",
                "aws-stack.jar",
                "--var-file aws.tfvars"
        );
        
Process process;
        try {
            process = processBuilder.start();
        } catch (IOException e) {
            throw new RuntimeException("Cannot start cdk process!", e);
        }

Hi @vinodborole :wave:

You can pass --app to cdktf deploy (docs). The command you specify in there could be one that executes your jar file (e.g. java -jar aws-stack.jar).

1 Like

Thanks @ansgarm this helped.

I have created a sample project to address some of these points, in case if someone has similar use case can refer to it

happy coding :grinning: