google-cloud-platformterraformgoogle-alloydb

Unable to create to new AlloyDB database using Terraform


I have created a new AlloyDB cluster and instance on GCP AlloyDB using erraform. As per the docs, the default database name is postgres and I am able to connect successfully to it using psql command.

Now, I need to create a new database with a different name using terraform. However, I am not able to find any documentation on what resource type can be used for doing so. I tried using google_sql_database but it did not work. Am I missing something here?


Solution

  • The current Terraform provider as of the writing of this response doesn't have support for database creation. The underlying APIs for AlloyDB also do not support this at this time, so you could write a custom piece of Terraform to run a script that's done directly with psql perhaps, but the TF provider won't enable doing that.