Skip to content

Commit c5a0b61

Browse files
committed
Fixing and preparing update for Terraform 0.12
1 parent 2830972 commit c5a0b61

File tree

4 files changed

+44
-38
lines changed

4 files changed

+44
-38
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
repos:
22
- repo: git://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.8.1
3+
rev: v1.21.0
44
hooks:
55
- id: terraform_fmt
66
- id: terraform_docs
77
- repo: git://github.com/pre-commit/pre-commit-hooks
8-
rev: v2.1.0
8+
rev: v2.4.0
99
hooks:
1010
- id: check-merge-conflict

README.md

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,27 @@ This module
77
- Creates Redis ElastiCache clusters
88
- Creates, manages, and exports a security group
99

10+
## Terraform versions
11+
12+
Terraform 0.12. Pin module version to `~> v2.0`. Submit pull-requests to `master` branch.
13+
14+
Terraform 0.11. Pin module version to `~> v1.0`.
15+
1016
## Usage
1117

1218
```hcl
1319
module "redis" {
14-
source = "github.com/terraform-community-modules/tf_aws_elasticache_redis?ref=v1.3.0"
15-
env = var.env
20+
source = "github.com/terraform-community-modules/tf_aws_elasticache_redis.git"
21+
version = "~> 2.0"
22+
23+
env = "dev"
1624
name = "thtest"
1725
redis_clusters = "2"
1826
redis_failover = "true"
19-
subnets = module.vpc.database_subnets
20-
vpc_id = module.vpc.vpc_id
21-
}
22-
```
27+
subnets = ["subnet-12345678", "subnet-11111111", "subnet-22222222"]
28+
vpc_id = "vpc-12345678"
2329
24-
## Usage with redis_parameters
25-
26-
```hcl
27-
variable "redis_parameters" {
28-
description = "additional parameters"
29-
default = [{
30+
redis_parameters = [{
3031
name = "min-slaves-max-lag"
3132
value = "5"
3233
},{
@@ -37,36 +38,32 @@ variable "redis_parameters" {
3738
value = "32"
3839
}]
3940
}
40-
41-
module "redis" {
42-
source = "github.com/terraform-community-modules/tf_aws_elasticache_redis?ref=v1.3.0"
43-
...
44-
redis_parameters = var.redis_parameters
45-
...
46-
}
4741
```
4842

4943
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
5044
## Inputs
5145

5246
| Name | Description | Type | Default | Required |
5347
|------|-------------|:----:|:-----:|:-----:|
54-
| allowed\_cidr | A list of Security Group ID's to allow access to. | list | `[ "127.0.0.1/32" ]` | no |
55-
| allowed\_security\_groups | A list of Security Group ID's to allow access to. | list | `[]` | no |
56-
| apply\_immediately | Specifies whether any modifications are applied immediately, or during the next maintenance window. Default is false. | string | `"false"` | no |
48+
| alarm\_actions | | list | n/a | yes |
49+
| alarm\_cpu\_threshold | These vars would be used by cloudwatch.tf and should be uncommented if we decide to use them. | string | `"75"` | no |
50+
| alarm\_memory\_threshold | | string | `"10000000"` | no |
51+
| allowed\_cidr | A list of Security Group ID's to allow access to. | list(string) | `[ "127.0.0.1/32" ]` | no |
52+
| allowed\_security\_groups | A list of Security Group ID's to allow access to. | list(string) | `[]` | no |
53+
| apply\_immediately | Specifies whether any modifications are applied immediately, or during the next maintenance window. Default is false. | bool | `"false"` | no |
5754
| env | env to deploy into, should typically dev/staging/prod | string | n/a | yes |
5855
| name | Name for the Redis replication group i.e. UserObject | string | n/a | yes |
5956
| redis\_clusters | Number of Redis cache clusters (nodes) to create | string | n/a | yes |
60-
| redis\_failover | | string | `"false"` | no |
57+
| redis\_failover | | bool | `"false"` | no |
6158
| redis\_maintenance\_window | Specifies the weekly time range for when maintenance on the cache cluster is performed. The format is ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC). The minimum maintenance window is a 60 minute period | string | `"fri:08:00-fri:09:00"` | no |
6259
| redis\_node\_type | Instance type to use for creating the Redis cache clusters | string | `"cache.m3.medium"` | no |
63-
| redis\_parameters | additional parameters modifyed in parameter group | list | `[]` | no |
64-
| redis\_port | | string | `"6379"` | no |
65-
| redis\_snapshot\_retention\_limit | The number of days for which ElastiCache will retain automatic cache cluster snapshots before deleting them. For example, if you set SnapshotRetentionLimit to 5, then a snapshot that was taken today will be retained for 5 days before being deleted. If the value of SnapshotRetentionLimit is set to zero (0), backups are turned off. Please note that setting a snapshot_retention_limit is not supported on cache.t1.micro or cache.t2.* cache nodes | string | `"0"` | no |
60+
| redis\_parameters | additional parameters modifyed in parameter group | list(map(any)) | `[]` | no |
61+
| redis\_port | | number | `"6379"` | no |
62+
| redis\_snapshot\_retention\_limit | The number of days for which ElastiCache will retain automatic cache cluster snapshots before deleting them. For example, if you set SnapshotRetentionLimit to 5, then a snapshot that was taken today will be retained for 5 days before being deleted. If the value of SnapshotRetentionLimit is set to zero (0), backups are turned off. Please note that setting a snapshot_retention_limit is not supported on cache.t1.micro or cache.t2.* cache nodes | number | `"0"` | no |
6663
| redis\_snapshot\_window | The daily time range (in UTC) during which ElastiCache will begin taking a daily snapshot of your cache cluster. The minimum snapshot window is a 60 minute period | string | `"06:30-07:30"` | no |
6764
| redis\_version | Redis version to use, defaults to 3.2.10 | string | `"3.2.10"` | no |
68-
| subnets | List of VPC Subnet IDs for the cache subnet group | list | n/a | yes |
69-
| tags | Tags for redis nodes | map | `{}` | no |
65+
| subnets | List of VPC Subnet IDs for the cache subnet group | list(string) | n/a | yes |
66+
| tags | Tags for redis nodes | map(string) | `{}` | no |
7067
| vpc\_id | VPC ID | string | n/a | yes |
7168

