Skip to content

Commit fe7ae13

Browse files
authored
Merge pull request #1 from hazelops/feature/add-elasticache-parameters
Add parameters for Elasticache
2 parents 160c618 + ab6d978 commit fe7ae13

File tree

4 files changed

+85
-41
lines changed

4 files changed

+85
-41
lines changed

README.md

+61-41
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,16 @@ module "elasticache_redis" {
5959
apply_immediately = true
6060
family = "redis5.0"
6161
description = "This is example"
62-
62+
parameters = [
63+
{
64+
name = "notify-keyspace-events"
65+
value = "AKE"
66+
}
67+
]
6368
subnet_ids = var.subnet_ids
6469
vpc_id = var.vpc_id
6570
source_cidr_blocks = var.source_cidr_blocks
66-
71+
6772
tags = {
6873
Environment = "prod"
6974
}
@@ -79,55 +84,70 @@ module "elasticache_redis" {
7984

8085
## Requirements
8186

82-
| Name | Version |
83-
| --------- | ------- |
87+
| Name | Version |
88+
|------|---------|
8489
| terraform | >= 0.12 |
8590

8691
## Providers
8792

8893
| Name | Version |
89-
| ---- | ------- |
90-
| aws | n/a |
94+
|------|---------|
95+
| aws | n/a |
96+
97+
## Modules
98+
99+
No Modules.
100+
101+
## Resources
102+
103+
| Name |
104+
|------|
105+
| [aws_elasticache_parameter_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/elasticache_parameter_group) |
106+
| [aws_elasticache_replication_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/elasticache_replication_group) |
107+
| [aws_elasticache_subnet_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/elasticache_subnet_group) |
108+
| [aws_security_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group) |
109+
| [aws_security_group_rule](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) |
91110

92111
## Inputs
93112

94-
| Name | Description | Type | Default | Required |
95-
| -------------------------- | ------------------------------------------------------------------------------------------------------------------------- | -------------- | ------------------------ | :------: |
96-
| name | The replication group identifier. This parameter is stored as a lowercase string. | `string` | n/a | yes |
97-
| node_type | The compute and memory capacity of the nodes in the node group. | `string` | n/a | yes |
98-
| number_cache_clusters | The number of cache clusters (primary and replicas) this replication group will have. | `string` | n/a | yes |
99-
| source_cidr_blocks | List of source CIDR blocks. | `list(string)` | n/a | yes |
100-
| subnet_ids | List of VPC Subnet IDs for the cache subnet group. | `list(string)` | n/a | yes |
101-
| vpc_id | VPC Id to associate with Redis ElastiCache. | `string` | n/a | yes |
102-
| apply_immediately | Specifies whether any modifications are applied immediately, or during the next maintenance window. | `bool` | `false` | no |
103-
| at_rest_encryption_enabled | Whether to enable encryption at rest. | `bool` | `true` | no |
104-
| automatic_failover_enabled | Specifies whether a read-only replica will be automatically promoted to read/write primary if the existing primary fails. | `bool` | `true` | no |
105-
| description | The description of the all resources. | `string` | `"Managed by Terraform"` | no |
106-
| engine_version | The version number of the cache engine to be used for the cache clusters in this replication group. | `string` | `"5.0.6"` | no |
107-
| family | The family of the ElastiCache parameter group. | `string` | `"redis5.0"` | no |
108-
| maintenance_window | Specifies the weekly time range for when maintenance on the cache cluster is performed. | `string` | `""` | no |
109-
| port | The port number on which each of the cache nodes will accept connections. | `number` | `6379` | no |
110-
| snapshot_retention_limit | The number of days for which ElastiCache will retain automatic cache cluster snapshots before deleting them. | `number` | `30` | no |
111-
| snapshot_window | The daily time range (in UTC) during which ElastiCache will begin taking a daily snapshot of your cache cluster. | `string` | `""` | no |
112-
| tags | A mapping of tags to assign to all resources. | `map(string)` | `{}` | no |
113-
| transit_encryption_enabled | Whether to enable encryption in transit. | `bool` | `true` | no |
113+
| Name | Description | Type | Default | Required |
114+
|------|-------------|------|---------|:--------:|
115+
| apply\_immediately | Specifies whether any modifications are applied immediately, or during the next maintenance window. | `bool` | `false` | no |
116+
| at\_rest\_encryption\_enabled | Whether to enable encryption at rest. | `bool` | `true` | no |
117+
| automatic\_failover\_enabled | Specifies whether a read-only replica will be automatically promoted to read/write primary if the existing primary fails. | `bool` | `true` | no |
118+
| description | The description of the all resources. | `string` | `"Managed by Terraform"` | no |
119+
| engine\_version | The version number of the cache engine to be used for the cache clusters in this replication group. | `string` | `"5.0.6"` | no |
120+
| family | The family of the ElastiCache parameter group. | `string` | `"redis5.0"` | no |
121+
| maintenance\_window | Specifies the weekly time range for when maintenance on the cache cluster is performed. | `string` | `""` | no |
122+
| name | The replication group identifier. This parameter is stored as a lowercase string. | `string` | n/a | yes |
123+
| node\_type | The compute and memory capacity of the nodes in the node group. | `string` | n/a | yes |
124+
| number\_cache\_clusters | The number of cache clusters (primary and replicas) this replication group will have. | `string` | n/a | yes |
125+
| parameters | A list of Redis parameters to apply. Note that parameters may differ from one Redis family to another | <pre>list(object({<br> name = string<br> value = string<br> }))</pre> | `[]` | no |
126+
| port | The port number on which each of the cache nodes will accept connections. | `number` | `6379` | no |
127+
| snapshot\_retention\_limit | The number of days for which ElastiCache will retain automatic cache cluster snapshots before deleting them. | `number` | `30` | no |
128+
| snapshot\_window | The daily time range (in UTC) during which ElastiCache will begin taking a daily snapshot of your cache cluster. | `string` | `""` | no |
129+
| source\_cidr\_blocks | List of source CIDR blocks. | `list(string)` | n/a | yes |
130+
| subnet\_ids | List of VPC Subnet IDs for the cache subnet group. | `list(string)` | n/a | yes |
131+
| tags | A mapping of tags to assign to all resources. | `map(string)` | `{}` | no |
132+
| transit\_encryption\_enabled | Whether to enable encryption in transit. | `bool` | `true` | no |
133+
| vpc\_id | VPC Id to associate with Redis ElastiCache. | `string` | n/a | yes |
114134

115135
## Outputs
116136

117-
| Name | Description |
118-
| ------------------------------------------------------ | -------------------------------------------------------------------------- |
119-
| elasticache_parameter_group_id | The ElastiCache parameter group name. |
120-
| elasticache_replication_group_id | The ID of the ElastiCache Replication Group. |
121-
| elasticache_replication_group_member_clusters | The identifiers of all the nodes that are part of this replication group. |
122-
| elasticache_replication_group_primary_endpoint_address | The address of the endpoint for the primary node in the replication group. |
123-
| security_group_arn | The ARN of the Redis ElastiCache security group. |
124-
| security_group_description | The description of the Redis ElastiCache security group. |
125-
| security_group_egress | The egress rules of the Redis ElastiCache security group. |
126-
| security_group_id | The ID of the Redis ElastiCache security group. |
127-
| security_group_ingress | The ingress rules of the Redis ElastiCache security group. |
128-
| security_group_name | The name of the Redis ElastiCache security group. |
129-
| security_group_owner_id | The owner ID of the Redis ElastiCache security group. |
130-
| security_group_vpc_id | The VPC ID of the Redis ElastiCache security group. |
137+
| Name | Description |
138+
|------|-------------|
139+
| elasticache\_parameter\_group\_id | The ElastiCache parameter group name. |
140+
| elasticache\_replication\_group\_id | The ID of the ElastiCache Replication Group. |
141+
| elasticache\_replication\_group\_member\_clusters | The identifiers of all the nodes that are part of this replication group. |
142+
| elasticache\_replication\_group\_primary\_endpoint\_address | The address of the endpoint for the primary node in the replication group. |
143+
| security\_group\_arn | The ARN of the Redis ElastiCache security group. |
144+
| security\_group\_description | The description of the Redis ElastiCache security group. |
145+
| security\_group\_egress | The egress rules of the Redis ElastiCache security group. |
146+
| security\_group\_id | The ID of the Redis ElastiCache security group. |
147+
| security\_group\_ingress | The ingress rules of the Redis ElastiCache security group. |
148+
| security\_group\_name | The name of the Redis ElastiCache security group. |
149+
| security\_group\_owner\_id | The owner ID of the Redis ElastiCache security group. |
150+
| security\_group\_vpc\_id | The VPC ID of the Redis ElastiCache security group. |
131151

132152
<!-- END OF GENERATED BY TERRAFORM-DOCS -->
133153

@@ -181,7 +201,7 @@ Bump VERSION file, and run `make release`.
181201

182202
### Terraform Module Registry
183203

184-
- <https://registry.terraform.io/modules/tmknom/elasticache-redis/aws>
204+
- <https://registry.terraform.io/modules/hazelops/elasticache-redis/aws>
185205

186206
## License
187207

examples/complete/main.tf

+7
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ module "elasticache_redis" {
2020
vpc_id = module.vpc.vpc_id
2121
source_cidr_blocks = [module.vpc.vpc_cidr_block]
2222

23+
parameters = [
24+
{
25+
name = "notify-keyspace-events"
26+
value = "AKE"
27+
}
28+
]
29+
2330
tags = {
2431
Environment = "prod"
2532
}

main.tf

+8
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,14 @@ resource "aws_elasticache_parameter_group" "default" {
9797
name = var.name
9898
family = var.family
9999
description = var.description
100+
101+
dynamic "parameter" {
102+
for_each = var.parameters
103+
content {
104+
name = parameter.value.name
105+
value = parameter.value.value
106+
}
107+
}
100108
}
101109

102110
# https://www.terraform.io/docs/providers/aws/r/elasticache_subnet_group.html

variables.tf

+9
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,12 @@ variable "tags" {
9999
type = map(string)
100100
description = "A mapping of tags to assign to all resources."
101101
}
102+
103+
variable "parameters" {
104+
type = list(object({
105+
name = string
106+
value = string
107+
}))
108+
default = []
109+
description = "A list of Redis parameters to apply. Note that parameters may differ from one Redis family to another"
110+
}

0 commit comments

Comments
 (0)