My personal story on Terraform vs Ansible approach :
My team @OpsGuru was involved in building complex shelf product deployment suite for customer in AWS environment, some 80K+ lines of Ansible code ( Terraform was very immature to that moment ) .
We were to implement tons of get method that gather facts about each and every aspect of AWS infrastructure and build a complex tag based filtering on an output dictionary ,before we parse it and pass as a variable to Ansible .
We switched to Terraform and were able to reduce few thousand lines of code and , Terraform does that job easily .
On the other hand . Another system that we’ve IaCed -
Provisioning of Hadoop cluster with Zeppelin, Spark , Tensorflow , where complex , multi layered , step-by-step approach is required is almost impossible to achieve in Terraform and Ansible comes handy here .
Ansible is used as a deployment/installation tool for products like OpenShift , MapR , Kubernetes ( through kubespray ), I guess that’s the best purpose for this tool . It’s not perfect choice if cloud resources orchestration is your main goal .