@@ -7,23 +7,23 @@ resource "random_id" "salt" {
7
7
}
8
8
9
9
resource "aws_elasticache_replication_group" "redis" {
10
- replication_group_id = format (" ${ var . format_length } " , " ${ var . name } -${ var . env } " )
11
- description = " Terraform-managed ElastiCache replication group for ${ var . name } -${ var . env } "
12
- num_cache_clusters = var. redis_clusters
13
- node_type = var. redis_node_type
14
- automatic_failover_enabled = var. redis_failover
15
- engine_version = var. redis_version
16
- port = var. redis_port
17
- parameter_group_name = aws_elasticache_parameter_group. redis_parameter_group . id
18
- subnet_group_name = aws_elasticache_subnet_group. redis_subnet_group . id
19
- security_group_ids = compact ([aws_security_group . redis_security_group . id , var . enable_vpn_sg ? var . vpn_sg_id : " " ])
20
- apply_immediately = var. apply_immediately
21
- maintenance_window = var. redis_maintenance_window
22
- snapshot_window = var. redis_snapshot_window
23
- snapshot_retention_limit = var. redis_snapshot_retention_limit
24
- tags = merge ({ " Name" = format (" tf-elasticache-%s" , var. name ) },var. tags )
25
- transit_encryption_enabled = var. transit_encryption_enabled
26
- auth_token = var. transit_encryption_enabled ? var. auth_token : null
10
+ replication_group_id = format (" ${ var . format_length } " , " ${ var . name } -${ var . env } " )
11
+ description = " Terraform-managed ElastiCache replication group for ${ var . name } -${ var . env } "
12
+ num_cache_clusters = var. redis_clusters
13
+ node_type = var. redis_node_type
14
+ automatic_failover_enabled = var. redis_failover
15
+ engine_version = var. redis_version
16
+ port = var. redis_port
17
+ parameter_group_name = aws_elasticache_parameter_group. redis_parameter_group . id
18
+ subnet_group_name = aws_elasticache_subnet_group. redis_subnet_group . id
19
+ security_group_ids = compact ([aws_security_group . redis_security_group . id , var . enable_vpn_sg ? var . vpn_sg_id : " " ])
20
+ apply_immediately = var. apply_immediately
21
+ maintenance_window = var. redis_maintenance_window
22
+ snapshot_window = var. redis_snapshot_window
23
+ snapshot_retention_limit = var. redis_snapshot_retention_limit
24
+ tags = merge ({ " Name" = format (" tf-elasticache-%s" , var. name ) }, var. tags )
25
+ transit_encryption_enabled = var. transit_encryption_enabled
26
+ auth_token = var. transit_encryption_enabled ? var. auth_token : null
27
27
}
28
28
29
29
resource "aws_elasticache_parameter_group" "redis_parameter_group" {
@@ -44,9 +44,11 @@ resource "aws_elasticache_parameter_group" "redis_parameter_group" {
44
44
lifecycle {
45
45
create_before_destroy = true
46
46
}
47
+ tags = merge ({ " Name" = format (" tf-elasticache-%s" , var. name ) }, var. tags )
47
48
}
48
49
49
50
resource "aws_elasticache_subnet_group" "redis_subnet_group" {
50
51
name = replace (format (" %.255s" , lower (replace (" tf-redis-${ var . name } -${ var . env } " , " _" , " -" ))), " /\\ s/" , " -" )
51
52
subnet_ids = var. subnets
53
+ tags = merge ({ " Name" = format (" tf-elasticache-%s" , var. name ) }, var. tags )
52
54
}
0 commit comments