shalb / cluster.dev

Cloud-native infrastructure templating. Creating cloud installers for SaaS. Replication of complex cloud-native infrastructures.
https://docs.cluster.dev/
GNU Affero General Public License v3.0
401 stars 36 forks source link

Generation of terraform modules files (`cdev generate`) #282

Closed kinseii closed 2 months ago

kinseii commented 3 months ago

What would you like to add

Every time we run apply, the /.cluster.dev/cache/ directory is created with a subdirectory as the name of the Stack name and StackTemplate name via a dot. As I understand it, this is how cdev works, that is, it uses these terraform files as a wrapper. This helps me a lot in catching errors in the terraform code itself, such as provider initialization - I just go to this directory and enter the terraform init command and see all the errors that prevent cdev from successfully deploying the code.

My request is to introduce a new cdev generate command to generate terraform cache code. The thing is that cdev validate and cdev plan do not create a subdirectory with terraform code, only cdev apply does, which can be inconvenient for debugging, because the whole code deploy is restarted.

Besides, I suspect that this approach will help us in managing terraform state files, because it turns out that I can make terraform import based on this cache code, but I don't know how cdev itself will pick it up, but maybe you have already considered options for this. I haven't tested it myself, but I will try it when I have free time.

Thank you again for a wonderful product!

romanprog commented 2 months ago

Hello. This is a very necessary command, so it will be planned and implemented at the beginning of cdev development. Try cdev build command for this. This should be exactly what you need.

kinseii commented 2 months ago

Hello. This is a very necessary command, so it will be planned and implemented at the beginning of cdev development. Try cdev build command for this. This should be exactly what you need.

OMG, I completely missed it. Thank you!