Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
terraform-aws-elasticache-redis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Terraform Modules
terraform-aws-elasticache-redis
Commits
51007a3c
Commit
51007a3c
authored
Nov 02, 2017
by
Daren Desjardins
Committed by
Erik Osterman
Nov 02, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add enabled flag (#8)
parent
0095706d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
2 deletions
+16
-2
README.md
README.md
+1
-0
main.tf
main.tf
+10
-2
variables.tf
variables.tf
+5
-0
No files found.
README.md
View file @
51007a3c
...
...
@@ -36,6 +36,7 @@ module "example_redis" {
| Name | Default | Description |
|:-----------------------------|:-------------------:|:----------------------------------------------------------------|
| enabled | true | Set to false to prevent the module from creating any resources |
| namespace | global | Namespace |
| stage | default | Stage |
| name | redis | Name |
...
...
main.tf
View file @
51007a3c
# Define composite variables for resources
module
"label"
{
source
=
"git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.2.2"
source
=
"git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.3.0"
enabled
=
"
${
var
.
enabled
}
"
namespace
=
"
${
var
.
namespace
}
"
name
=
"
${
var
.
name
}
"
stage
=
"
${
var
.
stage
}
"
...
...
@@ -13,6 +14,7 @@ module "label" {
# Security Group Resources
#
resource
"aws_security_group"
"default"
{
count
=
"
${
var
.
enabled
==
"true"
?
1
:
0
}
"
vpc_id
=
"
${
var
.
vpc_id
}
"
name
=
"
${module
.
label
.
id
}
"
...
...
@@ -34,16 +36,19 @@ resource "aws_security_group" "default" {
}
resource
"aws_elasticache_subnet_group"
"default"
{
count
=
"
${
var
.
enabled
==
"true"
?
1
:
0
}
"
name
=
"
${module
.
label
.
id
}
"
subnet_ids
=
[
"
${
var
.
subnets
}
"
]
}
resource
"aws_elasticache_parameter_group"
"default"
{
count
=
"
${
var
.
enabled
==
"true"
?
1
:
0
}
"
name
=
"
${module
.
label
.
id
}
"
family
=
"
${
var
.
family
}
"
}
resource
"aws_elasticache_replication_group"
"default"
{
count
=
"
${
var
.
enabled
==
"true"
?
1
:
0
}
"
replication_group_id
=
"
${module
.
label
.
id
}
"
replication_group_description
=
"
${module
.
label
.
id
}
"
node_type
=
"
${
var
.
instance_type
}
"
...
...
@@ -64,6 +69,7 @@ resource "aws_elasticache_replication_group" "default" {
# CloudWatch Resources
#
resource
"aws_cloudwatch_metric_alarm"
"cache_cpu"
{
count
=
"
${
var
.
enabled
==
"true"
?
1
:
0
}
"
alarm_name
=
"
${module
.
label
.
id
}
-cpu-utilization"
alarm_description
=
"Redis cluster CPU utilization"
comparison_operator
=
"GreaterThanThreshold"
...
...
@@ -84,6 +90,7 @@ resource "aws_cloudwatch_metric_alarm" "cache_cpu" {
}
resource
"aws_cloudwatch_metric_alarm"
"cache_memory"
{
count
=
"
${
var
.
enabled
==
"true"
?
1
:
0
}
"
alarm_name
=
"
${module
.
label
.
id
}
-freeable-memory"
alarm_description
=
"Redis cluster freeable memory"
comparison_operator
=
"LessThanThreshold"
...
...
@@ -104,7 +111,8 @@ resource "aws_cloudwatch_metric_alarm" "cache_memory" {
}
module
"dns"
{
source
=
"git::https://github.com/cloudposse/terraform-aws-route53-cluster-hostname.git?ref=tags/0.1.1"
source
=
"git::https://github.com/cloudposse/terraform-aws-route53-cluster-hostname.git?ref=tags/0.2.0"
enabled
=
"
${
var
.
enabled
}
"
namespace
=
"
${
var
.
namespace
}
"
name
=
"
${
var
.
name
}
"
stage
=
"
${
var
.
stage
}
"
...
...
variables.tf
View file @
51007a3c
...
...
@@ -2,6 +2,11 @@ variable "namespace" {
default
=
"global"
}
variable
"enabled"
{
description
=
"Set to false to prevent the module from creating any resources"
default
=
"true"
}
variable
"stage"
{
default
=
"default"
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment