Skip to content

Commit 84d3679

Browse files
author
Sohan Yadav
authored
Merge pull request #27 from clouddrove/feature/elasticcache
update example.tf and added coustom tags with tag variable
2 parents 1def13a + 370d304 commit 84d3679

File tree

13 files changed

+92
-28
lines changed

13 files changed

+92
-28
lines changed

.github/workflows/readme.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
python-version: '3.x'
1919

2020
- name: 'create readme'
21-
uses: 'clouddrove/github-actions@v9.0'
21+
uses: 'clouddrove/github-actions@v9.0.1'
2222
with:
2323
actions_subcommand: 'readme'
2424
github_token: '${{ secrets.GITHUB}}'
@@ -35,7 +35,7 @@ jobs:
3535
continue-on-error: true
3636

3737
- name: 'push readme'
38-
uses: 'clouddrove/github-actions@v9.0'
38+
uses: 'clouddrove/github-actions@v9.0.1'
3939
continue-on-error: true
4040
with:
4141
actions_subcommand: 'push'

.github/workflows/terraform.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,30 @@ jobs:
2020
aws-region: us-east-2
2121

2222
- name: 'Terraform Format'
23-
uses: 'clouddrove/github-actions@v9.0'
23+
uses: 'clouddrove/github-actions@v9.0.1'
2424
with:
2525
actions_subcommand: 'fmt'
2626

2727
- name: 'Terraform init for memcached'
28-
uses: 'clouddrove/github-actions@v9.0'
28+
uses: 'clouddrove/github-actions@v9.0.1'
2929
with:
3030
actions_subcommand: 'init'
3131
tf_actions_working_dir: ./_example/memcached
3232

3333
- name: 'Terraform validate for memcached'
34-
uses: 'clouddrove/github-actions@v9.0'
34+
uses: 'clouddrove/github-actions@v9.0.1'
3535
with:
3636
actions_subcommand: 'validate'
3737
tf_actions_working_dir: ./_example/memcached
3838

3939
- name: 'Terraform plan for memcached'
40-
uses: 'clouddrove/github-actions@v9.0'
40+
uses: 'clouddrove/github-actions@v9.0.1'
4141
with:
4242
actions_subcommand: 'plan'
4343
tf_actions_working_dir: ./_example/memcached
4444

4545
- name: 'Terraform init for redis'
46-
uses: 'clouddrove/github-actions@v9.0'
46+
uses: 'clouddrove/github-actions@v9.0.1'
4747
with:
4848
actions_subcommand: 'init'
4949
tf_actions_working_dir: ./_example/redis
@@ -55,25 +55,25 @@ jobs:
5555
tf_actions_working_dir: ./_example/redis
5656

5757
- name: 'Terraform plan for redis'
58-
uses: 'clouddrove/github-actions@v9.0'
58+
uses: 'clouddrove/github-actions@v9.0.1'
5959
with:
6060
actions_subcommand: 'plan'
6161
tf_actions_working_dir: ./_example/redis
6262

6363
- name: 'Terraform init for redis-cluster'
64-
uses: 'clouddrove/github-actions@v9.0'
64+
uses: 'clouddrove/github-actions@v9.0.1'
6565
with:
6666
actions_subcommand: 'init'
6767
tf_actions_working_dir: ./_example/redis-cluster
6868

6969
- name: 'Terraform validate for redis-cluster'
70-
uses: 'clouddrove/github-actions@v9.0'
70+
uses: 'clouddrove/github-actions@v9.0.1'
7171
with:
7272
actions_subcommand: 'validate'
7373
tf_actions_working_dir: ./_example/redis-cluster
7474

7575
- name: 'Terraform plan for redis-cluster'
76-
uses: 'clouddrove/github-actions@v9.0'
76+
uses: 'clouddrove/github-actions@v9.0.1'
7777
with:
7878
actions_subcommand: 'plan'
7979
tf_actions_working_dir: ./_example/redis-cluster

.github/workflows/terratest.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424

2525
- name: 'Terratest for redis'
2626
if: ${{ github.event.label.name == 'terratest' }}
27-
uses: 'clouddrove/github-actions@v9.0'
27+
uses: 'clouddrove/github-actions@v9.0.1'
2828
with:
2929
actions_subcommand: 'terratest'
3030
tf_actions_working_dir: '_test/redis'
@@ -33,7 +33,7 @@ jobs:
3333

3434
- name: 'Terratest for redis-cluster'
3535
if: ${{ github.event.label.name == 'terratest' }}
36-
uses: 'clouddrove/github-actions@v9.0'
36+
uses: 'clouddrove/github-actions@v9.0.1'
3737
with:
3838
actions_subcommand: 'terratest'
3939
tf_actions_working_dir: '_test/redis-cluster'

