Skip to content

intel/terraform-intel-aws-elasticache-redis

Intel Logo

Intel® Optimized Cloud Modules for Terraform

© Copyright 2024, Intel Corporation

AWS Elasticache Redis module

This module will create an Amazon Elasticache Redis Cluster based on Intel and creates a new or existing VPC. This module leverages the cache.r5.large by default which is the latest Intel Xeon processor available at the time of this module publication.

As you configure your application's environment, choose the configurations for your infrastructure that matches your application's requirements.

Usage

Description

This module provisions ElastiCache_Replication_Group and Parameter Group.

This module builds using recommended settings:

  • Enable Multi-AZ
  • Enable automatic failover
  • Enable at-rest encryption
  • Enable in-transit encryption
  • Enable automated backups

See the Examples folder to reference if you want to deploy in a brand new VPC or an existing VPC.

/examples/redis-simple

Modify the locals of the main.tf with your selection. You can just choose where you want to build

locals {
  region    = "us-west-2"      
   
  }
}

/examples/redis-new-vpc

Modify the locals of the main.tf with your selection. You can adjust the region, node type, and any tags you wish to assign to the resources.

locals {
  region    = "us-west-2"      
  node_type = "cache.r5.large" 

  tags = {
    Owner    = "user@company.com"
    Duration = "24"
  }
}

/examples/redis-novpc

Modify the locals of the main.tf with your selection. You can adjust the region, node type, and any tags you wish to assign to the resources.

locals {
  region     = "us-west-2"      
  node_type  = "cache.r5.large"   
  vpc_id          = "<YOUR-VPC-ID-HERE>"      
  cidr_block = "10.0.0.0/16" 
  public_subnets  = ["<YOUR-subnet-zoneA>", "<YOUR-subnet-zoneB>", "<YOUR-subnet-zoneC>"] #Specify your 3 seperate public subnets in 3 different AZ's
  private_subnets = ["<YOUR-subnet-zoneA>", "<YOUR-subnet-zoneB>", "<YOUR-subnet-zoneC>"] #Specify your 3 seperate private subnets in 3 different AZ's
  tags = {
    Owner    = "user@company.com"
    Duration = "24"
  }
}

Run Terraform

terraform init  
terraform plan
terraform apply 

Note that this example may create resources. Run terraform destroy when you don't need these resources.

Considerations

  • Adjust your region you want to create this module by modifying the entry in the locals section of the module. It is defaulted to run in us-east-2 region within AWS. If you want to run it within any other region, make changes accordingly within the Terraform code

  • Check if you getting errors while running this Terraform code due to AWS defined soft limits or hard limits within your AWS account. Please work with your AWS support team to resolve limit constraints

Requirements

Name Version
terraform >=1.3.0
aws ~> 4.36.0

Providers

No providers.

Modules

Name Source Version

Resources

No resources.

Inputs

Name Description Type Default Required
region Target AWS region to deploy workloads in. string "us-east-2" no

Outputs

Name Description Type Default Required
name The replication group identifier. This parameter is stored as a lowercase string. string n/a yes
node_type The compute and memory capacity of the nodes in the node group. string n/a yes
number_cache_clusters The number of cache clusters (primary and replicas) this replication group will have. string n/a yes
source_cidr_blocks List of source CIDR blocks. list(string) n/a yes
subnet_ids List of VPC Subnet IDs for the cache subnet group. list(string) n/a yes
vpc_id VPC Id to associate with Redis ElastiCache. string n/a yes
apply_immediately Specifies whether any modifications are applied immediately, or during the next maintenance window. bool false no
at_rest_encryption_enabled Whether to enable encryption at rest. bool true no
automatic_failover_enabled Specifies whether a read-only replica will be automatically promoted to read/write primary if the existing primary fails. bool true no
description The description of the all resources. string "Managed by Terraform" no
engine_version The version number of the cache engine to be used for the cache clusters in this replication group. string "6.x" no
family The family of the ElastiCache parameter group. string "redis6.0" no
maintenance_window Specifies the weekly time range for when maintenance on the cache cluster is performed. string "" no
port The port number on which each of the cache nodes will accept connections. number 6379 no
snapshot_retention_limit The number of days for which ElastiCache will retain automatic cache cluster snapshots before deleting them. number 30 no
snapshot_window The daily time range (in UTC) during which ElastiCache will begin taking a daily snapshot of your cache cluster. string "" no
tags A mapping of tags to assign to all resources. map(string) {} no
transit_encryption_enabled Whether to enable encryption in transit. bool true no

