provider "aws" {
  region = var.aws_region
}

# Terraform backends cannot contain interpolations
terraform {
  backend "s3" {
    bucket  = "dev-orcd-terraform-state"
    key     = "dev/shared-php-cache/terraform.tfstate"
    region  = "us-east-1"
    encrypt = "true"
  }
}

module "oa-workstation-session-cache" {
  source = "git@github.com:theorchard/terraform-elasticache.git//?ref=1.0.4"

  environment              = var.environment
  service_name             = "oa-workstation-session"
  cache_engine             = "memcached"
  memcached_engine_version = "1.5.16"
  cache_subnet_group_name  = "${var.environment}-elasticache-group"
  # Must be set to 1 unless using Elasticache driver to support auto-discovery
  cache_node_count               = 2
  cache_node_type                = "cache.t3.micro"
  additional_cidr_blocks_enabled = "true"
}

module "oa-workstation-doctrine-result-cache" {
  source = "git@github.com:theorchard/terraform-elasticache.git//?ref=1.0.4"

  environment              = var.environment
  service_name             = "oa-workstation-doctrine-result"
  cache_engine             = "memcached"
  memcached_engine_version = "1.5.16"
  cache_subnet_group_name  = "${var.environment}-elasticache-group"
  # Must be set to 1 unless using Elasticache driver to support auto-discovery
  cache_node_count               = 2
  cache_node_type                = "cache.t3.micro"
  additional_cidr_blocks_enabled = "true"
}
