Stay organized with collections
Save and categorize content based on your preferences.
Terraform is a tool for building,
changing, and versioning infrastructure. It uses configuration files to describe
the components needed to run a single application or your entire infrastructure.
You can use the
Google Cloud Terraform Provider to create
Spanner instances and databases, and to modify or delete Spanner
resources.
The Google Cloud Terraform Provider offers the following Spanner resources:
For more information about using these resources to create and manage
Spanner instances and databases, see
Using Terraform with Google Cloud or consult the
Google Cloud Terraform Provider reference.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[],[],null,["# Use Terraform with Spanner\n\n[Terraform](https://www.terraform.io/) is a tool for building,\nchanging, and versioning infrastructure. It uses configuration files to describe\nthe components needed to run a single application or your entire infrastructure.\n\nYou can use the\n[Google Cloud Terraform Provider](https://www.terraform.io/docs/providers/google/index.html) to create\nSpanner instances and databases, and to modify or delete Spanner\nresources.\n\n\n| **PostgreSQL interface note:** For PostgreSQL-dialect databases, Terraform doesn't support submitting DDL while creating a database. You must submit DDL in a separate operation.\n\n\u003cbr /\u003e\n\nThe Google Cloud Terraform Provider offers the following Spanner resources:\n\n- [google_spanner_instance](https://www.terraform.io/docs/providers/google/r/spanner_instance)\n- [google_spanner_database](https://www.terraform.io/docs/providers/google/r/spanner_database)\n- [google_spanner_instance_iam](https://www.terraform.io/docs/providers/google/r/spanner_instance_iam)\n- [google_spanner_database_iam](https://www.terraform.io/docs/providers/google/r/spanner_database_iam)\n\nFor more information about using these resources to create and manage\nSpanner instances and databases, see\n[Using Terraform with Google Cloud](https://cloud.google.com/docs/terraform) or consult the\nGoogle Cloud Terraform Provider [reference](https://registry.terraform.io/providers/hashicorp/google/latest/docs).\n\nWhat's next\n-----------\n\n- Learn more about [Terraform](https://www.terraform.io/).\n- Try out [code examples](https://github.com/cloudspannerecosystem/spanner-terraform#examples) that use the Google Cloud Terraform Provider with Spanner.\n- For a step-by-step tutorial, try the Spanner with Terraform [codelab](https://codelabs.developers.google.com/codelabs/cloud-spanner-terraform#0).\n- View the Google Cloud Terraform Provider [repository on GitHub](https://github.com/hashicorp/terraform-provider-google).\n- [File a GitHub issue](https://github.com/hashicorp/terraform-provider-google/issues) to report a bug or ask a question about Terraform."]]