gruntwork-io / terraform-google-sql

Terraform modules for deploying Google Cloud SQL (e.g. MySQL, PostgreSQL) in GCP
https://gruntwork.io
Apache License 2.0
92 stars 103 forks source link

If you don't specify a master_zone, constant terraform diffs #39

Closed dionjwa closed 1 year ago

dionjwa commented 5 years ago

Version: source = "github.com/gruntwork-io/terraform-google-sql.git//modules/cloud-sql?ref=v0.2.0"

I didn't have a default master_zone specified, so I would constantly get terraform plan diffs:

          ~ location_preference {
              ~ zone = "us-central1-f" -> null
            }

Maybe this could default to an actual valid value, if not specified?

autero1 commented 5 years ago

We have a couple of options:

  1. Make the location_preference dynamic: If no value provided for follow_gae_application or master_zone, don't create the inline location_preference. This would have to be replicated to failover instance and read replicas.

  2. Read available zones from google_compute_zones and pick one.

Not really a huge fan of the second option... The first option should get rid of the diff. However, I'd say in majority of cases, you'd want to explicitly set the zone(s).

Up for a PR?

eak12913 commented 1 year ago

Closing due to repo sunset