Commit 58b54777 authored by Andriy Knysh's avatar Andriy Knysh Committed by GitHub

Rename repo (#5)

* Rename repos, fix `README.md`

* Fix `README.md`

* Fix `README.md`
parent 27f72db9
......@@ -3,7 +3,6 @@
*.tfstate.backup
# Module directory
.terraform/
.terraform
.idea
*.iml
# 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"
......@@ -30,10 +31,11 @@ module "example_redis" {
}
```
## Input
| Name | Default | Decription |
|:----------------------------:|:-------------------:|:------------------------------------------------------:|
| Name | Default | Description |
|:-----------------------------|:-------------------:|:-------------------------------------------------------|
| namespace |global |Namespace |
| stage |default |Stage |
| name |redis |Name |
......@@ -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 |
......@@ -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.
# 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}"
......@@ -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}"]
......@@ -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" {
......@@ -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}"
}
#
......@@ -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" {
......@@ -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}"
......
......@@ -13,4 +13,3 @@ output "port" {
output "host" {
value = "${module.dns.hostname}"
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment