47 lines
1.1 KiB
HCL
47 lines
1.1 KiB
HCL
variable "project" {
|
|
description = "Project ID."
|
|
type = string
|
|
}
|
|
|
|
variable "region" {
|
|
description = "Region."
|
|
type = string
|
|
}
|
|
|
|
variable "private_network_id" {
|
|
description = "Private network id."
|
|
type = string
|
|
}
|
|
|
|
output "redis_host" {
|
|
description = "Hostname/IP Address for redis database."
|
|
value = google_redis_instance.cache.host
|
|
}
|
|
|
|
output "redis_port" {
|
|
description = "Port for redis database."
|
|
value = google_redis_instance.cache.port
|
|
}
|
|
|
|
resource "google_project_service" "redis" {
|
|
project = var.project
|
|
service = "redis.googleapis.com"
|
|
disable_dependent_services = true
|
|
}
|
|
|
|
resource "google_redis_instance" "cache" {
|
|
project = var.project
|
|
region = var.region
|
|
name = "private-cache"
|
|
display_name = "Private redis cache database."
|
|
tier = "STANDARD_HA"
|
|
memory_size_gb = 1
|
|
authorized_network = var.private_network_id
|
|
connect_mode = "PRIVATE_SERVICE_ACCESS"
|
|
redis_version = "REDIS_5_0"
|
|
|
|
depends_on = [
|
|
google_project_service.redis
|
|
]
|
|
}
|