My use case is to get the current desired capacity of an autoscaling group so that I can use that in the replacement autoscaling group. I've seen a Cloudformation solution, but that required more understanding than I have at the time.
Initially, I had thought that just returning the JSON from awscli would have been enough, but unfortunately, the result for the data_source.external.result is a list of strings. No numbers, arrays, maps, lists.
So inspired by a comment made by Marin Salinas, I found that Terraform can access local files!
In addition, I am using an assumed role to do the work.
So, my second version of this gist is now documenting the module that wraps things up quite nicely I feel!
https://registry.terraform.io/modules/digitickets/cli/aws/1.1.0
If there is any feedback, please let me know.