46 lines
821 B
HCL
46 lines
821 B
HCL
variable "project" {
|
|
description = "Project ID."
|
|
type = string
|
|
}
|
|
|
|
variable "region" {
|
|
description = "Region."
|
|
type = string
|
|
}
|
|
|
|
variable "tier" {
|
|
description = "DB machine type."
|
|
type = string
|
|
default = "db-f1-micro"
|
|
}
|
|
|
|
variable "db_version" {
|
|
description = "Database version."
|
|
type = string
|
|
default = "POSTGRES_13"
|
|
}
|
|
|
|
variable "private_network_id" {
|
|
description = "Private network id."
|
|
type = string
|
|
}
|
|
|
|
resource "google_sql_database_instance" "instance" {
|
|
project = var.project
|
|
region = var.region
|
|
name = "my-database-instance"
|
|
|
|
database_version = var.db_version
|
|
|
|
settings {
|
|
tier = var.tier
|
|
|
|
ip_configuration {
|
|
ipv4_enabled = false
|
|
private_network = var.private_network_id
|
|
}
|
|
}
|
|
|
|
deletion_protection = "true"
|
|
}
|