Dynamically creating and managing services

I’m looking to build a web service that allows users within our company to be able to spin up new services quickly. They’ll specify simple options (like whether they want a DB or not), and a cloud-based service that I build will hypothetically run Terraform to create an environment for them.

My initial idea was to have some sort of super generic “service” module that exists in our Terraform repo, and potentially pass options into that generic “service” via CLI arguments to the module any time a user wants to create a service with their requirements (name of the environment, whether or not it should include a DB, etc…).

The problem with this is that I’d need to store those options / arguments in a datastore of some kind and manually manage those as a user wants to change their service / destroy it, and it feels a bit hacky. I was curious as to whether or not people have done similar things and have been able to utilize Terraform for this, or if its worth using service API’s directly for something that’s so dynamic in nature (like using AWS API’s directly to create what I need, as an example).

Terraform does seem to suit a lot of the needs I have though considering it can manage state and more, and I’d really like to not have to implement that stuff myself.

Thanks!