Set secondary zone in Cloud SQL (MySQL) High Availability instance via Terraform

Viewed 36

my goal is set primary and secondary zone in Google Cloud SQL instance using terraform. It can be easily done using UI, but I would like to achieve this using terraform.

In the terraform documentation google_sql_database_instance there is option to set primary zone using settings.location_preference.location which allows to set Primary Zone, but I am not able to configure Secondary Zone or find any examples.

I've tried to use list type but terraform is expecting only 1 string for location_preference.location. I also tried some kind of workaround to use follow_gae_application but as I don't have Google App Engine application it also resulted in error.

Any ideas if this is possible or there are any workarounds?

EDIT: I already set availability_type to Regional. When creating Cloud SQL instance, it creates Primary zone with zone mentioned in preferred_location, but secondary zone is set randomly (sometimes is -a, sometimes is -b or -d.

Regarding settings.backup_configuration.location it's where backup of Cloud SQL instance will be created. Expected value is 'region' so (eu, us or asia).

0 Answers
Related