ElastiCache Nodes Not Created Across Multi AZ

  • Query id: 6db03a91-f933-4f13-ab38-a8b87a7de54d
  • Query name: ElastiCache Nodes Not Created Across Multi AZ
  • Platform: Terraform
  • Severity: Medium
  • Category: Availability
  • URL: Github

Description

ElastiCache Nodes should be created across multi az, which means 'az_mode' should be set to 'cross-az' in multi nodes cluster
Documentation

Code samples

Code samples with security vulnerabilities

Postitive test num. 1 - tf file
resource "aws_elasticache_cluster" "positive1" {
  cluster_id = "cluster-example"
  engine = "memcached"
  num_cache_nodes = 3
}

resource "aws_elasticache_cluster" "positive2" {
  cluster_id = "cluster-example"
  engine = "memcached"
  num_cache_nodes = 3

  az_mode = "single-az"
}

Code samples without security vulnerabilities

Negative test num. 1 - tf file
resource "aws_elasticache_cluster" "negative1" {
  cluster_id           = "cluster-example"
  engine = "memcached"

  num_cache_nodes = 3

  az_mode = "cross-az"
}