https://platformengineering.org logo
#general
Title
# general
s

Srini

05/05/2023, 2:39 PM
Hi All, We have a product deployed on AWS kubernetes cluster and I am using terraform with GitOps principle, For DB we are using EC2 instances and I need to automate the DB cluster Installation & configuration (MySQL, Mongo, Postgres), and I have written the automation script in python but is it good idea to use terraform provisioner? to execute the script or should I try ansible or something else? Any suggestions would be much appreciated.
h

Hugo Pinheiro

05/05/2023, 3:00 PM
I would use the terraform_data resource to kick the script off https://medium.com/@thiagoalves/a-reason-to-stop-using-the-terraform-null-resource-51180b2339
I have used the null resource before to kick off ansible playbooks just to keep everything managed in TF
t

Troy Knapp

05/05/2023, 4:58 PM
IMO, I think using Ansible is great... but it's often overkill. A lot of times for provisioning I can get away with using cloud init files like this https://developer.hashicorp.com/terraform/tutorials/provision/cloud-init
h

Hugo Pinheiro

05/05/2023, 5:03 PM
ooh thats even better, i keep forgetting cloud init exists 😂
t

Troy Knapp

05/05/2023, 6:12 PM
Yeah, it's stupid handy if you only need to setup provisioning once... if you want to keep everything in compliance or roll updates, Ansible is definitely the way to go. However, most of the time when I want to roll an update, I just create a new VM and terminate the old one. 🤷‍♂️
56 Views