7269
## Outputs

variables.tf

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,43 +16,50 @@ variable "alarm_actions" {
1616

1717
variable "apply_immediately" {
1818
description = "Specifies whether any modifications are applied immediately, or during the next maintenance window. Default is false."
19-
default = "false"
19+
type = bool
20+
default = false
2021
}
2122

2223
variable "allowed_cidr" {
24+
description = "A list of Security Group ID's to allow access to."
2325
type = list(string)
2426
default = ["127.0.0.1/32"]
25-
description = "A list of Security Group ID's to allow access to."
2627
}
2728

2829
variable "allowed_security_groups" {
30+
description = "A list of Security Group ID's to allow access to."
2931
type = list(string)
3032
default = []
31-
description = "A list of Security Group ID's to allow access to."
3233
}
3334

3435
variable "env" {
3536
description = "env to deploy into, should typically dev/staging/prod"
37+
type = string
3638
}
3739

3840
variable "name" {
3941
description = "Name for the Redis replication group i.e. UserObject"
42+
type = string
4043
}
4144

4245
variable "redis_clusters" {
4346
description = "Number of Redis cache clusters (nodes) to create"
47+
type = string
4448
}
4549

4650
variable "redis_failover" {
51+
type = bool
4752
default = false
4853
}
4954

5055
variable "redis_node_type" {
5156
description = "Instance type to use for creating the Redis cache clusters"
57+
type = string
5258
default = "cache.m3.medium"
5359
}
5460

5561
variable "redis_port" {
62+
type = number
5663
default = 6379
5764
}
5865

@@ -64,36 +71,41 @@ variable "subnets" {
6471
# might want a map
6572
variable "redis_version" {
6673
description = "Redis version to use, defaults to 3.2.10"
74+
type = string
6775
default = "3.2.10"
6876
}
6977

7078
variable "vpc_id" {
7179
description = "VPC ID"
80+
type = string
7281
}
7382

7483
variable "redis_parameters" {
75-
type = list(object({ name = string, value = string }))
7684
description = "additional parameters modifyed in parameter group"
85+
type = list(map(any))
7786
default = []
7887
}
7988

8089
variable "redis_maintenance_window" {
8190
description = "Specifies the weekly time range for when maintenance on the cache cluster is performed. The format is ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC). The minimum maintenance window is a 60 minute period"
91+
type = string
8292
default = "fri:08:00-fri:09:00"
8393
}
8494

8595
variable "redis_snapshot_window" {
8696
description = "The daily time range (in UTC) during which ElastiCache will begin taking a daily snapshot of your cache cluster. The minimum snapshot window is a 60 minute period"
97+
type = string
8798
default = "06:30-07:30"
8899
}
89100

90101
variable "redis_snapshot_retention_limit" {
91102
description = "The number of days for which ElastiCache will retain automatic cache cluster snapshots before deleting them. For example, if you set SnapshotRetentionLimit to 5, then a snapshot that was taken today will be retained for 5 days before being deleted. If the value of SnapshotRetentionLimit is set to zero (0), backups are turned off. Please note that setting a snapshot_retention_limit is not supported on cache.t1.micro or cache.t2.* cache nodes"
103+
type = number
92104
default = 0
93105
}
94106

95107
variable "tags" {
96-
type = map(string)
97108
description = "Tags for redis nodes"
109+
type = map(string)
98110
default = {}
99111
}

version.tf

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)