Planning to create the Postgres Instance using the Backstage, Terraform via pre-defined templates.
While running the Terraform plan, stuck with the below error:
Error: googleapi\*\*: Error 404: The Cloud SQL instance does not exist., instanceDoesNotExist\*\*
with module.postgres_instance.google_sql_database.databases\["default_db"\]
on .terraform/modules/postgres_instance/main.tf line 1, in resource "google_sql_database" "databases":
resource "google_sql_database" "databases" {
Error: googleapi: **Error 404: The Cloud SQL instance does not exist., instanceDoesNotExist**
with module.postgres_instance.google_sql_user.iam_service_account\[0\]
on .terraform/modules/postgres_instance/iam.tf line 10, in resource "google_sql_user" "iam_service_account":
resource "google_sql_user" "iam_service_account" {
Tried below ways to resolve the issue, Still stuck with the same error. Can someone please help me how to resolve the above issue?
Verified the gcloud console not found the instances under my ProjectS C:\Windows\system32> gcloud sql instances list- Added the resources under my terraform configuration:
resource "google_sql_user" "iam_service_account" {
instance = "ew2-wrk-dev-wrk01-svp-sqp-db1sq"
name = "[email protected]"
project = "XXXXXXX"
type = "CLOUD_IAM_SERVICE_ACCOUNT"
}
resource "google_sql_database" "databases" {
name = "default_db"
instance = "ew2-wrk-dev-wrk01-svp-sqp-db1sq"
project = "XXXXXX"
}