.gitignore

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,40 @@
1+
# Local .terraform directories
2+
**/.terraform/*
3+
4+
# .tfstate files
5+
*.tfstate
6+
*.tfstate.*
7+
8+
# Crash log files
9+
crash.log
10+
11+
# Ignore any .tfvars files that are generated automatically for each Terraform run. Most
12+
# .tfvars files are managed as part of configuration and so should be included in
13+
# version control.
14+
#
15+
# example.tfvars
16+
17+
# Ignore override files as they are usually used to override resources locally and so
18+
# are not checked in
19+
override.tf
20+
override.tf.json
21+
*_override.tf
22+
*_override.tf.json
23+
24+
# Include override files you do wish to add to version control using negated pattern
25+
#
26+
# !example_override.tf
27+
28+
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
29+
# example: *tfplan*
30+
31+
32+
33+
134
# ignored files
235
*.tfstate
336
*.tfstate.backup
437
.terraform
538
.idea
639
*.iml
7-
*.terraform.lock.hcl
40+
*.terraform.lock.hcl

README.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ usage : |-
9191
engine = "memcached"
9292
engine_version = "1.5.10"
9393
family = "memcached1.5"
94+
parameter_group_name = "default.memcached1.5"
9495
az_mode = "cross-az"
9596
port = 11211
9697
node_type = "cache.t2.micro"

_example/memcached/example.tf

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,19 @@ module "memcached" {
5050
environment = "test"
5151
label_order = ["name", "environment"]
5252

53-
cluster_enabled = true
54-
engine = "memcached"
55-
engine_version = "1.5.10"
56-
family = "memcached1.5"
57-
az_mode = "cross-az"
58-
port = 11211
59-
node_type = "cache.t2.micro"
60-
num_cache_nodes = 2
61-
subnet_ids = module.subnets.public_subnet_id
62-
security_group_ids = [module.memcached-sg.security_group_ids]
63-
availability_zones = ["eu-west-1a", "eu-west-1b"]
53+
cluster_enabled = true
54+
engine = "memcached"
55+
engine_version = "1.5.10"
56+
family = "memcached1.5"
57+
parameter_group_name = "default.memcached1.5"
58+
az_mode = "cross-az"
59+
port = 11211
60+
node_type = "cache.t2.micro"
61+
num_cache_nodes = 2
62+
subnet_ids = module.subnets.public_subnet_id
63+
security_group_ids = [module.memcached-sg.security_group_ids]
64+
availability_zones = ["eu-west-1a", "eu-west-1b"]
65+
extra_tags = {
66+
Application = "CloudDrove"
67+
}
6468
}

_example/memcached/outputs.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,9 @@ output "tags" {
22
value = module.memcached.tags
33
description = "A mapping of tags to assign to the resource."
44
}
5+
6+
output "memcached_endpoint" {
7+
value = module.memcached.memcached_endpoint
8+
description = "Memcached endpoint address."
9+
}
10+

_example/redis-cluster/example.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,7 @@ module "redis-cluster" {
6161
replicas_per_node_group = 2
6262
num_node_groups = 1
6363
automatic_failover_enabled = true
64+
extra_tags = {
65+
Application = "CloudDrove"
66+
}
6467
}

_example/redis-cluster/outputs.tf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
output "id" {
2-
value = module.redis-cluster.*.id
2+
value = module.redis-cluster.id
33
description = "Redis cluster id."
44
}
55

66
output "tags" {
77
value = module.redis-cluster.tags
88
description = "A mapping of tags to assign to the resource."
99
}
10+
11+
output "redis_endpoint" {
12+
value = module.redis-cluster.redis_endpoint
13+
description = "Redis endpoint address."
14+
}

_example/redis/example.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,7 @@ module "redis" {
5858
availability_zones = ["eu-west-1a", "eu-west-1b"]
5959
auto_minor_version_upgrade = true
6060
number_cache_clusters = 2
61+
extra_tags = {
62+
Application = "CloudDrove"
63+
}
6164
}

_example/redis/outputs.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,8 @@ output "tags" {
77
value = module.redis.tags
88
description = "A mapping of tags to assign to the resource."
99
}
10+
11+
output "redis_endpoint" {
12+
value = module.redis.redis_endpoint
13+
description = "Redis endpoint address."
14+
}

main.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ module "labels" {
1717
environment = var.environment
1818
managedby = var.managedby
1919
label_order = var.label_order
20+
extra_tags = var.extra_tags
2021
}
2122

2223
# Module : Elasticache Subnet Group
@@ -26,6 +27,8 @@ resource "aws_elasticache_subnet_group" "default" {
2627
name = module.labels.id
2728
subnet_ids = var.subnet_ids
2829
description = var.description
30+
31+
tags = module.labels.tags
2932
}
3033

3134
# Module : Elasticache Replication Group
@@ -58,6 +61,7 @@ resource "aws_elasticache_replication_group" "default" {
5861
auth_token = var.auth_token
5962
kms_key_id = var.kms_key_id
6063
tags = module.labels.tags
64+
6165
}
6266

6367
# Module : Elasticache Replication Group

variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ variable "attributes" {
3636
description = "Additional attributes (e.g. `1`)."
3737
}
3838

39-
variable "tags" {
40-
type = map(any)
39+
variable "extra_tags" {
40+
type = map(string)
4141
default = {}
4242
description = "Additional tags (e.g. map(`BusinessUnit`,`XYZ`)."
4343
}

0 commit comments

Comments
 (0)