I am trying to setup a primary master and read replica in cloud sql. when setup manually it looks like this:
I am trying to create this in terraform now and the documentation mentions here that they are created on export.
Terraform also gives the following error:
Can't configure a value for "instance_type": its value will be decided automatically based on the result of applying this configuration.
But i cant seem to create them to be that instance type and they always end up as the default PostgreSQL <version_number>
How can i set the terraform configs so that I can export them as ON_PREMISES_INSTANCE
for master and READ_REPLICA_INSTANCE
for read replica?
To elaborate further from my comment, at the time of writing this, you cannot create any other instance type besides the standard POSTGRESQL <version>
via terraform.
It seems like you can only create other types for MYSQL with terraform (see here)
I ended up going with the manual setup involving gcloud
tool as the deployment of this wont be frequent( docs here). I did come across an answer on using provisioners to solve this. So its worth looking at that option if you are really looking to automate it.