I want to be able to granularly create/modify a PostgreSQL CloudSQL instance in Google Cloud Platform with Terraform.
Currently there is a setting tier = "<instance_type>"
Taken from Terraform documentation
name = "master-instance"
database_version = "POSTGRES_11"
region = "us-central1"
settings {
# Second-generation instance tiers are based on the machine
# type. See argument reference below.
tier = "db-f1-micro"
}
}
How Can I modify this to match what I have now? Can I create a custom image to use in GCP?
I see there is a way to make a custom image here, but how would I use it in Terraform?
Current settings in CloudSQL
The instance tier is the machine type and and for custom machine types you can set the values in that variable like this: db-custom-<CPUs>-<Memory_in_MB> so for example in your case would be:
name = "master-instance"
database_version = "POSTGRES_11"
region = "us-central1"
settings {
# Second-generation instance tiers are based on the machine
# type. See argument reference below.
tier = "db-custom-12-61440"
}
}
I replicated it on my project and with this values I was able to create an instance with 12 CPUs and 60 GB memory
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With