Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS ElastiCache doesn't support Redis 6.0 usages #23729

Closed
vnatarov-logz opened this issue Mar 17, 2022 · 5 comments
Closed

AWS ElastiCache doesn't support Redis 6.0 usages #23729

vnatarov-logz opened this issue Mar 17, 2022 · 5 comments

Comments

@vnatarov-logz
Copy link

vnatarov-logz commented Mar 17, 2022

Hi there,

I want to use AWS ElastiCache with Redis instance and trying use 6.0 or 6.0.x or 6.0.5, but without any luck:

terraform {
  required_version = "~> 1.0"

  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "4.5.0"
    }
  }

    backend "s3" {
      bucket = "terraform-state-bucket-us-east-1-staging"
      key    = "aws/us-east-1/staging/elasticache/terraform.tfstate"
      region = "us-east-1"

      dynamodb_table = "dynamodb_state_lock_table_us_east_1_staging"
    }
}

provider "aws" {
  region = "us-east-1"
}

locals {
    environment = "dev"
    stack_name = "elasticache-redis-staging"
}

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# SG of elasticache for single Redis node
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
module "sg_elasticache_single_redis" {
  source = "git@github.com:SebastianUA/terraform.git//aws/modules/sg?ref=dev"

  enable_security_group = true
  security_group_name   = "${local.environment}-sg-${local.stack_name}"
  security_group_vpc_id = "vpc-0df458ebc8f78adf8"


  security_group_ingress = [
    {
      from_port = 6379
      to_port   = 6379
      protocol  = "all"

      cidr_blocks = ["0.0.0.0/0"]
      description = "6379 from VPC"
    }
  ]

  security_group_egress = [
    {
      from_port = 6379
      to_port   = 6379
      protocol  = "all"

      cidr_blocks = ["0.0.0.0/0"]
      description = "6379 to VPC"
    }
  ]

  tags = tomap({
    "Environment"   = "dev",
    "Createdby"     = "Vitaliy Natarov",
    "Orchestration" = "Terraform"
  })
}

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/supported-engine-versions.html#redis-version-6.0
# https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/supported-engine-versions.html#redis-version-6.2
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
module "elasticache_single_redis" {
  source = "git@github.com:SebastianUA/terraform.git//aws/modules/elasticache?ref=dev"

  # The single cluster
  enable_elasticache_cluster          = true
  elasticache_cluster_num_cache_nodes = 1
  elasticache_cluster_node_type       = "cache.t4g.medium"
  elasticache_cluster_name            = "${local.environment}-${local.stack_name}-1"
  elasticache_cluster_engine          = "redis"
  elasticache_cluster_engine_version  = "6.x" #"5.0.6" # "6.0.5" - doesn't work
  elasticache_cluster_port            = "6379"

  # prefer to use subnet group
  # elasticache_cluster_subnet_group_name = "terracd-us-east-1-staging-vpc-subnet-private-us-east-1c"

  # (Optional, VPC only) One or more VPC security groups associated with the cache cluster
  elasticache_cluster_security_group_ids = [module.sg_elasticache_single_redis.security_group_id]

  # (Optional, EC2 Classic only) List of security group names to associate with this cache cluster. Changing this value will re-create the resource.
  # elasticache_cluster_security_group_names = [module.sg_elasticache_single_redis.security_group_name]

  # elasticache subnet group
  enable_elasticache_subnet_group     = true
  elasticache_subnet_group_name       = "${local.environment}-${local.stack_name}-subnet-group"
  elasticache_subnet_group_subnet_ids = ["subnet-0dee889c36614e335", "subnet-00c642659b07d3338"]

  # elasticache parameter group
  enable_elasticache_parameter_group = false
  elasticache_parameter_group_name   = "${local.environment}-${local.stack_name}-param-group"
  elasticache_parameter_group_parameter = [
    {
      name  = "activerehashing"
      value = "yes"
    }
  ]

  tags = tomap({
    "Environment"   = local.environment,
    "Createdby"     = "Vitaliy Natarov",
    "Orchestration" = "Terraform"
  })

  depends_on = [
    module.sg_elasticache_single_redis
  ]
}

It's working, only when set 6.x, but Terraform will bring the Redis 6.2 up.
Also, when you set 5.0.6 - it's working fine.

Could you please help me to resolve this issue:
engine_version: Redis versions must match <major>.x when using version 6 or higher, or <major>.<minor>.<bug-fix>

@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Mar 17, 2022
@bschaatsbergen
Copy link
Member

bschaatsbergen commented Mar 17, 2022

I believe that the only 2 supported versions for ElastiCache Redis are 6.0 and 6.2. By briefly looking at https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/supported-engine-versions.html

Support for 6.x has been added through: #18920

@vnatarov-logz
Copy link
Author

Hi @bschaatsbergen,

Thank you for your reply, but unfortunately - I could not use 6.0. It didn't work.
The working versions:

  • 6.x
  • 5.0.6

Manually, you can create 6.0 and then you will have 6.0.5.

@bschaatsbergen
Copy link
Member

Done some digging, I understand what you mean.

It seems like this was raised through #22385

We can alter the regex pattern (redisVersionPostV6RegexpRaw) to: ([6-9]|[[:digit:]]{2})\.([[:digit:]]+|x)

image

That will allow you to specify 6.0, 6.2 and 6.x (to pull the latest minor version of Redis 6.)

@justinretzolk could you close this issue, I'll pick it up under #22385

@justinretzolk
Copy link
Member

Hey @vnatarov-logz 👋 It looks like this is a duplicate of #22385. We like to try to keep discussion centralized to one location where possible, so we'll close this one in favor of #22385.

@github-actions github-actions bot removed the needs-triage Waiting for first response or review from a maintainer. label Mar 17, 2022
@github-actions
Copy link

github-actions bot commented May 9, 2022

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants