55# https://www.terraform.io/docs/providers/aws/r/elasticache_replication_group.html
66resource "aws_elasticache_replication_group" "default" {
77 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 ]
1111
1212 # The replication group identifier. This parameter is stored as a lowercase string.
1313 #
@@ -17,100 +17,100 @@ resource "aws_elasticache_replication_group" "default" {
1717 # - Cannot end with a hyphen.
1818 #
1919 # 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
2121
2222 # The number of clusters this replication group initially has.
2323 # If automatic_failover_enabled is true, the value of this parameter must be at least 2.
2424 # The maximum permitted value for number_cache_clusters is 6 (1 primary plus 5 replicas).
2525 # 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
2727
2828 # The compute and memory capacity of the nodes in the node group (shard).
2929 # Generally speaking, the current generation types provide more memory and computational power at lower cost
3030 # when compared to their equivalent previous generation counterparts.
3131 # https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/CacheNodes.SupportedTypes.html
32- node_type = " ${ var . node_type } "
32+ node_type = var. node_type
3333
3434 # The version number of the cache engine to be used for the clusters in this replication group.
3535 # You can upgrade to a newer engine version, but you cannot downgrade to an earlier engine version.
3636 # 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
3838
3939 # The port number on which each member of the replication group accepts connections.
4040 # Redis default port is 6379.
41- port = " ${ var . port } "
41+ port = var. port
4242
4343 # Every cluster and replication group has a weekly maintenance window during which any system changes are applied.
4444 # Specifies the weekly time range during which maintenance on the cluster is performed.
4545 # It is specified as a range in the format ddd:hh24:mi-ddd:hh24:mi. (Example: "sun:23:00-mon:01:30")
4646 # The minimum maintenance window is a 60 minute period.
4747 # https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/maintenance-window.html
48- maintenance_window = " ${ var . maintenance_window } "
48+ maintenance_window = var. maintenance_window
4949
5050 # A period during each day when ElastiCache will begin creating a backup.
5151 # The minimum length for the backup window is 60 minutes.
5252 # If you do not specify a backup window, ElastiCache will assign one automatically.
5353 # https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/backups-automatic.html
54- snapshot_window = " ${ var . snapshot_window } "
54+ snapshot_window = var. snapshot_window
5555
5656 # The number of days the backup will be retained in Amazon S3.
5757 # The maximum backup retention limit is 35 days.
5858 # If the backup retention limit is set to 0, automatic backups are disabled for the cluster.
5959 # 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
6161
6262 # You can enable Multi-AZ with Automatic Failover only on Redis (cluster mode disabled) clusters that have at least
6363 # one available read replica. Clusters without read replicas do not provide high availability or fault tolerance.
6464 # 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
6666
6767 # Redis at-rest encryption is an optional feature to increase data security by encrypting on-disk data during sync
6868 # and backup or snapshot operations. Because there is some processing needed to encrypt and decrypt the data,
6969 # enabling at-rest encryption can have some performance impact during these operations.
7070 # You should benchmark your data with and without at-rest encryption to determine the performance impact for your use cases.
7171 # 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
7373
7474 # ElastiCache in-transit encryption is an optional feature that allows you to increase the security of your data at
7575 # its most vulnerable points—when it is in transit from one location to another. Because there is some processing
7676 # needed to encrypt and decrypt the data at the endpoints, enabling in-transit encryption can have some performance impact.
7777 # You should benchmark your data with and without in-transit encryption to determine the performance impact for your use cases.
7878 # 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
8080
8181 # If true, this parameter causes the modifications in this request and any pending modifications to be applied,
8282 # asynchronously and as soon as possible, regardless of the maintenance_window setting for the replication group.
8383 # apply_immediately applies only to modifications in node type, engine version, and changing the number of nodes in a cluster.
8484 # Other modifications, such as changing the maintenance window, are applied immediately.
8585 # https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/Clusters.Modify.html
86- apply_immediately = " ${ var . apply_immediately } "
86+ apply_immediately = var. apply_immediately
8787
8888 # A user-created description for the replication group.
89- replication_group_description = " ${ var . description } "
89+ replication_group_description = var. description
9090
9191 # 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 )
9393}
9494
9595# https://www.terraform.io/docs/providers/aws/r/elasticache_parameter_group.html
9696resource "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
100100}
101101
102102# https://www.terraform.io/docs/providers/aws/r/elasticache_subnet_group.html
103103resource "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
107107}
108108
109109# https://www.terraform.io/docs/providers/aws/r/security_group.html
110110resource "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 )
114114}
115115
116116locals {
@@ -120,11 +120,11 @@ locals {
120120# https://www.terraform.io/docs/providers/aws/r/security_group_rule.html
121121resource "aws_security_group_rule" "ingress" {
122122 type = " ingress"
123- from_port = " ${ var . port } "
124- to_port = " ${ var . port } "
123+ from_port = var. port
124+ to_port = var. port
125125 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
128128}
129129
130130resource "aws_security_group_rule" "egress" {
@@ -133,5 +133,5 @@ resource "aws_security_group_rule" "egress" {
133133 to_port = 0
134134 protocol = " -1"
135135 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
137137}
0 commit comments