terraform-provider-mysql icon indicating copy to clipboard operation
terraform-provider-mysql copied to clipboard

Modeling tables in terraform MySQL

Open andrewpage opened this issue 5 years ago • 1 comments

Hello,

Has the team considered the ability to model tables, columns (data types, comments, defaults, etc), and indexes using resources?

I’ve noticed that neither the MySQL nor Postgres providers support this. I think it would be quite useful to be able to declaratively define a SQL schema and have terraform manage the diffing + migrations.

Is there a technical reason this has not been done? If not, would you be accepting of a PR?

Thanks

andrewpage avatar May 21 '19 02:05 andrewpage

Hi @andrewpage,

It's an interesting idea. I'd imagine this hasn't be done in either DB providers because perhaps application frameworks, say rails with its db:<command> commands, provide a better experience for declaring/migrating tables, columns, indexes, etc? Or perhaps no one has the time to experiment with using terraform to declare a SQL schema and its ramifications in a production level environment?

Would be curious on what scenario(s) you would use terraform to declare your schema over using an application framework? Standalone tables that are used by multiple frameworks perhaps?

I don't know of a technical reason as I haven't embarked on such a path but if you would to submit a PR, go for it!

Is there a technical reason this has not been done? If not, would you be accepting of a PR?

davidji99 avatar Jun 21 '19 05:06 davidji99