Skip to content

Commit 945d670

Browse files
MoonMoon1919osterman
authored andcommitted
Add auth_token argument (#23)
* add auth token * fmt * update readme properly * add auth token generation to readme
1 parent 3e2762b commit 945d670

File tree

6 files changed

+43
-8
lines changed

6 files changed

+43
-8
lines changed

README.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<!-- This file was automatically generated by the `build-harness`. Make all changes to `README.yaml` and run `make readme` to rebuild this file. -->
22

3+
34
[![Cloud Posse](https://cloudposse.com/logo-300x69.svg)](https://cloudposse.com)
45

56
# terraform-aws-elasticache-redis [![Build Status](https://travis-ci.org/cloudposse/terraform-aws-elasticache-redis.svg?branch=master)](https://travis-ci.org/cloudposse/terraform-aws-elasticache-redis) [![Latest Release](https://img.shields.io/github/release/cloudposse/terraform-aws-elasticache-redis.svg)](https://github.com/cloudposse/terraform-aws-elastic-beanstalk-environment/releases/latest) [![Slack Community](https://slack.cloudposse.com/badge.svg)](https://slack.cloudposse.com)
@@ -29,6 +30,12 @@ It's 100% Open Source and licensed under the [APACHE2](LICENSE).
2930
Include this repository as a module in your existing terraform code:
3031

3132
```hcl
33+
// Generate a random string for auth token, no special chars
34+
resource "random_string" "auth_token" {
35+
length = 64
36+
special = false
37+
}
38+
3239
module "example_redis" {
3340
source = "git::https://github.com/cloudposse/terraform-aws-elasticache-redis.git?ref=master"
3441
namespace = "general"
@@ -37,19 +44,24 @@ module "example_redis" {
3744
zone_id = "${var.route53_zone_id}"
3845
security_groups = ["${var.security_group_id}"]
3946
47+
auth_token = "${random_string.auth_token.result}"
4048
vpc_id = "${var.vpc_id}"
4149
subnets = "${var.private_subnets}"
4250
maintenance_window = "wed:03:00-wed:04:00"
4351
cluster_size = "2"
4452
instance_type = "cache.t2.micro"
45-
engine_version = "3.2.4"
53+
engine_version = "4.0.10"
4654
alarm_cpu_threshold_percent = "${var.cache_alarm_cpu_threshold_percent}"
4755
alarm_memory_threshold_bytes = "${var.cache_alarm_memory_threshold_bytes}"
4856
apply_immediately = "true"
4957
availability_zones = "${var.availability_zones}"
5058
5159
automatic_failover = "false"
5260
}
61+
62+
output "auth_token" {
63+
value = "${random_string.auth_token.result}"
64+
}
5365
```
5466

5567

@@ -65,8 +77,9 @@ Review the [complete example](examples/simple) to see how to use this module.
6577
```
6678
Available targets:
6779
68-
help This help screen
80+
help Help screen
6981
help/all Display help for all targets
82+
help/short This help short screen
7083
lint Lint terraform code
7184
7285
```
@@ -81,6 +94,7 @@ Available targets:
8194
| apply_immediately | Apply changes immediately | string | `true` | no |
8295
| at_rest_encryption_enabled | Enable encryption at rest | string | `false` | no |
8396
| attributes | Additional attributes (_e.g._ "1") | list | `<list>` | no |
97+
| auth_token | Auth token for password protecting redis, transit_encryption_enabled must be set to 'true'! Password must be longer than 16 chars | string | `` | no |
8498
| automatic_failover | Automatic failover (Not available for T1/T2 instances) | string | `false` | no |
8599
| availability_zones | Availability zone ids | list | `<list>` | no |
86100
| cluster_size | Count of nodes in cluster | string | `1` | no |
@@ -98,7 +112,7 @@ Available targets:
98112
| stage | Stage | string | `default` | no |
99113
| subnets | AWS subnet ids | list | `<list>` | no |
100114
| tags | Additional tags (_e.g._ map("BusinessUnit","ABC") | map | `<map>` | no |
101-
| transit_encryption_enabled | Enable TLS | string | `false` | no |
115+
| transit_encryption_enabled | Enable TLS | string | `true` | no |
102116
| vpc_id | AWS VPC id | string | `REQUIRED` | no |
103117
| zone_id | Route53 DNS Zone id | string | `false` | no |
104118

README.yaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ usage: |-
3737
Include this repository as a module in your existing terraform code:
3838
3939
```hcl
40+
// Generate a random string for auth token, no special chars
41+
resource "random_string" "auth_token" {
42+
length = 64
43+
special = false
44+
}
45+
4046
module "example_redis" {
4147
source = "git::https://github.com/cloudposse/terraform-aws-elasticache-redis.git?ref=master"
4248
namespace = "general"
@@ -45,19 +51,24 @@ usage: |-
4551
zone_id = "${var.route53_zone_id}"
4652
security_groups = ["${var.security_group_id}"]
4753
54+
auth_token = "${random_string.auth_token.result}"
4855
vpc_id = "${var.vpc_id}"
4956
subnets = "${var.private_subnets}"
5057
maintenance_window = "wed:03:00-wed:04:00"
5158
cluster_size = "2"
5259
instance_type = "cache.t2.micro"
53-
engine_version = "3.2.4"
60+
engine_version = "4.0.10"
5461
alarm_cpu_threshold_percent = "${var.cache_alarm_cpu_threshold_percent}"
5562
alarm_memory_threshold_bytes = "${var.cache_alarm_memory_threshold_bytes}"
5663
apply_immediately = "true"
5764
availability_zones = "${var.availability_zones}"
5865
5966
automatic_failover = "false"
6067
}
68+
69+
output "auth_token" {
70+
value = "${random_string.auth_token.result}"
71+
}
6172
```
6273
6374
examples: |-

docs/targets.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
```
33
Available targets:
44
5-
help This help screen
5+
help Help screen
66
help/all Display help for all targets
7+
help/short This help short screen
78
lint Lint terraform code
89
910
```

docs/terraform.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
| apply_immediately | Apply changes immediately | string | `true` | no |
1010
| at_rest_encryption_enabled | Enable encryption at rest | string | `false` | no |
1111
| attributes | Additional attributes (_e.g._ "1") | list | `<list>` | no |
12+
| auth_token | Auth token for password protecting redis, transit_encryption_enabled must be set to 'true'! Password must be longer than 16 chars | string | `` | no |
1213
| automatic_failover | Automatic failover (Not available for T1/T2 instances) | string | `false` | no |
1314
| availability_zones | Availability zone ids | list | `<list>` | no |
1415
| cluster_size | Count of nodes in cluster | string | `1` | no |
@@ -26,7 +27,7 @@
2627
| stage | Stage | string | `default` | no |
2728
| subnets | AWS subnet ids | list | `<list>` | no |
2829
| tags | Additional tags (_e.g._ map("BusinessUnit","ABC") | map | `<map>` | no |
29-
| transit_encryption_enabled | Enable TLS | string | `false` | no |
30+
| transit_encryption_enabled | Enable TLS | string | `true` | no |
3031
| vpc_id | AWS VPC id | string | `REQUIRED` | no |
3132
| zone_id | Route53 DNS Zone id | string | `false` | no |
3233

main.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ resource "aws_elasticache_parameter_group" "default" {
4848
}
4949

5050
resource "aws_elasticache_replication_group" "default" {
51-
count = "${var.enabled == "true" ? 1 : 0}"
51+
count = "${var.enabled == "true" ? 1 : 0}"
52+
53+
auth_token = "${var.auth_token}"
5254
replication_group_id = "${module.label.id}"
5355
replication_group_description = "${module.label.id}"
5456
node_type = "${var.instance_type}"

variables.tf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ variable "at_rest_encryption_enabled" {
7171
}
7272

7373
variable "transit_encryption_enabled" {
74-
default = "false"
74+
default = "true"
7575
description = "Enable TLS"
7676
}
7777

@@ -135,3 +135,9 @@ variable "tags" {
135135
description = "Additional tags (_e.g._ map(\"BusinessUnit\",\"ABC\")"
136136
default = {}
137137
}
138+
139+
variable "auth_token" {
140+
type = "string"
141+
description = "Auth token for password protecting redis, transit_encryption_enabled must be set to 'true'! Password must be longer than 16 chars"
142+
default = ""
143+
}

0 commit comments

Comments
 (0)