Skip to content

Commit 00a52f9

Browse files
committed
initial commit
1 parent aa69604 commit 00a52f9

21 files changed

+256
-219
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,5 @@ _testmain.go
7979
/test/run.out
8080
/test/times.out
8181

82-
# ignore requried vars file
83-
**/test_data
82+
# ignore test file(s)
83+
**test**

README.md

Lines changed: 70 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,29 @@
1-
[![](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
2-
# terraform-aws-elasticache
3-
Terraform module elasticache
1+
<p align="center">
2+
<a href="https://github.com/tomarv2/terraform-aws-elasticache/actions/workflows/security_scans.yml" alt="Security Scans">
3+
<img src="https://github.com/tomarv2/terraform-aws-elasticache/actions/workflows/security_scans.yml/badge.svg?branch=main" /></a>
4+
<a href="https://www.apache.org/licenses/LICENSE-2.0" alt="license">
5+
<img src="https://img.shields.io/github/license/tomarv2/terraform-aws-elasticache" /></a>
6+
<a href="https://github.com/tomarv2/terraform-aws-elasticache/tags" alt="GitHub tag">
7+
<img src="https://img.shields.io/github/v/tag/tomarv2/terraform-aws-elasticache" /></a>
8+
<a href="https://github.com/tomarv2/terraform-aws-elasticache/pulse" alt="Activity">
9+
<img src="https://img.shields.io/github/commit-activity/m/tomarv2/terraform-aws-elasticache" /></a>
10+
<a href="https://stackoverflow.com/users/6679867/tomarv2" alt="Stack Exchange reputation">
11+
<img src="https://img.shields.io/stackexchange/stackoverflow/r/6679867"></a>
12+
<a href="https://discord.gg/XH975bzN" alt="chat on Discord">
13+
<img src="https://img.shields.io/discord/813961944443912223?logo=discord"></a>
14+
<a href="https://twitter.com/intent/follow?screen_name=varuntomar2019" alt="follow on Twitter">
15+
<img src="https://img.shields.io/twitter/follow/varuntomar2019?style=social&logo=twitter"></a>
16+
</p>
17+
18+
# Terraform module for AWS [ElastiCache]
419

520
## Versions
621

722
- Module tested for Terraform 0.14.
823
- AWS provider version [3.29.0](https://registry.terraform.io/providers/hashicorp/aws/latest)
924
- `main` branch: Provider versions not pinned to keep up with Terraform releases
10-
- `tags` releases: Tags are pinned with versions (use latest tag in your releases)
25+
- `tags` releases: Tags are pinned with versions (use <a href="https://github.com/tomarv2/terraform-aws-elasticache/tags" alt="GitHub tag">
26+
<img src="https://img.shields.io/github/v/tag/tomarv2/terraform-aws-elasticache" /></a> in your releases)
1127

1228
**NOTE:**
1329

@@ -32,32 +48,69 @@ pip install tfremote
3248
export TF_AWS_BUCKET=<remote state bucket name>
3349
export TF_AWS_PROFILE=default
3450
export TF_AWS_BUCKET_REGION=us-west-2
35-
export PATH=$PATH:/usr/local/bin/
3651
```
3752

38-
- Update:
39-
```
40-
example/custom/sample.tfvars
41-
```
53+
- Updated `examples` directory with required values
4254

43-
- Change to:
44-
```
45-
example/base
46-
```
4755

4856
- Run and verify the output before deploying:
4957
```
50-
tf -cloud aws plan -var-file <path to .tfvars file>
58+
tf -cloud aws plan
5159
```
5260

5361
- Run below to deploy:
5462
```
55-
tf -cloud aws apply -var-file <path to .tfvars file>
63+
tf -cloud aws apply
5664
```
5765

5866
- Run below to destroy:
5967
```
60-
tf -cloud aws destroy -var-file <path to .tfvars file>
68+
tf -cloud aws destroy
69+
```
70+
71+
> ❗️ **Important** - Two variables are required for using `tf` package:
72+
>
73+
> - teamid
74+
> - prjid
75+
>
76+
> These variables are required to set backend path in the remote storage.
77+
> Variables can be defined using:
78+
>
79+
> - As `inline variables` e.g.: `-var='teamid=demo-team' -var='prjid=demo-project'`
80+
> - Inside `.tfvars` file e.g.: `-var-file=<tfvars file location> `
81+
>
82+
> For more information refer to [Terraform documentation](https://www.terraform.io/docs/language/values/variables.html)
83+
84+
##### ElastiCache with Security Group
85+
```
86+
module "redis" {
87+
source = "../"
88+
89+
deploy_redis = true
90+
deploy_redis_parameter_group = true
91+
security_group_ids = [module.security_group.security_group_id]
92+
account_id = "123456789012"
93+
email = "demo@demo.com"
94+
# ----------------------------------------------
95+
# Note: Do not change teamid and prjid once set.
96+
teamid = var.teamid
97+
prjid = var.prjid
98+
}
99+
100+
module "security_group" {
101+
source = "git::git@github.com:tomarv2/terraform-aws-security-group.git?ref=v0.0.1"
102+
103+
deploy_security_group = true
104+
105+
service_ports = [6379]
106+
email = "demo@demo.com"
107+
teamid = var.teamid
108+
prjid = var.prjid
109+
}
61110
```
62111

63-
Please refer to example directory [link](example/README.md) for references.
112+
Please refer to examples directory [link](examples) for references.
113+
114+
**Note:**
115+
116+
- For more information on redis: [link](https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/cluster-create-determine-requirements.html#redis-cluster-configuration)

elasticache.tf

Lines changed: 0 additions & 22 deletions
This file was deleted.

example/base/elasticache.tf

Whitespace-only changes.

example/base/main.tf

Lines changed: 0 additions & 20 deletions
This file was deleted.

example/base/remote_backend.tf

Lines changed: 0 additions & 5 deletions
This file was deleted.

example/base/variables.tf

Lines changed: 0 additions & 79 deletions
This file was deleted.

example/custom/sample.tfvars

Lines changed: 0 additions & 15 deletions
This file was deleted.

examples/output.tf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
output "elasticache_id" {
2+
value = module.redis.elasticache_id
3+
}
4+
5+
output "elasticache_cluster_address" {
6+
value = module.redis.elasticache_cluster_address
7+
}
8+
9+
output "aws_elasticache_parameter_group" {
10+
value = module.redis.aws_elasticache_parameter_group
11+
}
12+
13+
output "security_group_id" {
14+
value = module.security_group.security_group_id
15+
}

examples/remote_backend.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# file generated by wrapper script to configure backend
2+
# do not edit or delete!
3+
4+
terraform {
5+
backend "s3" {
6+
}
7+
}

0 commit comments

Comments
 (0)