This rough bit of code will spin up a network and a Google Kubernetes Engine in Google Cloud to let you run Mastodon. It includes a bucket for media, some backup stuff, and a Google SQL (Postgres) database
When running terraform apply in a new GCP project, this error returns:
│ Error: Error, failed to create instance because the network doesn't have at least 1 private services connection. Please see https://cloud.google.com/sql/docs/mysql/private-ip#network_requirements for how to create this connection.
│
│ with google_sql_database_instance.mastodon_db,
│ on sql.tf line 1, in resource "google_sql_database_instance" "mastodon_db":
│ 1: resource "google_sql_database_instance" "mastodon_db" {
Solution
If you come across this issue:
Navigate to VPC Network -> mastodon-vpc
Scroll over until you see the Private Service Connection tab
Click Allocate IP Range, and fill out Name and a custom or automatic IP range to Allocate
Move over to the "Private Connections to Services" tab and click Create Connection
Select "GCP" as the Connected Service Producer and select your allocated IP range created earlier
Run terraform apply again
Future Improvement
We can check if the IAC could handle this set up of a Private Service Connection
Issue
When running
terraform apply
in a new GCP project, this error returns:Solution
If you come across this issue:
VPC Network -> mastodon-vpc
Private Service Connection
tabterraform apply
againFuture Improvement
We can check if the IAC could handle this set up of a Private Service Connection