Skip to content

Commit

Permalink
Rename repo (#5)
Browse files Browse the repository at this point in the history
* Rename repos, fix `README.md`

* Fix `README.md`

* Fix `README.md`
  • Loading branch information
aknysh authored Sep 22, 2017
1 parent 27f72db commit 58b5477
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 26 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*.tfstate.backup

# Module directory
.terraform/

.terraform
.idea
*.iml
25 changes: 16 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# tf_redis
# terraform-aws-elasticache-redis

Terraform module to provision an [`ElastiCache`](https://aws.amazon.com/elasticache/) Redis Cluster

Terraform module to provision a ElastiCache Redis Cluster

## Usage

Include this repository as a module in your existing terraform code:

```
```hcl
module "example_redis" {
source = "git::https://github.com/cloudposse/tf_redis.git?ref=tags/0.1.0"
source = "git::https://github.com/cloudposse/terraform-aws-elasticache-redis.git?ref=master"
namespace = "general"
name = "redis"
stage = "prod"
Expand All @@ -30,10 +31,11 @@ module "example_redis" {
}
```


## Input

| Name | Default | Decription |
|:----------------------------:|:-------------------:|:------------------------------------------------------:|
| Name | Default | Description |
|:-----------------------------|:-------------------:|:-------------------------------------------------------|
| namespace |global |Namespace |
| stage |default |Stage |
| name |redis |Name |
Expand All @@ -46,7 +48,7 @@ module "example_redis" {
| engine_version | 3.2.4 | Redis engine version |
| port | 6379 | Redis port |
| maintenance_window | wed:03:00-wed:04:00 | Maintenance window |
| notification_topic_arn | | Notificate topic arn |
| notification_topic_arn | | Notification topic arn |
| alarm_cpu_threshold_percent | 75 | CPU threshold alarm level |
| alarm_memory_threshold_bytes | 10000000 | Ram threshold alarm level |
| alarm_actions | [] | Alarm action list |
Expand All @@ -55,12 +57,17 @@ module "example_redis" {
| availability_zones | [] | Availability zone ids |
| zone_id | false | Route53 dns zone id |


## Output

| Name | Decription |
|:-----------------:|:-----------------:|
| Name | Description |
|:------------------|:------------------|
| id | Redis cluster id |
| security_group_id | Security group id |
| host | Redis host |
| port | Redis port |


## License

Apache 2 License. See [`LICENSE`](LICENSE) for full details.
28 changes: 14 additions & 14 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/tf_label.git?ref=tags/0.2.0"
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.2.1"
namespace = "${var.namespace}"
name = "${var.name}"
stage = "${var.stage}"
Expand All @@ -15,8 +15,9 @@ module "label" {
resource "aws_security_group" "default" {
vpc_id = "${var.vpc_id}"
name = "${module.label.id}"

ingress {
from_port = "${var.port}" # Redis
from_port = "${var.port}" # Redis
to_port = "${var.port}"
protocol = "tcp"
security_groups = ["${var.security_groups}"]
Expand All @@ -29,7 +30,7 @@ resource "aws_security_group" "default" {
cidr_blocks = ["0.0.0.0/0"]
}

tags = "${module.label.tags}"
tags = "${module.label.tags}"
}

resource "aws_elasticache_subnet_group" "default" {
Expand All @@ -56,7 +57,7 @@ resource "aws_elasticache_replication_group" "default" {
maintenance_window = "${var.maintenance_window}"
notification_topic_arn = "${var.notification_topic_arn}"

tags = "${module.label.tags}"
tags = "${module.label.tags}"
}

#
Expand All @@ -72,15 +73,15 @@ resource "aws_cloudwatch_metric_alarm" "cache_cpu" {
period = "300"
statistic = "Average"

threshold = "${var.alarm_cpu_threshold_percent}"
threshold = "${var.alarm_cpu_threshold_percent}"

dimensions {
CacheClusterId = "${module.label.id}"
}

alarm_actions = ["${var.alarm_actions}"]
depends_on = ["aws_elasticache_replication_group.default"]
tags = "${module.label.tags}"
alarm_actions = ["${var.alarm_actions}"]
depends_on = ["aws_elasticache_replication_group.default"]
tags = "${module.label.tags}"
}

resource "aws_cloudwatch_metric_alarm" "cache_memory" {
Expand All @@ -93,20 +94,19 @@ resource "aws_cloudwatch_metric_alarm" "cache_memory" {
period = "60"
statistic = "Average"

threshold = "${var.alarm_memory_threshold_bytes}"
threshold = "${var.alarm_memory_threshold_bytes}"

dimensions {
CacheClusterId = "${module.label.id}"
}

alarm_actions = ["${var.alarm_actions}"]
depends_on = ["aws_elasticache_replication_group.default"]
tags = "${module.label.tags}"
alarm_actions = ["${var.alarm_actions}"]
depends_on = ["aws_elasticache_replication_group.default"]
tags = "${module.label.tags}"
}


module "dns" {
source = "git::https://github.com/cloudposse/tf_hostname.git?ref=tags/0.1.0"
source = "git::https://github.com/cloudposse/terraform-aws-route53-cluster-hostname.git?ref=tags/0.1.1"
namespace = "${var.namespace}"
name = "${var.name}"
stage = "${var.stage}"
Expand Down
1 change: 0 additions & 1 deletion output.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ output "port" {
output "host" {
value = "${module.dns.hostname}"
}

0 comments on commit 58b5477

Please sign in to comment.