diff --git a/locals.tf b/locals.tf index 8b839fdf..5d4f48d6 100644 --- a/locals.tf +++ b/locals.tf @@ -57,7 +57,7 @@ locals { use_password_auth = null use_tls = null } - ) : try( + ) : try( module.redis[0], { hostname = null diff --git a/main.tf b/main.tf index 2e75a12c..187a0364 100644 --- a/main.tf +++ b/main.tf @@ -98,9 +98,9 @@ module "redis" { module "redis_sentinel" { count = var.enable_redis_sentinel ? 1 : 0 source = "./modules/redis-sentinel" - - domain_name = var.domain_name - tfe_instance_sg = module.vm.tfe_instance_sg + + domain_name = var.domain_name + tfe_instance_sg = module.vm.tfe_instance_sg aws_iam_instance_profile = module.service_accounts.iam_instance_profile.name asg_tags = var.asg_tags diff --git a/modules/redis-sentinel/locals.tf b/modules/redis-sentinel/locals.tf index 64890268..43a234a5 100644 --- a/modules/redis-sentinel/locals.tf +++ b/modules/redis-sentinel/locals.tf @@ -3,15 +3,15 @@ locals { redis_user_data_template = "${path.module}/script.sh" - redis_leader_user_data = templatefile(local.redis_user_data_template, { + redis_leader_user_data = templatefile(local.redis_user_data_template, { compose = base64encode(templatefile(local.compose_path, { - redis_sentinel_password = var.redis_sentinel_password + redis_sentinel_password = var.redis_sentinel_password redis_sentinel_leader_name = var.redis_sentinel_leader_name - redis_sentinel_port = var.redis_sentinel_port - redis_port = var.redis_port - redis_password = var.redis_password - }))}) + redis_sentinel_port = var.redis_sentinel_port + redis_port = var.redis_port + redis_password = var.redis_password + })) }) compose_path = "${path.module}/compose.yaml" tags = concat( [ diff --git a/modules/redis-sentinel/security-group.tf b/modules/redis-sentinel/security-group.tf index 66147205..05d734d3 100644 --- a/modules/redis-sentinel/security-group.tf +++ b/modules/redis-sentinel/security-group.tf @@ -6,31 +6,31 @@ resource "aws_security_group" "redis_sentinel_inbound_allow" { } resource "aws_security_group_rule" "redis_sentinel_leader" { - security_group_id = aws_security_group.redis_sentinel_inbound_allow.id - type = "ingress" - from_port = 6379 - to_port = 6379 - protocol = "tcp" - cidr_blocks = var.network_private_subnet_cidrs + security_group_id = aws_security_group.redis_sentinel_inbound_allow.id + type = "ingress" + from_port = 6379 + to_port = 6379 + protocol = "tcp" + cidr_blocks = var.network_private_subnet_cidrs } resource "aws_security_group_rule" "redis_sentinel" { - security_group_id = aws_security_group.redis_sentinel_inbound_allow.id - type = "ingress" - from_port = 26379 - to_port = 26379 - protocol = "tcp" - cidr_blocks = var.network_private_subnet_cidrs + security_group_id = aws_security_group.redis_sentinel_inbound_allow.id + type = "ingress" + from_port = 26379 + to_port = 26379 + protocol = "tcp" + cidr_blocks = var.network_private_subnet_cidrs } resource "aws_security_group_rule" "ssh_inbound" { - security_group_id = aws_security_group.redis_sentinel_inbound_allow.id - type = "ingress" - from_port = 22 - to_port = 22 - protocol = "tcp" - cidr_blocks = var.network_private_subnet_cidrs + security_group_id = aws_security_group.redis_sentinel_inbound_allow.id + type = "ingress" + from_port = 22 + to_port = 22 + protocol = "tcp" + cidr_blocks = var.network_private_subnet_cidrs } resource "aws_security_group_rule" "redis_sentinel_inbound" { diff --git a/modules/redis-sentinel/sentinel.tf b/modules/redis-sentinel/sentinel.tf index 362144a9..5ef52333 100644 --- a/modules/redis-sentinel/sentinel.tf +++ b/modules/redis-sentinel/sentinel.tf @@ -56,10 +56,10 @@ resource "aws_autoscaling_group" "redis_sentinel" { max_size = 1 desired_capacity = 1 vpc_zone_identifier = var.network_subnets_private - target_group_arns = [ aws_lb_target_group.redis_sentinel_tg_6379.arn, - aws_lb_target_group.redis_sentinel_tg_26379.arn + target_group_arns = [aws_lb_target_group.redis_sentinel_tg_6379.arn, + aws_lb_target_group.redis_sentinel_tg_26379.arn ] - + # Increases grace period for any AMI that is not the default Ubuntu # since RHEL has longer startup time health_check_grace_period = local.health_check_grace_period diff --git a/modules/redis-sentinel/variables.tf b/modules/redis-sentinel/variables.tf index e52a0e8e..63c34d2b 100644 --- a/modules/redis-sentinel/variables.tf +++ b/modules/redis-sentinel/variables.tf @@ -91,41 +91,41 @@ variable "tfe_instance_sg" { variable "redis_sentinel_port" { description = "The redis sentinel follower port" type = number - default = 26379 + default = 26379 } variable "redis_port" { description = "The redis sentinel follower port" type = number - default = 6379 + default = 6379 } variable "redis_sentinel_password" { description = "The password for the redis sentinel" type = string - default = "hashicorp" + default = "hashicorp" } variable "redis_sentinel_leader_name" { description = "The redis sentinel leader hostname" type = string - default = "main" + default = "main" } variable "redis_password" { description = "The password for the redis sentinel" type = string - default = "hashicorp" + default = "hashicorp" } variable "redis_use_password_auth" { description = "A boolean which indicates if password authentication is required by the Redis" type = bool - default = true + default = true } variable "use_tls" { description = "A boolean which indicates if TLS is required by the Redis" type = bool - default = false + default = false } \ No newline at end of file