Add a cloudsql instance.
This commit is contained in:
parent
c8d5c0bbd1
commit
edb515da09
@ -241,3 +241,11 @@ output "gke_connect_command" {
|
||||
description = "Command to run to connect to the kubernetes cluster."
|
||||
value = "gcloud container clusters get-credentials ${google_container_cluster.primary.name} --region ${var.region} --project ${var.project}"
|
||||
}
|
||||
|
||||
#################### SQL ##################################
|
||||
|
||||
module "cloudsql" {
|
||||
source = "../modules/cloudsql"
|
||||
project = var.project
|
||||
region = var.region
|
||||
}
|
||||
|
39
terraform/modules/cloudsql/cloudsql.tf
Normal file
39
terraform/modules/cloudsql/cloudsql.tf
Normal file
@ -0,0 +1,39 @@
|
||||
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"
|
||||
}
|
||||
|
||||
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 {
|
||||
private_network = true
|
||||
}
|
||||
}
|
||||
|
||||
deletion_protection = "true"
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user