There already exists many implementations of this idea. CDK, Pulumi and Winglang are the ones that come to mind as probably the most well known.