Skip to content

Commit a0020e9

Browse files
committed
apply terraform fmt
1 parent 17e7b76 commit a0020e9

File tree

4 files changed

+44
-44
lines changed

4 files changed

+44
-44
lines changed

main.tf

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ data "aws_vpc" "vpc" {
33
}
44

55
locals {
6-
vpc_name = lookup(data.aws_vpc.vpc.tags, "Name", var.vpc_id)
7-
major_redis_version = parseint(substr(var.redis_version, 0,1),10)
6+
vpc_name = lookup(data.aws_vpc.vpc.tags, "Name", var.vpc_id)
7+
major_redis_version = parseint(substr(var.redis_version, 0, 1), 10)
88
parameter_group_family = local.major_redis_version < 6 ? "redis${replace(var.redis_version, "/\\.[\\d]+$/", "")}" : local.major_redis_version == 6 ? "redis${replace(var.redis_version, "/\\.[\\d|x]+$/", "")}.x" : "redis${local.major_redis_version}"
9-
}
9+
}
1010

1111
resource "random_id" "salt" {
1212
keepers = {
@@ -16,33 +16,33 @@ resource "random_id" "salt" {
1616
}
1717

1818
resource "aws_elasticache_replication_group" "redis" {
19-
replication_group_id = format("%.20s", "${var.name}-${var.env}")
20-
description = "Terraform-managed ElastiCache replication group for ${var.name}-${var.env}-${local.vpc_name}"
21-
num_cache_clusters = var.redis_clusters
22-
node_type = var.redis_node_type
23-
automatic_failover_enabled = var.redis_failover
24-
auto_minor_version_upgrade = var.auto_minor_version_upgrade
25-
preferred_cache_cluster_azs = var.availability_zones
26-
multi_az_enabled = var.multi_az_enabled
27-
engine = "redis"
28-
at_rest_encryption_enabled = var.at_rest_encryption_enabled
29-
kms_key_id = var.kms_key_id
30-
transit_encryption_enabled = var.transit_encryption_enabled
31-
auth_token = var.transit_encryption_enabled ? var.auth_token : null
32-
engine_version = var.redis_version
33-
port = var.redis_port
34-
parameter_group_name = aws_elasticache_parameter_group.redis_parameter_group.id
35-
subnet_group_name = aws_elasticache_subnet_group.redis_subnet_group.id
36-
security_group_names = var.security_group_names
37-
security_group_ids = [aws_security_group.redis_security_group.id]
38-
snapshot_arns = var.snapshot_arns
39-
snapshot_name = var.snapshot_name
40-
apply_immediately = var.apply_immediately
41-
maintenance_window = var.redis_maintenance_window
42-
notification_topic_arn = var.notification_topic_arn
43-
snapshot_window = var.redis_snapshot_window
44-
snapshot_retention_limit = var.redis_snapshot_retention_limit
45-
tags = merge(tomap({"Name" = format("tf-elasticache-%s-%s", var.name, local.vpc_name)}), var.tags)
19+
replication_group_id = format("%.20s", "${var.name}-${var.env}")
20+
description = "Terraform-managed ElastiCache replication group for ${var.name}-${var.env}-${local.vpc_name}"
21+
num_cache_clusters = var.redis_clusters
22+
node_type = var.redis_node_type
23+
automatic_failover_enabled = var.redis_failover
24+
auto_minor_version_upgrade = var.auto_minor_version_upgrade
25+
preferred_cache_cluster_azs = var.availability_zones
26+
multi_az_enabled = var.multi_az_enabled
27+
engine = "redis"
28+
at_rest_encryption_enabled = var.at_rest_encryption_enabled
29+
kms_key_id = var.kms_key_id
30+
transit_encryption_enabled = var.transit_encryption_enabled
31+
auth_token = var.transit_encryption_enabled ? var.auth_token : null
32+
engine_version = var.redis_version
33+
port = var.redis_port
34+
parameter_group_name = aws_elasticache_parameter_group.redis_parameter_group.id
35+
subnet_group_name = aws_elasticache_subnet_group.redis_subnet_group.id
36+
security_group_names = var.security_group_names
37+
security_group_ids = [aws_security_group.redis_security_group.id]
38+
snapshot_arns = var.snapshot_arns
39+
snapshot_name = var.snapshot_name
40+
apply_immediately = var.apply_immediately
41+
maintenance_window = var.redis_maintenance_window
42+
notification_topic_arn = var.notification_topic_arn
43+
snapshot_window = var.redis_snapshot_window
44+
snapshot_retention_limit = var.redis_snapshot_retention_limit
45+
tags = merge(tomap({ "Name" = format("tf-elasticache-%s-%s", var.name, local.vpc_name) }), var.tags)
4646
}
4747

4848
resource "aws_elasticache_parameter_group" "redis_parameter_group" {

outputs.tf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
output "redis_security_group_id" {
2-
value = aws_security_group.redis_security_group.id
2+
value = aws_security_group.redis_security_group.id
33
description = "ID of the managed Security Group generated for Redis"
44
}
55

66
output "parameter_group" {
7-
value = aws_elasticache_parameter_group.redis_parameter_group.id
7+
value = aws_elasticache_parameter_group.redis_parameter_group.id
88
description = "ID of the Parameter Group to control the runtime properties of Redis nodes and clusters"
99
}
1010

1111
output "redis_subnet_group_name" {
12-
value = aws_elasticache_subnet_group.redis_subnet_group.name
12+
value = aws_elasticache_subnet_group.redis_subnet_group.name
1313
description = "Name of the Redis subnet"
1414

1515
}
1616

1717
output "id" {
18-
value = aws_elasticache_replication_group.redis.id
18+
value = aws_elasticache_replication_group.redis.id
1919
description = "ID of the Redis replication group"
2020
}
2121

2222
output "port" {
23-
value = var.redis_port
23+
value = var.redis_port
2424
description = "Redis port (default is 6379)"
2525
}
2626

2727
output "endpoint" {
28-
value = aws_elasticache_replication_group.redis.primary_endpoint_address
28+
value = aws_elasticache_replication_group.redis.primary_endpoint_address
2929
description = "Redis endpoint address"
3030
}

variables.tf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,20 @@ variable "redis_clusters" {
4949

5050
variable "multi_az_enabled" {
5151
description = "Specifies whether to enable Multi-AZ Support for the replication group"
52-
type = bool
53-
default = false
52+
type = bool
53+
default = false
5454
}
5555

5656
variable "redis_failover" {
5757
description = "Specifies whether a read-only replica will be automatically promoted to read/write primary if the existing primary fails"
58-
type = bool
59-
default = false
58+
type = bool
59+
default = false
6060
}
6161

6262
variable "is_migration_cluster" {
6363
description = "Specifies whether this is a cluster for replicating other EC2 redis. Useful for migrations."
64-
type = bool
65-
default = false
64+
type = bool
65+
default = false
6666
}
6767

6868
variable "redis_node_type" {

versions.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ terraform {
22
required_version = ">= 0.12"
33
required_providers {
44
aws = {
5-
source = "hashicorp/aws"
5+
source = "hashicorp/aws"
66
version = "~> 4.12"
77
}
88
random = {
9-
source = "hashicorp/random"
9+
source = "hashicorp/random"
1010
version = "~> 3.1"
1111
}
1212
}

0 commit comments

Comments
 (0)