Hey everyone! We're progressing towards configuration as code and have successfully adopted a PostgreSQL provider for Terraform to manage users and roles. Now, I'm looking to do something similar for MySQL. Does anyone recommend a good MySQL provider to use with Terraform?
1 Answer
The best option right now is the *petoju/mysql* provider. The official HashiCorp one is archived, so definitely steer clear of that. The *petoju* version is actively maintained and it works great for handling users, roles, databases, and grants—similar to what you’re used to with PostgreSQL. Plus, it has support for AWS RDS IAM authentication, Azure AD, and GCP Cloud SQL, if you need those features! Here’s how you can set it up in your Terraform config:
```hcl
tf {
required_providers {
mysql = {
source = "petoju/mysql"
version = "~> 3.0"
}
}
}
```
I've found it to be solid in practice. You can check out the registry docs [here](https://registry.terraform.io/providers/petoju/mysql/latest/docs).

Awesome, that's just what I was hoping to hear. Thanks a lot!