diff --git a/README.md b/README.md index 942d26f..9464f6f 100644 --- a/README.md +++ b/README.md @@ -296,6 +296,7 @@ Available targets: | [user\_group\_ids](#input\_user\_group\_ids) | User Group ID to associate with the replication group | `list(string)` | `null` | no | | [vpc\_id](#input\_vpc\_id) | VPC ID | `string` | n/a | yes | | [zone\_id](#input\_zone\_id) | Route53 DNS Zone ID as list of string (0 or 1 items). If empty, no custom DNS name will be published.
If the list contains a single Zone ID, a custom DNS name will be pulished in that zone.
Can also be a plain string, but that use is DEPRECATED because of Terraform issues. | `any` | `[]` | no | +| [serverless_snapshot_arns_to_restore](#input\_serverless\_snapshot\_arns\_to\_restore) | The list of ARN(s) of the snapshot that the new serverless cache will be created from. Available for Redis only. | `list(string)` | `[]` | no | ## Outputs diff --git a/examples/serverless/fixtures.us-east-2.tfvars b/examples/serverless/fixtures.us-east-2.tfvars index ffcd792..2c98267 100644 --- a/examples/serverless/fixtures.us-east-2.tfvars +++ b/examples/serverless/fixtures.us-east-2.tfvars @@ -26,4 +26,3 @@ serverless_cache_usage_limits = { at_rest_encryption_enabled = false zone_id = "Z3SO0TKDDQ0RGG" - diff --git a/examples/serverless/main.tf b/examples/serverless/main.tf index 591d1ae..ef24c0e 100644 --- a/examples/serverless/main.tf +++ b/examples/serverless/main.tf @@ -44,15 +44,15 @@ module "cloudwatch_logs" { module "redis" { source = "../../" - serverless_enabled = var.serverless_enabled - zone_id = [aws_route53_zone.private.id] - vpc_id = module.vpc.vpc_id - allowed_security_groups = [module.vpc.vpc_default_security_group_id] - subnets = module.subnets.private_subnet_ids - serverless_major_engine_version = var.serverless_major_engine_version - at_rest_encryption_enabled = var.at_rest_encryption_enabled - serverless_cache_usage_limits = var.serverless_cache_usage_limits - + serverless_enabled = var.serverless_enabled + zone_id = [aws_route53_zone.private.id] + vpc_id = module.vpc.vpc_id + allowed_security_groups = [module.vpc.vpc_default_security_group_id] + subnets = module.subnets.private_subnet_ids + serverless_major_engine_version = var.serverless_major_engine_version + at_rest_encryption_enabled = var.at_rest_encryption_enabled + serverless_cache_usage_limits = var.serverless_cache_usage_limits + serverless_snapshot_arns_to_restore = var.serverless_snapshot_arns_to_restore # Verify that we can safely change security groups (name changes forces new SG) security_group_create_before_destroy = true security_group_name = length(var.sg_name) > 0 ? [var.sg_name] : [] diff --git a/examples/serverless/outputs.tf b/examples/serverless/outputs.tf index 79a25a1..9545f91 100644 --- a/examples/serverless/outputs.tf +++ b/examples/serverless/outputs.tf @@ -41,4 +41,4 @@ output "serverless_host" { output "serverless_enabled" { value = module.redis.serverless_enabled description = "Indicates if serverless mode is enabled" -} \ No newline at end of file +} diff --git a/examples/serverless/variables.tf b/examples/serverless/variables.tf index 832d605..0e95356 100644 --- a/examples/serverless/variables.tf +++ b/examples/serverless/variables.tf @@ -33,4 +33,10 @@ variable "sg_name" { type = string default = "" description = "Name to give to created security group" -} \ No newline at end of file +} + +variable "serverless_snapshot_arns_to_restore" { + type = list(string) + default = [] + description = "The list of ARN(s) of the snapshot that the new serverless cache will be created from. Available for Redis only." +} diff --git a/main.tf b/main.tf index 2ecd728..850660d 100644 --- a/main.tf +++ b/main.tf @@ -234,6 +234,7 @@ resource "aws_elasticache_serverless_cache" "default" { security_group_ids = local.create_security_group ? concat(local.associated_security_group_ids, [module.aws_security_group.id]) : local.associated_security_group_ids daily_snapshot_time = var.serverless_snapshot_time + snapshot_arns_to_restore = var.serverless_snapshot_arns_to_restore description = coalesce(var.description, module.this.id) major_engine_version = var.serverless_major_engine_version snapshot_retention_limit = var.snapshot_retention_limit diff --git a/variables.tf b/variables.tf index d9ec45e..99e1583 100644 --- a/variables.tf +++ b/variables.tf @@ -328,3 +328,9 @@ variable "serverless_cache_usage_limits" { default = {} description = "The usage limits for the serverless cache" } + +variable "serverless_snapshot_arns_to_restore" { + type = list(string) + default = [] + description = "The list of ARN(s) of the snapshot that the new serverless cache will be created from. Available for Redis only." +}