Skip to content

opszero/terraform-aws-memorydb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform-aws-memorydb

Terraform AWS Cloud MemoryDB Module

Table of Contents

Introduction

This Terraform module creates an AWS memorydb along with additional configuration options.

Usage

To use this module, you can include it in your Terraform configuration. Here's an example of how to use it:

Example: memorydb

module "memorydb" {
  source                     = "git::https://github.com/opszero/terraform-aws-memorydb.git?ref=v1.0.1"
  name                       = "memorydb"
  engine_version             = "6.2"
  auto_minor_version_upgrade = true
  node_type                  = "db.t4g.medium"
  num_shards                 = 1
  num_replicas_per_shard     = 1
  data_tiering               = false

  tls_enabled              = true
  security_group_ids       = [module.security_group.security_group_id]
  maintenance_window       = "sun:23:00-mon:01:30"
  snapshot_retention_limit = 7
  snapshot_window          = "05:00-09:00"
  password                 = ""

  # Users
  users = {
    admin = {
      user_name     = "admin-user"
      access_string = "on ~* &* +@all"
      tags          = { user = "admin" }
    }
    readonly = {
      user_name     = "readonly-user"
      access_string = "on ~* &* -@all +@read"
      tags          = { user = "readonly" }
    }
  }

  # ACL
  acl_name = "memorydb-acl"
  # Parameter group
  parameter_group_name        = "memorydb-param-group"
  parameter_group_description = "Example MemoryDB parameter group"
  parameter_group_family      = "memorydb_redis6"
  parameter_group_parameters = [
    {
      name  = "activedefrag"
      value = "yes"
    }
  ]
  parameter_group_tags = {
    parameter_group = "custom"
  }

  # Subnet group
  subnet_group_name = "memorydb-subnet-group"
  subnet_ids        = module.subnets.public_subnet_id
  subnet_group_tags = {
    subnet_group = "custom"
  }

}

Examples

For detailed examples on how to use this module, please refer to the Examples directory within this repository.

Author

Your Name Replace MIT and opsZero with the appropriate license and your information. Feel free to expand this README with additional details or usage instructions as needed for your specific use case.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Providers

Name Version
aws >= 6.14.0
random >= 3.7.2

Inputs

Name Description Type Default Required
acl_name The name of the access control list (ACL) to associate. string null no
acl_user_names List of externally created user names to associate with the ACL list(string) [] no
auto_minor_version_upgrade When set to true, the cluster will automatically receive minor engine version upgrades after launch. Defaults to true bool null no
data_tiering Must be set to true when using a data tiering node type bool null no
engine_version Version number of the Redis engine to be used for the cluster. Downgrades are not supported string null no
kms_key_arn ARN of the KMS key used to encrypt the cluster at rest string null no
maintenance_window Specifies the weekly time range during which maintenance on the cluster is performed. It is specified as a range in the format ddd:hh24:mi-ddd:hh24:mi string null no
name Cluster name - also default name used on all resources if more specific resource names are not provided string "" no
node_type The compute and memory capacity of the nodes in the cluster. See AWS documentation on supported node types as well as vertical scaling string null no
num_replicas_per_shard The number of replicas to apply to each shard, up to a maximum of 5. Defaults to 1 (i.e. 2 nodes per shard) number null no
num_shards The number of shards in the cluster. Defaults to 1 number null no
parameter_group_description Description for the cluster. Defaults to Managed by Terraform string null no
parameter_group_family The engine version that the parameter group can be used with string null no
parameter_group_name The name of the parameter group to be created or used. string null no
parameter_group_parameters A list of parameter maps to apply list(map(string)) [] no
parameter_group_tags A map of tags to assign to the parameter group. map(string) {} no
password The password for the AWS MemoryDB user. Leave empty to generate a random password. string "" no
port The port number on which each of the nodes accepts connections. Defaults to 6379 number null no
security_group_ids Set of VPC Security Group ID-s to associate with this cluster list(string) null no
snapshot_arns List of ARN-s that uniquely identify RDB snapshot files stored in S3. The snapshot files will be used to populate the new cluster list(string) null no
snapshot_name The name of a snapshot from which to restore data into the new cluster string null no
snapshot_retention_limit The number of days for which MemoryDB retains automatic snapshots before deleting them. When set to 0, automatic backups are disabled. Defaults to 0 number null no
snapshot_window The daily time range (in UTC) during which MemoryDB begins taking a daily snapshot of your shard. Example: 05:00-09:00 string null no
subnet_group_name The name of the subnet group to be created or used. string null no
subnet_group_tags A map of tags to assign to the subnet group. map(string) {} no
subnet_ids Set of VPC Subnet ID-s for the subnet group. At least one subnet must be provided list(string) [] no
tags A map of tags to use on all resources map(string) {} no
tls_enabled A flag to enable in-transit encryption on the cluster. When set to false, the acl_name must be open-access. Defaults to true bool null no
users A map of user definitions (maps) to be created any {} no

Resources

Name Type
aws_memorydb_acl.this resource
aws_memorydb_cluster.this resource
aws_memorydb_parameter_group.this resource
aws_memorydb_subnet_group.this resource
aws_memorydb_user.this resource
aws_sns_topic.main resource
aws_ssm_parameter.memorydb_password resource
random_password.main resource

Outputs

Name Description
acl_arn The ARN of the ACL
acl_id Name of the ACL
acl_minimum_engine_version The minimum engine version supported by the ACL
cluster_arn The ARN of the cluster
cluster_endpoint_address DNS hostname of the cluster configuration endpoint
cluster_endpoint_port Port number that the cluster configuration endpoint is listening on
cluster_engine_patch_version Patch version number of the Redis engine used by the cluster
cluster_id Cluster name
cluster_shards Set of shards in this cluster
parameter_group_arn The ARN of the parameter group
parameter_group_id Name of the parameter group
subnet_group_arn ARN of the subnet group
subnet_group_id Name of the subnet group
subnet_group_vpc_id The VPC in which the subnet group exists
users Map of attributes for the users created

🚀 Built by opsZero!

opsZero provides software and consulting for Cloud + AI. With our decade plus of experience scaling some of the world’s most innovative companies we have developed deep expertise in Kubernetes, DevOps, FinOps, and Compliance.

Our software and consulting solutions enable organizations to:

  • migrate workloads to the Cloud
  • setup compliance frameworks including SOC2, HIPAA, PCI-DSS, ITAR, FedRamp, CMMC, and more.
  • FinOps solutions to reduce the cost of running Cloud workloads
  • Kubernetes optimized for web scale and AI workloads
  • finding underutilized Cloud resources
  • setting up custom AI training and delivery
  • building data integrations and scrapers
  • modernizing onto modern ARM based processors

We do this with a high-touch support model where you:

  • Get access to us on Slack, Microsoft Teams or Email
  • Get 24/7 coverage of your infrastructure
  • Get an accelerated migration to Kubernetes

Please schedule a call if you need support.



AWS Advanced Tier AWS DevOps Competency AWS EKS Delivery AWS Public Sector

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages