AWS CloudFormation adds support for Fn:ForEach
aws.amazon.com
aws.amazon.com
I’ve occasionally done the same with Terraform, writing Python or Groovy to generate Terraform-flavored JSON rather than hand-write HCL templates that would be too verbose to understand and maintain (looking at you, DynamoDB autoscaling).
If terraform or CDK or tf-cdk work for projects, more power to them, but they are for sure not replacements for each other
however, that placed the burden upon the user to (a) ensure said lambdas were deployed, in every account, and (b) that the lambda worked reliably for all possible inputs
It'd be like if python started shipping with a binding to jq: great for the places where it's available, but otherwise you need to have a strategy for when it's not. Now, the "cloudformation standard library" includes it OOtB which can help things like Fn::ForEach::TheAZs: [ "MyAZ", { Ref: Fn::GetAZs }, ... ] which previously was monster stupid to work around