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 @@ ...@@ -3,7 +3,6 @@
*.tfstate.backup *.tfstate.backup
# Module directory # Module directory
.terraform/ .terraform
.idea .idea
*.iml *.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 ## Usage
Include this repository as a module in your existing terraform code: Include this repository as a module in your existing terraform code:
``` ```hcl
module "example_redis" { 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" namespace = "general"
name = "redis" name = "redis"
stage = "prod" stage = "prod"
...@@ -30,10 +31,11 @@ module "example_redis" { ...@@ -30,10 +31,11 @@ module "example_redis" {
} }
``` ```
## Input ## Input
| Name | Default | Decription | | Name | Default | Description |
|:----------------------------:|:-------------------:|:------------------------------------------------------:| |:-----------------------------|:-------------------:|:-------------------------------------------------------|
| namespace |global |Namespace | | namespace |global |Namespace |
| stage |default |Stage | | stage |default |Stage |
| name |redis |Name | | name |redis |Name |
...@@ -46,7 +48,7 @@ module "example_redis" { ...@@ -46,7 +48,7 @@ module "example_redis" {
| engine_version | 3.2.4 | Redis engine version | | engine_version | 3.2.4 | Redis engine version |
| port | 6379 | Redis port | | port | 6379 | Redis port |
| maintenance_window | wed:03:00-wed:04:00 | Maintenance window | | 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_cpu_threshold_percent | 75 | CPU threshold alarm level |
| alarm_memory_threshold_bytes | 10000000 | Ram threshold alarm level | | alarm_memory_threshold_bytes | 10000000 | Ram threshold alarm level |
| alarm_actions | [] | Alarm action list | | alarm_actions | [] | Alarm action list |
...@@ -55,12 +57,17 @@ module "example_redis" { ...@@ -55,12 +57,17 @@ module "example_redis" {
| availability_zones | [] | Availability zone ids | | availability_zones | [] | Availability zone ids |
| zone_id | false | Route53 dns zone id | | zone_id | false | Route53 dns zone id |
## Output ## Output
| Name | Decription | | Name | Description |
|:-----------------:|:-----------------:| |:------------------|:------------------|
| id | Redis cluster id | | id | Redis cluster id |
| security_group_id | Security group id | | security_group_id | Security group id |
| host | Redis host | | host | Redis host |
| port | Redis port | | port | Redis port |
## License
Apache 2 License. See [`LICENSE`](LICENSE) for full details.
# Define composite variables for resources # Define composite variables for resources
module "label" { 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}" namespace = "${var.namespace}"
name = "${var.name}" name = "${var.name}"
stage = "${var.stage}" stage = "${var.stage}"
...@@ -15,8 +15,9 @@ module "label" { ...@@ -15,8 +15,9 @@ module "label" {
resource "aws_security_group" "default" { resource "aws_security_group" "default" {
vpc_id = "${var.vpc_id}" vpc_id = "${var.vpc_id}"
name = "${module.label.id}" name = "${module.label.id}"
ingress { ingress {
from_port = "${var.port}" # Redis from_port = "${var.port}" # Redis
to_port = "${var.port}" to_port = "${var.port}"
protocol = "tcp" protocol = "tcp"
security_groups = ["${var.security_groups}"] security_groups = ["${var.security_groups}"]
...@@ -29,7 +30,7 @@ resource "aws_security_group" "default" { ...@@ -29,7 +30,7 @@ resource "aws_security_group" "default" {
cidr_blocks = ["0.0.0.0/0"] cidr_blocks = ["0.0.0.0/0"]
} }
tags = "${module.label.tags}" tags = "${module.label.tags}"
} }
resource "aws_elasticache_subnet_group" "default" { resource "aws_elasticache_subnet_group" "default" {
...@@ -56,7 +57,7 @@ resource "aws_elasticache_replication_group" "default" { ...@@ -56,7 +57,7 @@ resource "aws_elasticache_replication_group" "default" {
maintenance_window = "${var.maintenance_window}" maintenance_window = "${var.maintenance_window}"
notification_topic_arn = "${var.notification_topic_arn}" 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" { ...@@ -72,15 +73,15 @@ resource "aws_cloudwatch_metric_alarm" "cache_cpu" {
period = "300" period = "300"
statistic = "Average" statistic = "Average"
threshold = "${var.alarm_cpu_threshold_percent}" threshold = "${var.alarm_cpu_threshold_percent}"
dimensions { dimensions {
CacheClusterId = "${module.label.id}" CacheClusterId = "${module.label.id}"
} }
alarm_actions = ["${var.alarm_actions}"] alarm_actions = ["${var.alarm_actions}"]
depends_on = ["aws_elasticache_replication_group.default"] depends_on = ["aws_elasticache_replication_group.default"]
tags = "${module.label.tags}" tags = "${module.label.tags}"
} }
resource "aws_cloudwatch_metric_alarm" "cache_memory" { resource "aws_cloudwatch_metric_alarm" "cache_memory" {
...@@ -93,20 +94,19 @@ resource "aws_cloudwatch_metric_alarm" "cache_memory" { ...@@ -93,20 +94,19 @@ resource "aws_cloudwatch_metric_alarm" "cache_memory" {
period = "60" period = "60"
statistic = "Average" statistic = "Average"
threshold = "${var.alarm_memory_threshold_bytes}" threshold = "${var.alarm_memory_threshold_bytes}"
dimensions { dimensions {
CacheClusterId = "${module.label.id}" CacheClusterId = "${module.label.id}"
} }
alarm_actions = ["${var.alarm_actions}"] alarm_actions = ["${var.alarm_actions}"]
depends_on = ["aws_elasticache_replication_group.default"] depends_on = ["aws_elasticache_replication_group.default"]
tags = "${module.label.tags}" tags = "${module.label.tags}"
} }
module "dns" { 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}" namespace = "${var.namespace}"
name = "${var.name}" name = "${var.name}"
stage = "${var.stage}" stage = "${var.stage}"
......
...@@ -13,4 +13,3 @@ output "port" { ...@@ -13,4 +13,3 @@ output "port" {
output "host" { output "host" {
value = "${module.dns.hostname}" 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