Skip to content

Commit fcb1504

Browse files
authored
Add working example (#17)
* Add working example * fix regression * Link to example * fix formatting
1 parent b5c789a commit fcb1504

File tree

6 files changed

+85
-4
lines changed

6 files changed

+85
-4
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ module "example_redis" {
5555

5656

5757

58+
## Examples
59+
60+
Review the [complete example](examples/simple) to see how to use this module.
61+
5862

5963

6064
## Makefile Targets
@@ -88,7 +92,7 @@ Available targets:
8892
| maintenance_window | Maintenance window | string | `wed:03:00-wed:04:00` | no |
8993
| name | Name | string | `redis` | no |
9094
| namespace | Namespace | string | `global` | no |
91-
| notification_topic_arn | Notification topic arn | string | `10000000` | no |
95+
| notification_topic_arn | Notification topic arn | string | `` | no |
9296
| port | Redis port | string | `6379` | no |
9397
| security_groups | AWS security group ids | list | `<list>` | no |
9498
| stage | Stage | string | `default` | no |

README.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ usage: |-
6060
}
6161
```
6262
63+
examples: |-
64+
Review the [complete example](examples/simple) to see how to use this module.
6365
6466
include:
6567
- "docs/targets.md"
@@ -78,4 +80,4 @@ contributors:
7880
- name: "Max Moon"
7981
github: "MoonMoon1919"
8082
- name: "Christopher Riley"
81-
github: "christopherriley"
83+
github: "christopherriley"

docs/terraform.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
| maintenance_window | Maintenance window | string | `wed:03:00-wed:04:00` | no |
2121
| name | Name | string | `redis` | no |
2222
| namespace | Namespace | string | `global` | no |
23-
| notification_topic_arn | Notification topic arn | string | `10000000` | no |
23+
| notification_topic_arn | Notification topic arn | string | `` | no |
2424
| port | Redis port | string | `6379` | no |
2525
| security_groups | AWS security group ids | list | `<list>` | no |
2626
| stage | Stage | string | `default` | no |

examples/simple/main.tf

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
terraform {
2+
required_version = ">= 0.11.2"
3+
4+
backend "s3" {}
5+
}
6+
7+
variable "aws_assume_role_arn" {}
8+
9+
provider "aws" {
10+
assume_role {
11+
role_arn = "${var.aws_assume_role_arn}"
12+
}
13+
}
14+
15+
variable "namespace" {}
16+
17+
variable "name" {}
18+
19+
variable "stage" {}
20+
21+
variable "region" {}
22+
23+
variable "availability_zones" {
24+
type = "list"
25+
}
26+
27+
variable "zone_id" {}
28+
29+
module "vpc" {
30+
source = "git::https://github.com/cloudposse/terraform-aws-vpc.git?ref=tags/0.3.3"
31+
namespace = "${var.namespace}"
32+
stage = "${var.stage}"
33+
name = "${var.name}"
34+
}
35+
36+
module "subnets" {
37+
source = "git::https://github.com/cloudposse/terraform-aws-dynamic-subnets.git?ref=tags/0.3.5"
38+
namespace = "${var.namespace}"
39+
stage = "${var.stage}"
40+
name = "${var.name}"
41+
region = "${var.region}"
42+
availability_zones = "${var.availability_zones}"
43+
vpc_id = "${module.vpc.vpc_id}"
44+
igw_id = "${module.vpc.igw_id}"
45+
cidr_block = "10.0.0.0/16"
46+
}
47+
48+
module "redis" {
49+
source = "../../"
50+
namespace = "${var.namespace}"
51+
stage = "${var.stage}"
52+
name = "${var.name}"
53+
zone_id = "${var.zone_id}"
54+
vpc_id = "${module.vpc.vpc_id}"
55+
subnets = "${module.subnets.private_subnet_ids}"
56+
maintenance_window = "wed:03:00-wed:04:00"
57+
cluster_size = "2"
58+
instance_type = "cache.t2.micro"
59+
apply_immediately = "true"
60+
availability_zones = "${var.availability_zones}"
61+
automatic_failover = "false"
62+
63+
engine_version = "4.0.10"
64+
family = "redis4.0"
65+
port = "6379"
66+
alarm_cpu_threshold_percent = "75"
67+
alarm_memory_threshold_bytes = "10000000"
68+
at_rest_encryption_enabled = "true"
69+
}

examples/simple/terraform.tfvars

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace = "eg"
2+
name = "redis"
3+
stage = "testing"
4+
zone_id = "Z3SO0TKDDQ0RGG"
5+
region = "us-west-2"
6+
availability_zones = ["us-west-2a", "us-west-2b"]

variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ variable "transit_encryption_enabled" {
7676
}
7777

7878
variable "notification_topic_arn" {
79-
default = "10000000"
79+
default = ""
8080
description = "Notification topic arn"
8181
}
8282

0 commit comments

Comments
 (0)