5
5
# https://www.terraform.io/docs/providers/aws/r/elasticache_replication_group.html
6
6
resource "aws_elasticache_replication_group" "default" {
7
7
engine = " redis"
8
- parameter_group_name = " ${ aws_elasticache_parameter_group . default . name } "
9
- subnet_group_name = " ${ aws_elasticache_subnet_group . default . name } "
10
- security_group_ids = [" ${ aws_security_group . default . id } " ]
8
+ parameter_group_name = aws_elasticache_parameter_group. default . name
9
+ subnet_group_name = aws_elasticache_subnet_group. default . name
10
+ security_group_ids = [aws_security_group . default . id ]
11
11
12
12
# The replication group identifier. This parameter is stored as a lowercase string.
13
13
#
@@ -17,100 +17,100 @@ resource "aws_elasticache_replication_group" "default" {
17
17
# - Cannot end with a hyphen.
18
18
#
19
19
# https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/Clusters.Create.CON.Redis.html
20
- replication_group_id = " ${ var . name } "
20
+ replication_group_id = var. name
21
21
22
22
# The number of clusters this replication group initially has.
23
23
# If automatic_failover_enabled is true, the value of this parameter must be at least 2.
24
24
# The maximum permitted value for number_cache_clusters is 6 (1 primary plus 5 replicas).
25
25
# https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/Scaling.RedisReplGrps.html
26
- number_cache_clusters = " ${ var . number_cache_clusters } "
26
+ number_cache_clusters = var. number_cache_clusters
27
27
28
28
# The compute and memory capacity of the nodes in the node group (shard).
29
29
# Generally speaking, the current generation types provide more memory and computational power at lower cost
30
30
# when compared to their equivalent previous generation counterparts.
31
31
# https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/CacheNodes.SupportedTypes.html
32
- node_type = " ${ var . node_type } "
32
+ node_type = var. node_type
33
33
34
34
# The version number of the cache engine to be used for the clusters in this replication group.
35
35
# You can upgrade to a newer engine version, but you cannot downgrade to an earlier engine version.
36
36
# https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/supported-engine-versions.html
37
- engine_version = " ${ var . engine_version } "
37
+ engine_version = var. engine_version
38
38
39
39
# The port number on which each member of the replication group accepts connections.
40
40
# Redis default port is 6379.
41
- port = " ${ var . port } "
41
+ port = var. port
42
42
43
43
# Every cluster and replication group has a weekly maintenance window during which any system changes are applied.
44
44
# Specifies the weekly time range during which maintenance on the cluster is performed.
45
45
# It is specified as a range in the format ddd:hh24:mi-ddd:hh24:mi. (Example: "sun:23:00-mon:01:30")
46
46
# The minimum maintenance window is a 60 minute period.
47
47
# https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/maintenance-window.html
48
- maintenance_window = " ${ var . maintenance_window } "
48
+ maintenance_window = var. maintenance_window
49
49
50
50
# A period during each day when ElastiCache will begin creating a backup.
51
51
# The minimum length for the backup window is 60 minutes.
52
52
# If you do not specify a backup window, ElastiCache will assign one automatically.
53
53
# https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/backups-automatic.html
54
- snapshot_window = " ${ var . snapshot_window } "
54
+ snapshot_window = var. snapshot_window
55
55
56
56
# The number of days the backup will be retained in Amazon S3.
57
57
# The maximum backup retention limit is 35 days.
58
58
# If the backup retention limit is set to 0, automatic backups are disabled for the cluster.
59
59
# https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/backups-automatic.html
60
- snapshot_retention_limit = " ${ var . snapshot_retention_limit } "
60
+ snapshot_retention_limit = var. snapshot_retention_limit
61
61
62
62
# You can enable Multi-AZ with Automatic Failover only on Redis (cluster mode disabled) clusters that have at least
63
63
# one available read replica. Clusters without read replicas do not provide high availability or fault tolerance.
64
64
# https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/AutoFailover.html
65
- automatic_failover_enabled = " ${ var . automatic_failover_enabled } "
65
+ automatic_failover_enabled = var. automatic_failover_enabled
66
66
67
67
# Redis at-rest encryption is an optional feature to increase data security by encrypting on-disk data during sync
68
68
# and backup or snapshot operations. Because there is some processing needed to encrypt and decrypt the data,
69
69
# enabling at-rest encryption can have some performance impact during these operations.
70
70
# You should benchmark your data with and without at-rest encryption to determine the performance impact for your use cases.
71
71
# https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/at-rest-encryption.html
72
- at_rest_encryption_enabled = " ${ var . at_rest_encryption_enabled } "
72
+ at_rest_encryption_enabled = var. at_rest_encryption_enabled
73
73
74
74
# ElastiCache in-transit encryption is an optional feature that allows you to increase the security of your data at
75
75
# its most vulnerable points—when it is in transit from one location to another. Because there is some processing
76
76
# needed to encrypt and decrypt the data at the endpoints, enabling in-transit encryption can have some performance impact.
77
77
# You should benchmark your data with and without in-transit encryption to determine the performance impact for your use cases.
78
78
# https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/in-transit-encryption.html
79
- transit_encryption_enabled = " ${ var . transit_encryption_enabled } "
79
+ transit_encryption_enabled = var. transit_encryption_enabled
80
80
81
81
# If true, this parameter causes the modifications in this request and any pending modifications to be applied,
82
82
# asynchronously and as soon as possible, regardless of the maintenance_window setting for the replication group.
83
83
# apply_immediately applies only to modifications in node type, engine version, and changing the number of nodes in a cluster.
84
84
# Other modifications, such as changing the maintenance window, are applied immediately.
85
85
# https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/Clusters.Modify.html
86
- apply_immediately = " ${ var . apply_immediately } "
86
+ apply_immediately = var. apply_immediately
87
87
88
88
# A user-created description for the replication group.
89
- replication_group_description = " ${ var . description } "
89
+ replication_group_description = var. description
90
90
91
91
# A mapping of tags to assign to the resource.
92
- tags = " ${ merge (map ( " Name" , var. name ) , var. tags )} "
92
+ tags = merge ({ " Name" = var.name } , var. tags )
93
93
}
94
94
95
95
# https://www.terraform.io/docs/providers/aws/r/elasticache_parameter_group.html
96
96
resource "aws_elasticache_parameter_group" "default" {
97
- name = " ${ var . name } "
98
- family = " ${ var . family } "
99
- description = " ${ var . description } "
97
+ name = var. name
98
+ family = var. family
99
+ description = var. description
100
100
}
101
101
102
102
# https://www.terraform.io/docs/providers/aws/r/elasticache_subnet_group.html
103
103
resource "aws_elasticache_subnet_group" "default" {
104
- name = " ${ var . name } "
105
- subnet_ids = [ " ${ var . subnet_ids } " ]
106
- description = " ${ var . description } "
104
+ name = var. name
105
+ subnet_ids = var. subnet_ids
106
+ description = var. description
107
107
}
108
108
109
109
# https://www.terraform.io/docs/providers/aws/r/security_group.html
110
110
resource "aws_security_group" "default" {
111
- name = " ${ local . security_group_name } "
112
- vpc_id = " ${ var . vpc_id } "
113
- tags = " ${ merge (map ( " Name" , local. security_group_name ) , var. tags )} "
111
+ name = local. security_group_name
112
+ vpc_id = var. vpc_id
113
+ tags = merge ({ " Name" = local.security_group_name } , var. tags )
114
114
}
115
115
116
116
locals {
@@ -120,11 +120,11 @@ locals {
120
120
# https://www.terraform.io/docs/providers/aws/r/security_group_rule.html
121
121
resource "aws_security_group_rule" "ingress" {
122
122
type = " ingress"
123
- from_port = " ${ var . port } "
124
- to_port = " ${ var . port } "
123
+ from_port = var. port
124
+ to_port = var. port
125
125
protocol = " tcp"
126
- cidr_blocks = [ " ${ var . ingress_cidr_blocks } " ]
127
- security_group_id = " ${ aws_security_group . default . id } "
126
+ cidr_blocks = var. ingress_cidr_blocks
127
+ security_group_id = aws_security_group. default . id
128
128
}
129
129
130
130
resource "aws_security_group_rule" "egress" {
@@ -133,5 +133,5 @@ resource "aws_security_group_rule" "egress" {
133
133
to_port = 0
134
134
protocol = " -1"
135
135
cidr_blocks = [" 0.0.0.0/0" ]
136
- security_group_id = " ${ aws_security_group . default . id } "
136
+ security_group_id = aws_security_group. default . id
137
137
}
0 commit comments