Original post

Let me start to say that I’m not a programmer, I’m just someone who happens to program on occasion. It just so happens this is one occasion. I write any tools I need in bash, which normally is just a small/med script, but my coworker and I have decided to write a big project since we have downtime and it’s gonna make us look good at work lol.

I’m writing a tool that essentially is a wizard for deploying terraform plans. (I’m building a command and control deployment tool for red teams) I need to build custom plans based on the user’s selection, my coworker has already figured that part out and it’s up to me to build the wizard out, which I’ve done all the logic for that and it works pretty great. I’ve been able to implement most of the features I want to implement up until the most important features of the tool.

I need to concatenate multiple HCL files into one main.tf to build out a custom plan for how each user wants to implement their C2, however since I’m not a programmer, I’m having a hard time wrapping my head around how to do that. I know how to do what I want in bash, which is super simple:

cat file.tf >> other_file.tf 

My second problem is that I need to open up a terraform.tfvars file to find and replace many strings from a configuration file. (like cloud provider keys) I’ve got the configuration file part working perfectly, but I’m struggling with the find and replace part of it. Again in bash, I know how to do this…

I’ve read numerous tutorials on both of these, but for the cat issue I just seem to struggle with the concepts. For the other issue I’ve tried using example code that sort of does I want, but I’m struggling still with the concepts and can’t troubleshoot when it doesn’t work.

And lastly just a quick question, I’m using 5 third party libraries as a crutch for my lack of skill, is that normal/okay/too many?

Thanks in advance!

submitted by /u/wat_waterson
[link] [comments]