Hi there,
First off, I want to thank the team for constantly helping. Also sorry about that, I’m fairly new to the concept of Terraform and cloud environments.
Back on-topic:
Right now I have two files with all of the resource declarations within my project.
It ranges from networking to subnetting, k8s etc.

But those files have both become an unreadable mess, and I was wondering whether it is possible to use multiple files/classes to declare multiple resources per category which will all compile/synthesise into the same json file.
You absolutely can (and should) split up your code. That’s really one of the most powerful aspects of cdk. You are free to divide and structure your infrastructure code using the same techniques you would use for application code. Take a look here for some more tips.
1 Like
I somehow managed it? Albeit it might be a bit… off(?)
Running app.Synth()
now results in the following folder structure:

Is this intended? Am I simply expected to to run Terraform plan && Terraform apply
on all of those files? I would have ideally had a way to see all of the changes in a single Terraform plan
command, correct me if I’m wrong but I’m assuming that that is not possible with this structure
Having multiple stacks is intended. If you want to use Terraform
directly then you’ll need to go through all of them individually. The cdktf
cli can perform operations at the same time and does them in the correct order.
1 Like
If you want to use Terraform directly
Could you elaborate a bit more on that? Is there an “indirect” manner?
You can also run cdktf plan <stack name>
or cdktf deploy <stack name>
. You install the cdktf CLI by running npm install -g cdktf-cli
1 Like