Outputs

Name Description
elasticache_parameter_group_id The ElastiCache parameter group name.
elasticache_replication_group_id The ID of the ElastiCache Replication Group.
elasticache_replication_group_member_clusters The identifiers of all the nodes that are part of this replication group.
elasticache_replication_group_primary_endpoint_address The address of the endpoint for the primary node in the replication group.
security_group_arn The ARN of the Redis ElastiCache security group.
security_group_description The description of the Redis ElastiCache security group.
security_group_egress The egress rules of the Redis ElastiCache security group.
security_group_id The ID of the Redis ElastiCache security group.
security_group_ingress The ingress rules of the Redis ElastiCache security group.
security_group_name The name of the Redis ElastiCache security group.
security_group_owner_id The owner ID of the Redis ElastiCache security group.
security_group_vpc_id The VPC ID of the Redis ElastiCache security group.

Requirements

Name Version
terraform >= 0.12
aws ~> 5.31

Providers

Name Version
aws ~> 5.31

Modules

No modules.

Resources

Name Type
aws_elasticache_parameter_group.default resource
aws_elasticache_replication_group.default resource
aws_elasticache_subnet_group.default resource
aws_security_group.default resource
aws_security_group_rule.egress resource
aws_security_group_rule.ingress resource

Inputs

Name Description Type Default Required
apply_immediately Specifies whether any modifications are applied immediately, or during the next maintenance window. bool true no
at_rest_encryption_enabled Whether to enable encryption at rest. bool true no
automatic_failover_enabled Specifies whether a read-only replica will be automatically promoted to read/write primary if the existing primary fails. bool true no
description The description of the all resources. string "Managed by Terraform" no
enable_intel_tags If true adds additional Intel tags to resources bool true no
engine_version The version number of the cache engine to be used for the cache clusters in this replication group. string "6.x" no
family The family of the ElastiCache parameter group. string "redis6.x" no
intel_tags Intel Tags map(string)
{
"intel-module": "terraform-intel-aws-elasticache-redis",
"intel-registry": "https://registry.terraform.io/namespaces/intel"
}
no
maintenance_window Specifies the weekly time range for when maintenance on the cache cluster is performed. string "" no
name The replication group identifier. This parameter is stored as a lowercase string. string "ApplicationName-Prod" no
node_type The compute and memory capacity of the nodes in the node group. string "cache.r5.large" no
num_cache_clusters The number of cache clusters (primary and replicas) this replication group will have. string "3" no
port The port number on which each of the cache nodes will accept connections. number 6379 no
snapshot_retention_limit The number of days for which ElastiCache will retain automatic cache cluster snapshots before deleting them. number 30 no
snapshot_window The daily time range (in UTC) during which ElastiCache will begin taking a daily snapshot of your cache cluster. string "" no
source_cidr_blocks List of source CIDR blocks. list(string) n/a yes
subnet_ids List of VPC Subnet IDs for the cache subnet group. list(string) n/a yes
tags A mapping of tags to assign to all resources. map(string) {} no
transit_encryption_enabled Whether to enable encryption in transit. bool true no
vpc_id VPC Id to associate with Redis ElastiCache. string n/a yes

Outputs

Name Description
elasticache_parameter_group_id The ElastiCache parameter group name.
elasticache_replication_group_id The ID of the ElastiCache Replication Group.
elasticache_replication_group_member_clusters The identifiers of all the nodes that are part of this replication group.
elasticache_replication_group_primary_endpoint_address The address of the endpoint for the primary node in the replication group.
security_group_arn The ARN of the Redis ElastiCache security group.
security_group_description The description of the Redis ElastiCache security group.
security_group_egress The egress rules of the Redis ElastiCache security group.
security_group_id The ID of the Redis ElastiCache security group.
security_group_ingress The ingress rules of the Redis ElastiCache security group.
security_group_name The name of the Redis ElastiCache security group.
security_group_owner_id The owner ID of the Redis ElastiCache security group.
security_group_vpc_id The VPC ID of the Redis ElastiCache security group.