From 999adf260c69598156cb6678d217a03633916a87 Mon Sep 17 00:00:00 2001 From: Nilesh Gadgi Date: Fri, 1 Mar 2024 23:57:57 +0530 Subject: [PATCH] feat: feature snapshot identifier argument and did minor changes (#67) --- .github/workflows/readme.yml | 51 ++--------- _example/memcached/example.tf | 35 +++++--- _example/redis-cluster/example.tf | 34 +++++--- _example/redis/example.tf | 38 ++++---- main.tf | 101 ++++++++++----------- outputs.tf | 20 ++--- variables.tf | 140 ++---------------------------- 7 files changed, 137 insertions(+), 282 deletions(-) diff --git a/.github/workflows/readme.yml b/.github/workflows/readme.yml index 1eb0243..132ced2 100644 --- a/.github/workflows/readme.yml +++ b/.github/workflows/readme.yml @@ -3,51 +3,12 @@ on: push: branches: - master + paths-ignore: + - 'README.md' jobs: readme-create: - name: 'readme-create' - runs-on: ubuntu-latest - steps: - - name: 'Checkout' - uses: actions/checkout@master - - - name: 'Set up Python 3.7' - uses: actions/setup-python@v5 - with: - python-version: '3.x' - - - name: 'create readme' - uses: 'clouddrove/github-actions@9.0.3' - with: - actions_subcommand: 'readme' - github_token: '${{ secrets.GITHUB }}' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: 'pre-commit check errors' - uses: pre-commit/action@v3.0.0 - continue-on-error: true - - - name: 'pre-commit fix erros' - uses: pre-commit/action@v3.0.0 - continue-on-error: true - - - name: 'push readme' - uses: 'clouddrove/github-actions@9.0.3' - continue-on-error: true - with: - actions_subcommand: 'push' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: 'Slack Notification' - uses: clouddrove/action-slack@v2 - with: - status: ${{ job.status }} - fields: repo,author - author_name: 'CloudDrove' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} # required - if: always() + uses: clouddrove/github-shared-workflows/.github/workflows/readme.yml@1.2.2 + secrets: + TOKEN: ${{ secrets.GITHUB }} + SLACK_WEBHOOK_TERRAFORM: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} \ No newline at end of file diff --git a/_example/memcached/example.tf b/_example/memcached/example.tf index 2a27e2b..c15cb5d 100644 --- a/_example/memcached/example.tf +++ b/_example/memcached/example.tf @@ -55,16 +55,21 @@ module "memcached" { cluster_enabled = true memcached_ssm_parameter_endpoint_enabled = true - memcached_route53_record_enabled = true - engine = "memcached" - engine_version = "1.6.17" - parameter_group_name = "" - az_mode = "cross-az" - port = 11211 - node_type = "cache.t2.micro" - num_cache_nodes = 2 - subnet_ids = module.subnets.public_subnet_id - availability_zones = ["eu-west-1a", "eu-west-1b"] + memcached_route53_record_enabled = false + + replication_group = { + engine = "memcached" + engine_version = "1.6.17" + parameter_group_name = "" + port = 11211 + node_type = "cache.t2.micro" + parameter_group_name = "" + } + + az_mode = "cross-az" + num_cache_nodes = 2 + subnet_ids = module.subnets.public_subnet_id + availability_zones = ["eu-west-1a", "eu-west-1b"] extra_tags = { Application = "CloudDrove" } @@ -74,8 +79,10 @@ module "memcached" { ####---------------------------------------------------------------------------------- route53_record_enabled = false ssm_parameter_endpoint_enabled = false - dns_record_name = "prod" - route53_ttl = "300" - route53_type = "CNAME" - route53_zone_id = "SERFxxxx6XCsY9Lxxxxx" + route53 = { + dns_record_name = "prod" + route53_ttl = "300" + route53_type = "CNAME" + route53_zone_id = "SERFxxxx6XCsY9Lxxxxx" # Change Zone ID with Route53 Zone ID from looking at AWS Console + } } diff --git a/_example/redis-cluster/example.tf b/_example/redis-cluster/example.tf index 5bb9ce1..84c31ec 100644 --- a/_example/redis-cluster/example.tf +++ b/_example/redis-cluster/example.tf @@ -57,16 +57,20 @@ module "redis-cluster" { allowed_ports = [6379] cluster_replication_enabled = true - engine = "redis" - engine_version = "7.0" - parameter_group_name = "default.redis7.cluster.on" - port = 6379 - node_type = "cache.t2.micro" - subnet_ids = module.subnets.public_subnet_id - availability_zones = ["eu-west-1a", "eu-west-1b"] - num_cache_nodes = 1 - snapshot_retention_limit = 7 - automatic_failover_enabled = true + + replication_group = { + engine = "redis" + engine_version = "7.0" + parameter_group_name = "default.redis7.cluster.on" + port = 6379 + node_type = "cache.t2.micro" + snapshot_retention_limit = 7 + automatic_failover_enabled = true + } + + subnet_ids = module.subnets.public_subnet_id + availability_zones = ["eu-west-1a", "eu-west-1b"] + num_cache_nodes = 1 extra_tags = { Application = "CloudDrove" } @@ -76,8 +80,10 @@ module "redis-cluster" { ###---------------------------------------------------------------------------------- route53_record_enabled = false ssm_parameter_endpoint_enabled = false - dns_record_name = "prod" - route53_ttl = "300" - route53_type = "CNAME" - route53_zone_id = "SERFxxxx6XCsY9Lxxxxx" + route53 = { + dns_record_name = "prod" + route53_ttl = "300" + route53_type = "CNAME" + route53_zone_id = "SERFxxxx6XCsY9Lxxxxx" + } } diff --git a/_example/redis/example.tf b/_example/redis/example.tf index 58d20cc..4df40d6 100644 --- a/_example/redis/example.tf +++ b/_example/redis/example.tf @@ -58,18 +58,20 @@ module "redis" { allowed_ports = [6379] cluster_replication_enabled = true - engine = "redis" - engine_version = "7.0" - parameter_group_name = "default.redis7" - port = 6379 - node_type = "cache.t2.micro" - subnet_ids = module.subnets.public_subnet_id - availability_zones = [""] - automatic_failover_enabled = false - multi_az_enabled = false - num_cache_clusters = 1 - retention_in_days = 0 - snapshot_retention_limit = 7 + + replication_group = { + engine = "redis" + engine_version = "7.0" + parameter_group_name = "default.redis7" + port = 6379 + node_type = "cache.t2.micro" + automatic_failover_enabled = false + num_cache_clusters = 1 + } + + subnet_ids = module.subnets.public_subnet_id + availability_zones = [""] + retention_in_days = 0 log_delivery_configuration = [ { @@ -90,10 +92,12 @@ module "redis" { ####---------------------------------------------------------------------------------- ## will create ROUTE-53 for redis which will add the dns of the cluster. ####---------------------------------------------------------------------------------- - route53_record_enabled = true + route53_record_enabled = false ssm_parameter_endpoint_enabled = true - dns_record_name = "prod" - route53_ttl = "300" - route53_type = "CNAME" - route53_zone_id = "Z017xxxxDLxxx0GH04" + route53 = { + dns_record_name = "prod" + route53_ttl = "300" + route53_type = "CNAME" + route53_zone_id = "Z017xxxxDLxxx0GH04" + } } diff --git a/main.tf b/main.tf index e65ba6d..d6df5d1 100644 --- a/main.tf +++ b/main.tf @@ -18,7 +18,7 @@ module "labels" { ## Below resources will create SECURITY-GROUP and its components. ##---------------------------------------------------------------------------------- resource "aws_security_group" "default" { - count = var.enable_security_group && length(var.sg_ids) < 1 ? 1 : 0 + count = var.enable && var.enable_security_group && length(var.sg_ids) < 1 ? 1 : 0 name = format("%s-sg", module.labels.id) vpc_id = var.vpc_id @@ -34,7 +34,7 @@ resource "aws_security_group" "default" { ##---------------------------------------------------------------------------------- #tfsec:ignore:aws-ec2-no-public-egress-sgr resource "aws_security_group_rule" "egress" { - count = (var.enable_security_group == true && length(var.sg_ids) < 1 && var.is_external == false && var.egress_rule == true) ? 1 : 0 + count = (var.enable && var.enable_security_group == true && length(var.sg_ids) < 1 && var.is_external == false && var.egress_rule == true) ? 1 : 0 description = var.sg_egress_description type = "egress" @@ -46,7 +46,7 @@ resource "aws_security_group_rule" "egress" { } #tfsec:ignore:aws-ec2-no-public-egress-sgr resource "aws_security_group_rule" "egress_ipv6" { - count = (var.enable_security_group == true && length(var.sg_ids) < 1 && var.is_external == false) && var.egress_rule == true ? 1 : 0 + count = (var.enable && var.enable_security_group == true && length(var.sg_ids) < 1 && var.is_external == false) && var.egress_rule == true ? 1 : 0 description = var.sg_egress_ipv6_description type = "egress" @@ -57,7 +57,7 @@ resource "aws_security_group_rule" "egress_ipv6" { security_group_id = join("", aws_security_group.default[*].id) } resource "aws_security_group_rule" "ingress" { - count = length(var.allowed_ip) > 0 == true && length(var.sg_ids) < 1 ? length(compact(var.allowed_ports)) : 0 + count = var.enable && length(var.allowed_ip) > 0 == true && length(var.sg_ids) < 1 ? length(compact(var.allowed_ports)) : 0 description = var.sg_ingress_description type = "ingress" @@ -72,7 +72,7 @@ resource "aws_security_group_rule" "ingress" { ## Below resources will create KMS-KEY and its components. ##---------------------------------------------------------------------------------- resource "aws_kms_key" "default" { - count = var.kms_key_enabled && var.kms_key_id == "" ? 1 : 0 + count = var.enable && var.kms_key_enabled && var.kms_key_id == "" ? 1 : 0 description = var.kms_description key_usage = var.key_usage @@ -86,7 +86,7 @@ resource "aws_kms_key" "default" { } resource "aws_kms_alias" "default" { - count = var.kms_key_enabled && var.kms_key_id == "" ? 1 : 0 + count = var.enable && var.kms_key_enabled && var.kms_key_id == "" ? 1 : 0 name = coalesce(var.alias, format("alias/%v", module.labels.id)) target_key_id = var.kms_key_id == "" ? join("", aws_kms_key.default[*].id) : var.kms_key_id @@ -142,7 +142,7 @@ resource "aws_elasticache_subnet_group" "default" { ##---------------------------------------------------------------------------------- resource "random_password" "auth_token" { - count = var.auth_token_enable && var.auth_token == null ? 1 : 0 + count = var.enable && var.auth_token_enable && var.auth_token == null ? 1 : 0 length = var.length special = var.special } @@ -153,32 +153,33 @@ resource "random_password" "auth_token" { resource "aws_elasticache_replication_group" "cluster" { count = var.enable && var.cluster_replication_enabled ? 1 : 0 - engine = var.engine + engine = lookup(var.replication_group, "engine", "") replication_group_id = module.labels.id - description = var.replication_group_description - engine_version = var.engine_version - port = var.port - parameter_group_name = var.parameter_group_name - node_type = var.node_type - automatic_failover_enabled = var.automatic_failover_enabled + description = lookup(var.replication_group, "replication_group_description", "User-created description for the replication group.") + engine_version = lookup(var.replication_group, "engine_version", "") + port = lookup(var.replication_group, "port", "") + parameter_group_name = lookup(var.replication_group, "parameter_group_name", "default.redis5.0") + node_type = lookup(var.replication_group, "node_type", "cache.t2.small") + automatic_failover_enabled = lookup(var.replication_group, "automatic_failover_enabled", true) subnet_group_name = join("", aws_elasticache_subnet_group.default[*].name) security_group_ids = length(var.sg_ids) < 1 ? aws_security_group.default[*].id : var.sg_ids security_group_names = var.security_group_names snapshot_arns = var.snapshot_arns - snapshot_name = var.snapshot_name - notification_topic_arn = var.notification_topic_arn - snapshot_window = var.snapshot_window - snapshot_retention_limit = var.snapshot_retention_limit - apply_immediately = var.apply_immediately - auto_minor_version_upgrade = var.auto_minor_version_upgrade - maintenance_window = var.maintenance_window - at_rest_encryption_enabled = var.at_rest_encryption_enabled - transit_encryption_enabled = var.transit_encryption_enabled - multi_az_enabled = var.multi_az_enabled - auth_token = var.auth_token_enable ? (var.auth_token == null ? random_password.auth_token[0].result : var.auth_token) : null + snapshot_name = lookup(var.replication_group, "snapshot_name", "") + notification_topic_arn = lookup(var.replication_group, "notification_topic_arn", "") + snapshot_window = lookup(var.replication_group, "snapshot_window", null) + final_snapshot_identifier = lookup(var.replication_group, "final_snapshot_identifier", null) + snapshot_retention_limit = lookup(var.replication_group, "snapshot_retention_limit", "0") + apply_immediately = lookup(var.replication_group, "apply_immediately", false) + auto_minor_version_upgrade = lookup(var.replication_group, "auto_minor_version_upgrade", true) + maintenance_window = lookup(var.replication_group, "maintenance_window", "sun:05:00-sun:06:00") + at_rest_encryption_enabled = lookup(var.replication_group, "at_rest_encryption_enabled", true) + transit_encryption_enabled = lookup(var.replication_group, "transit_encryption_enabled", true) + multi_az_enabled = lookup(var.replication_group, "multi_az_enabled", false) + auth_token = var.auth_token_enable ? (var.auth_token == null ? random_password.auth_token[0].result : var.auth_token) : "" kms_key_id = var.kms_key_id == "" ? join("", aws_kms_key.default[*].arn) : var.kms_key_id tags = module.labels.tags - num_cache_clusters = var.num_cache_clusters + num_cache_clusters = lookup(var.replication_group, "num_cache_clusters", 1) user_group_ids = var.user_group_ids dynamic "log_delivery_configuration" { @@ -198,24 +199,24 @@ resource "aws_elasticache_replication_group" "cluster" { ##---------------------------------------------------------------------------------- resource "aws_elasticache_cluster" "default" { count = var.enable && var.cluster_enabled ? 1 : 0 - engine = var.engine + engine = lookup(var.replication_group, "engine", "") cluster_id = module.labels.id - engine_version = var.engine_version - port = var.port + engine_version = lookup(var.replication_group, "engine_version", "") + port = lookup(var.replication_group, "port", "") num_cache_nodes = var.num_cache_nodes az_mode = var.az_mode - parameter_group_name = var.parameter_group_name - node_type = var.node_type + parameter_group_name = lookup(var.replication_group, "parameter_group_name", "default.redis5.0") + node_type = lookup(var.replication_group, "node_type", "cache.t2.small") subnet_group_name = join("", aws_elasticache_subnet_group.default[*].name) security_group_ids = length(var.sg_ids) < 1 ? aws_security_group.default[*].id : var.sg_ids snapshot_arns = var.snapshot_arns - snapshot_name = var.snapshot_name - notification_topic_arn = var.notification_topic_arn - snapshot_window = var.snapshot_window - snapshot_retention_limit = var.snapshot_retention_limit - apply_immediately = var.apply_immediately + snapshot_name = lookup(var.replication_group, "snapshot_name", "") + notification_topic_arn = lookup(var.replication_group, "notification_topic_arn", "") + snapshot_window = lookup(var.replication_group, "snapshot_window", null) + snapshot_retention_limit = lookup(var.replication_group, "snapshot_retention_limit", "0") + apply_immediately = lookup(var.replication_group, "apply_immediately", false) preferred_availability_zones = slice(var.availability_zones, 0, var.num_cache_nodes) - maintenance_window = var.maintenance_window + maintenance_window = lookup(var.replication_group, "maintenance_window", "sun:05:00-sun:06:00") tags = module.labels.tags } @@ -226,18 +227,18 @@ resource "aws_elasticache_cluster" "default" { resource "aws_route53_record" "elasticache" { count = var.enable && var.route53_record_enabled ? 1 : 0 - name = var.dns_record_name - type = var.route53_type - ttl = var.route53_ttl - zone_id = var.route53_zone_id - records = var.automatic_failover_enabled ? [join("", aws_elasticache_replication_group.cluster[*].configuration_endpoint_address)] : [join("", aws_elasticache_replication_group.cluster[*].primary_endpoint_address)] + name = lookup(var.route53, "dns_record_name", "elasticache") + type = lookup(var.route53, "route53_type", "") + ttl = lookup(var.route53, "route53_ttl", null) + zone_id = lookup(var.route53, "route53_zone_id", null) + records = lookup(var.replication_group, "automatic_failover_enabled", true) ? [aws_elasticache_replication_group.cluster[0].configuration_endpoint_address] : [aws_elasticache_replication_group.cluster[0].primary_endpoint_address] } ##---------------------------------------------------------------------------------- ## Below resource will create ssm-parameter resource for redis and memcached with auth-token. ##---------------------------------------------------------------------------------- resource "aws_ssm_parameter" "secret" { - count = var.auth_token_enable ? 1 : 0 + count = var.enable && var.auth_token_enable ? 1 : 0 name = format("/%s/%s/auth-token", var.environment, var.name) description = var.ssm_parameter_description @@ -255,7 +256,7 @@ resource "aws_ssm_parameter" "secret-endpoint" { name = format("/%s/%s/endpoint", var.environment, var.name) description = var.ssm_parameter_description type = var.ssm_parameter_type - value = var.automatic_failover_enabled ? [join("", aws_elasticache_replication_group.cluster[*].configuration_endpoint_address)][0] : [join("", aws_elasticache_replication_group.cluster[*].primary_endpoint_address)][0] + value = lookup(var.replication_group, "automatic_failover_enabled", true) ? [join("", aws_elasticache_replication_group.cluster[*].configuration_endpoint_address)][0] : [join("", aws_elasticache_replication_group.cluster[*].primary_endpoint_address)][0] key_id = var.kms_key_id == "" ? join("", aws_kms_key.default[*].arn) : var.kms_key_id } @@ -263,12 +264,12 @@ resource "aws_ssm_parameter" "secret-endpoint" { ## Below resource will create ROUTE-53 resource for memcached. ##---------------------------------------------------------------------------------- resource "aws_route53_record" "memcached_route_53" { - count = var.memcached_route53_record_enabled ? 1 : 0 + count = var.enable && var.memcached_route53_record_enabled ? 1 : 0 - name = var.dns_record_name - zone_id = var.route53_zone_id - type = var.route53_type - ttl = var.route53_ttl + name = lookup(var.route53, "dns_record_name", "") + type = lookup(var.route53, "route53_type", "A") + ttl = lookup(var.route53, "route53_ttl", 300) + zone_id = lookup(var.route53, "route53_zone_id", null) records = aws_elasticache_cluster.default[*].configuration_endpoint } @@ -276,7 +277,7 @@ resource "aws_route53_record" "memcached_route_53" { ## Below resource will create ssm-parameter resource for memcached with endpoint. ##---------------------------------------------------------------------------------- resource "aws_ssm_parameter" "memcached_secret-endpoint" { - count = var.memcached_ssm_parameter_endpoint_enabled ? 1 : 0 + count = var.enable && var.memcached_ssm_parameter_endpoint_enabled ? 1 : 0 name = format("/%s/%s/memcached-endpoint", var.environment, var.name) description = var.ssm_parameter_description diff --git a/outputs.tf b/outputs.tf index c222e09..69d67ee 100644 --- a/outputs.tf +++ b/outputs.tf @@ -6,7 +6,7 @@ output "id" { } output "port" { - value = var.port + value = lookup(var.replication_group, "port", null) sensitive = true description = "Redis port." } @@ -22,46 +22,46 @@ output "redis_endpoint" { } output "redis_arn" { - value = length(aws_elasticache_replication_group.cluster) > 0 ? aws_elasticache_replication_group.cluster[0].arn : length(aws_elasticache_replication_group.cluster) > 0 ? aws_elasticache_replication_group.cluster[0].arn : "" + value = var.enable && length(aws_elasticache_replication_group.cluster) > 0 ? aws_elasticache_replication_group.cluster[0].arn : length(aws_elasticache_replication_group.cluster) > 0 ? aws_elasticache_replication_group.cluster[0].arn : null description = "Redis arn" } output "memcached_endpoint" { - value = var.cluster_enabled ? join("", aws_elasticache_cluster.default[*].configuration_endpoint) : "" + value = var.enable && var.cluster_enabled ? join("", aws_elasticache_cluster.default[*].configuration_endpoint) : null description = "Memcached endpoint address." } output "memcached_arn" { - value = length(aws_elasticache_cluster.default) > 0 ? aws_elasticache_cluster.default[0].arn : "" + value = var.enable && length(aws_elasticache_cluster.default) > 0 ? aws_elasticache_cluster.default[0].arn : null description = "Memcached arn" } output "sg_id" { - value = join("", aws_security_group.default[*].id) + value = try(join("", aws_security_group.default[*].id), null) } output "hostname" { - value = join("", aws_route53_record.elasticache[*].fqdn) + value = try(join("", aws_route53_record.elasticache[*].fqdn), null) description = "DNS hostname" } output "memcached_hostname" { - value = join("", aws_route53_record.memcached_route_53[*].fqdn) + value = try(join("", aws_route53_record.memcached_route_53[*].fqdn), null) description = "DNS hostname" } output "redis_ssm_name" { - value = join("", aws_ssm_parameter.secret-endpoint[*].name) + value = try(join("", aws_ssm_parameter.secret-endpoint[*].name), null) description = "A list of all of the parameter values" } output "Memcached_ssm_name" { - value = join("", aws_ssm_parameter.memcached_secret-endpoint[*].name) + value = try(join("", aws_ssm_parameter.memcached_secret-endpoint[*].name), null) description = "A list of all of the parameter values" } output "auth_token" { - value = var.auth_token_enable ? random_password.auth_token[0].result : "" + value = var.enable && var.auth_token_enable ? random_password.auth_token[0].result : null sensitive = true description = "Auth token generated value" } \ No newline at end of file diff --git a/variables.tf b/variables.tf index 6e9d871..eb5168e 100644 --- a/variables.tf +++ b/variables.tf @@ -47,43 +47,11 @@ variable "enable" { description = "Enable or disable of elasticache" } -variable "engine" { - type = string - default = "" - description = "The name of the cache engine to be used for the clusters in this replication group. e.g. redis." -} - -variable "automatic_failover_enabled" { - type = bool - default = true - description = "Specifies whether a read-only replica will be automatically promoted to read/write primary if the existing primary fails. If true, Multi-AZ is enabled for this replication group. If false, Multi-AZ is disabled for this replication group. Must be enabled for Redis (cluster mode enabled) replication groups. Defaults to false." -} - -variable "engine_version" { - type = string - default = "" - description = "The version number of the cache engine to be used for the cache clusters in this replication group." -} - -variable "port" { - type = string - default = "" - description = "the port number on which each of the cache nodes will accept connections." - sensitive = true -} - variable "user_group_ids" { type = list(string) - default = [""] + default = null description = "User Group ID to associate with the replication group." } - -variable "node_type" { - type = string - default = "cache.t2.small" - description = "The compute and memory capacity of the nodes in the node group." -} - variable "security_group_names" { type = list(string) default = null @@ -96,36 +64,9 @@ variable "snapshot_arns" { description = "A single-element string list containing an Amazon Resource Name (ARN) of a Redis RDB snapshot file stored in Amazon S3." } -variable "snapshot_name" { - type = string - default = "" - description = "The name of a snapshot from which to restore data into the new node group. Changing the snapshot_name forces a new resource." - sensitive = true -} - -variable "snapshot_window" { - type = string - default = null - description = "(Redis only) The daily time range (in UTC) during which ElastiCache will begin taking a daily snapshot of your cache cluster. The minimum snapshot window is a 60 minute period." -} - -variable "snapshot_retention_limit" { - type = string - default = "0" - description = "(Redis only) The number of days for which ElastiCache will retain automatic cache cluster snapshots before deleting them. For example, if you set SnapshotRetentionLimit to 5, then a snapshot that was taken today will be retained for 5 days before being deleted. If the value of SnapshotRetentionLimit is set to zero (0), backups are turned off. Please note that setting a snapshot_retention_limit is not supported on cache.t1.micro or cache.t2.* cache nodes." -} - -variable "notification_topic_arn" { - type = string - default = "" - description = "An Amazon Resource Name (ARN) of an SNS topic to send ElastiCache notifications to." - sensitive = true -} - -variable "apply_immediately" { - type = bool - default = false - description = "Specifies whether any modifications are applied immediately, or during the next maintenance window. Default is false." +variable "replication_group" { + type = map(any) + default = {} } variable "subnet_ids" { @@ -140,47 +81,12 @@ variable "subnet_group_description" { default = "The Description of the ElastiCache Subnet Group." description = "Description for the cache subnet group. Defaults to `Managed by Terraform`." } -variable "replication_group_description" { - type = string - default = "User-created description for the replication group." - description = "Name of either the CloudWatch Logs LogGroup or Kinesis Data Firehose resource." -} variable "availability_zones" { type = list(string) description = "A list of EC2 availability zones in which the replication group's cache clusters will be created. The order of the availability zones in the list is not important." } -variable "num_cache_clusters" { - type = number - default = 1 - description = "(Required for Cluster Mode Disabled) The number of cache clusters (primary and replicas) this replication group will have. If Multi-AZ is enabled, the value of this parameter must be at least 2. Updates will occur before other modifications." -} - -variable "auto_minor_version_upgrade" { - type = bool - default = true - description = "Specifies whether a minor engine upgrades will be applied automatically to the underlying Cache Cluster instances during the maintenance window. Defaults to true." -} - -variable "maintenance_window" { - type = string - default = "sun:05:00-sun:06:00" - description = "Maintenance window." -} - -variable "at_rest_encryption_enabled" { - type = bool - default = true - description = "Enable encryption at rest." -} - -variable "transit_encryption_enabled" { - type = bool - default = true - description = "Whether to enable encryption in transit." -} - variable "auth_token_enable" { type = bool default = true @@ -219,12 +125,6 @@ variable "az_mode" { description = "(Memcached only) Specifies whether the nodes in this Memcached node group are created in a single Availability Zone or created across multiple Availability Zones in the cluster's region. Valid values for this parameter are single-az or cross-az, default is single-az. If you want to choose cross-az, num_cache_nodes must be greater than 1." } -variable "parameter_group_name" { - type = string - default = "default.redis5.0" - description = "The name of the parameter group to associate with this replication group. If this argument is omitted, the default cache parameter group for the specified engine is used." -} - variable "log_delivery_configuration" { type = list(map(any)) default = [] @@ -237,13 +137,6 @@ variable "retention_in_days" { description = "Specifies the number of days you want to retain log events in the specified log group." } -variable "multi_az_enabled" { - type = bool - default = false - description = "Specifies whether to enable Multi-AZ Support for the replication group. If true, automatic_failover_enabled must also be enabled. Defaults to false." - -} - variable "kms_key_enabled" { type = bool default = true @@ -390,27 +283,10 @@ variable "memcached_route53_record_enabled" { description = "Whether to create Route53 record memcached set." } -variable "route53_type" { - type = string - default = "" - description = "The record type. Valid values are A, AAAA, CAA, CNAME, MX, NAPTR, NS, PTR, SOA, SPF, SRV and TXT. " -} - -variable "route53_ttl" { - type = string - default = "" - description = "(Required for non-alias records) The TTL of the record." -} - -variable "dns_record_name" { - type = string - default = "" - description = "The name of the record." -} - -variable "route53_zone_id" { - type = string - description = "Zone ID." +variable "route53" { + type = map(any) + default = {} + description = "Route53 Configurations." } ###------------------------------- ssm_parameter----------------------------