What are the best practices along these lines? What's the "something better"?
There's an Ansible provider for Terraform so you can do the whole thing in there.