gcp cloudsql terraform - ghdrako/doc_snipets GitHub Wiki
- https://cloud.google.com/docs/terraform/blueprints/terraform-blueprints
 - https://cloud.google.com/asset-inventory/docs/supported-asset-types
 
To create a PostgreSQL instance using TF, you need the following resources:
- 
(Optional) google_sql_database
 - 
(Optional) google_sql_user
 - 
https://github.com/terraform-google-modules/terraform-google-sql-db/tree/master/modules/postgresql
 
The database_version field is already there, but currently updating it will force a destroy and create in terraform. I have added the logic to handle the database_version updates in the resource update function, so that it never forces a new resource when updated.
- https://github.com/GoogleCloudPlatform/magic-modules/pull/6374
 - https://cloud.google.com/sql/docs/postgres/admin-api/rest/v1beta4/instances#DatabaseInstance
 
This operation is atomic and can not be performed with any other update/patch. i.e database_version field can not be updated alongside settings field.
Update() does not support database_version and Patch() does not support patching any other field in the same request as database_version.
For every other field apart for database_version we are using the Update().
I think the code works well in this case, we patch database_version then update the rest of the fields.
Manage database resources