Commit 73ba085e authored by nitrocode's avatar nitrocode Committed by GitHub

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

* added description on resources aws_elasticache_subnet_group and aws_elasticache_parameter_group

* Convert param values to strings

* Set auto failover to true if cluster mode enabled

* make github/init
Co-authored-by: default avatarSimone Ferraro <simone.ferraro@onsimo.it>
parent 7293a0e3
...@@ -47,7 +47,7 @@ template: | ...@@ -47,7 +47,7 @@ template: |
replacers: replacers:
# Remove irrelevant information from Renovate bot # 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: '' replace: ''
# Remove Renovate bot banner image # Remove Renovate bot banner image
- search: '/\[!\[[^\]]*Renovate\][^\]]*\](\([^)]*\))?\s*\n+/gm' - search: '/\[!\[[^\]]*Renovate\][^\]]*\](\([^)]*\))?\s*\n+/gm'
......
...@@ -82,21 +82,23 @@ locals { ...@@ -82,21 +82,23 @@ locals {
} }
resource "aws_elasticache_subnet_group" "default" { resource "aws_elasticache_subnet_group" "default" {
count = module.this.enabled && var.elasticache_subnet_group_name == "" && length(var.subnets) > 0 ? 1 : 0 count = module.this.enabled && var.elasticache_subnet_group_name == "" && length(var.subnets) > 0 ? 1 : 0
name = module.this.id name = module.this.id
subnet_ids = var.subnets description = "Elasticache subnet group for ${module.this.id}"
subnet_ids = var.subnets
} }
resource "aws_elasticache_parameter_group" "default" { resource "aws_elasticache_parameter_group" "default" {
count = module.this.enabled ? 1 : 0 count = module.this.enabled ? 1 : 0
name = module.this.id name = module.this.id
family = var.family description = "Elasticache parameter group for ${module.this.id}"
family = var.family
dynamic "parameter" { dynamic "parameter" {
for_each = var.cluster_mode_enabled ? concat([{ name = "cluster-enabled", value = "yes" }], var.parameter) : var.parameter for_each = var.cluster_mode_enabled ? concat([{ name = "cluster-enabled", value = "yes" }], var.parameter) : var.parameter
content { content {
name = parameter.value.name name = parameter.value.name
value = parameter.value.value value = tostring(parameter.value.value)
} }
} }
} }
...@@ -112,7 +114,7 @@ resource "aws_elasticache_replication_group" "default" { ...@@ -112,7 +114,7 @@ resource "aws_elasticache_replication_group" "default" {
port = var.port port = var.port
parameter_group_name = join("", aws_elasticache_parameter_group.default.*.name) 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)] 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 multi_az_enabled = var.multi_az_enabled
subnet_group_name = local.elasticache_subnet_group_name 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`, # It would be nice to remove null or duplicate security group IDs, if there are any, using `compact`,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment