# Default region
provider "aws" {
  region = "us-west-2"
}

variable "network_name" {
    type = string
    default = "dev"
}

variable "fleet_name" {
    type = string
    default = "dev"
}

variable "name" {
    type = string
    default = "cloud"
}

variable "redis_node_type" {
    type = string
    default = "cache.t2.micro" // note the "cache" prefix!
}

variable "replicas_per_node_group" {
    type = string
    default = "1"
}

variable "num_node_groups" {
    type = string
    default = "1"
}

variable "api_security_group_id" {
    type = string
    default = ""
}

variable "admin_api_security_group_id" {
    type = string
    default = ""
}

variable "cloud_api_security_group_id" {
    type = string
    default = ""
}

variable "cloud_websocket_security_group_id" {
    type = string
    default = ""
}

variable "cloud_worker_security_group_id" {
    type = string
    default = ""
}

module "redis" {
    source = "./redis"
    network_name = "${var.network_name}"
    fleet_name = "${var.fleet_name}"
    name = "redis"
    node_type = "${var.redis_node_type}"
    api_security_group_id = "${var.api_security_group_id}"
    admin_api_security_group_id = "${var.admin_api_security_group_id}"
    cloud_api_security_group_id = "${var.cloud_api_security_group_id}"
    cloud_websocket_security_group_id = "${var.cloud_websocket_security_group_id}"
    cloud_worker_security_group_id = "${var.cloud_worker_security_group_id}"
    replicas_per_node_group = var.replicas_per_node_group
    num_node_groups = var.num_node_groups
}

output "redis" {
    value = module.redis
}
