
terraform {
required_providers {
google = {
source = "hashicorp/google"
version = "~> 4.0"
}
}
}
provider "google" {
credentials = file("~/terraform-key.json")
project = var.project_id
region = var.region
}
variable "processing_units" {
type = number
default = 100
}
variable "project_id" {
description = "The GCP Project ID."
type = string
}
variable "region" {
type = string
}
resource "google_spanner_instance" "db-instance" {
config = "regional-${var.region}"
display_name = "TF Spanner Instance"
processing_units = var.processing_units
force_destroy = var.force_destroy
labels = {
"env" = "testing"
}
}