bocan / mastodon-google-cloud

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
https://mastodon.cloudcauldron.io
MIT License
6 stars 0 forks source link

Terraform "have at least 1 private services connection" Error #4

Open jhademcconnell opened 1 year ago

jhademcconnell commented 1 year ago

Issue

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:

  1. Navigate to VPC Network -> mastodon-vpc
  2. Scroll over until you see the Private Service Connection tab
  3. Click Allocate IP Range, and fill out Name and a custom or automatic IP range to Allocate
  4. Move over to the "Private Connections to Services" tab and click Create Connection
  5. Select "GCP" as the Connected Service Producer and select your allocated IP range created earlier
  6. Run terraform apply again

Future Improvement

We can check if the IAC could handle this set up of a Private Service Connection