Skip to content

Commit

Permalink
Support Redis Parameters (#24)
Browse files Browse the repository at this point in the history
* Paramatrise redis

* Update label version

* Update label version

* Update example

* Fix example

Signed-off-by: Igor Rodionov <[email protected]>

* Update variables.tf

* Update terraform.md

* Update README.md
  • Loading branch information
goruha authored Oct 8, 2018
1 parent 945d670 commit e3e98ff
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ Available targets:
| name | Name | string | `redis` | no |
| namespace | Namespace | string | `global` | no |
| notification_topic_arn | Notification topic arn | string | `` | no |
| parameter | A list of Redis parameters to apply. Note that parameters may differ from one Redis family to another | list | `<list>` | no |
| port | Redis port | string | `6379` | no |
| security_groups | AWS security group ids | list | `<list>` | no |
| stage | Stage | string | `default` | no |
Expand Down
1 change: 1 addition & 0 deletions docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
| name | Name | string | `redis` | no |
| namespace | Namespace | string | `global` | no |
| notification_topic_arn | Notification topic arn | string | `` | no |
| parameter | A list of Redis parameters to apply. Note that parameters may differ from one Redis family to another | list | `<list>` | no |
| port | Redis port | string | `6379` | no |
| security_groups | AWS security group ids | list | `<list>` | no |
| stage | Stage | string | `default` | no |
Expand Down
7 changes: 7 additions & 0 deletions examples/simple/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,11 @@ module "redis" {
alarm_cpu_threshold_percent = "75"
alarm_memory_threshold_bytes = "10000000"
at_rest_encryption_enabled = "true"

parameter = [
{
name = "notify-keyspace-events"
value = "lK"
},
]
}
9 changes: 5 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Define composite variables for resources
module "label" {
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.3.3"
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.5.3"
enabled = "${var.enabled}"
namespace = "${var.namespace}"
name = "${var.name}"
Expand Down Expand Up @@ -42,9 +42,10 @@ resource "aws_elasticache_subnet_group" "default" {
}

resource "aws_elasticache_parameter_group" "default" {
count = "${var.enabled == "true" ? 1 : 0}"
name = "${module.label.id}"
family = "${var.family}"
count = "${var.enabled == "true" ? 1 : 0}"
name = "${module.label.id}"
family = "${var.family}"
parameter = "${var.parameter}"
}

resource "aws_elasticache_replication_group" "default" {
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ variable "family" {
description = "Redis family "
}

variable "parameter" {
type = "list"
default = []
description = "A list of Redis parameters to apply. Note that parameters may differ from one Redis family to another"
}

variable "engine_version" {
default = "4.0.10"
description = "Redis engine version"
Expand Down

0 comments on commit e3e98ff

Please sign in to comment.