Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small fixes - convert param values to string, set auto failover to true if cluster enabled #141

Merged
merged 5 commits into from
Dec 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/auto-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ template: |

replacers:
# Remove irrelevant information from Renovate bot
- search: '/(?<=---\s+)+^#.*(Renovate configuration|Configuration)(?:.|\n)*?This PR has been generated .*/gm'
- search: '/(?<=---\s)\s*^#.*(Renovate configuration|Configuration)(?:.|\n)*?This PR has been generated .*/gm'
replace: ''
# Remove Renovate bot banner image
- search: '/\[!\[[^\]]*Renovate\][^\]]*\](\([^)]*\))?\s*\n+/gm'
Expand Down
18 changes: 10 additions & 8 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,23 @@ locals {
}

resource "aws_elasticache_subnet_group" "default" {
count = module.this.enabled && var.elasticache_subnet_group_name == "" && length(var.subnets) > 0 ? 1 : 0
name = module.this.id
subnet_ids = var.subnets
count = module.this.enabled && var.elasticache_subnet_group_name == "" && length(var.subnets) > 0 ? 1 : 0
name = module.this.id
description = "Elasticache subnet group for ${module.this.id}"
subnet_ids = var.subnets
}

resource "aws_elasticache_parameter_group" "default" {
count = module.this.enabled ? 1 : 0
name = module.this.id
family = var.family
count = module.this.enabled ? 1 : 0
name = module.this.id
description = "Elasticache parameter group for ${module.this.id}"
family = var.family

dynamic "parameter" {
for_each = var.cluster_mode_enabled ? concat([{ name = "cluster-enabled", value = "yes" }], var.parameter) : var.parameter
content {
name = parameter.value.name
value = parameter.value.value
value = tostring(parameter.value.value)
}
}
}
Expand All @@ -112,7 +114,7 @@ resource "aws_elasticache_replication_group" "default" {
port = var.port
parameter_group_name = join("", aws_elasticache_parameter_group.default.*.name)
availability_zones = length(var.availability_zones) == 0 ? null : [for n in range(0, var.cluster_size) : element(var.availability_zones, n)]
automatic_failover_enabled = var.automatic_failover_enabled
automatic_failover_enabled = var.cluster_mode_enabled ? true : var.automatic_failover_enabled
multi_az_enabled = var.multi_az_enabled
subnet_group_name = local.elasticache_subnet_group_name
# It would be nice to remove null or duplicate security group IDs, if there are any, using `compact`,
Expand Down