Skip to content

Commit a79aefa

Browse files
Merge pull request #45 from clouddrove/issue-433
update and added resource and resource description
2 parents 7266012 + 072bcf0 commit a79aefa

File tree

13 files changed

+735
-359
lines changed

13 files changed

+735
-359
lines changed

README.yaml

Lines changed: 85 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -44,66 +44,106 @@ usage : |-
4444
### Redis
4545
```hcl
4646
module "redis" {
47-
source = "clouddrove/elasticache/aws
48-
version = "1.3.0"
49-
name = "redis"
50-
environment = "test"
51-
label_order = ["environment", "name"]
52-
engine = "redis"
53-
engine_version = "5.0.0"
54-
family = "redis5.0"
55-
port = 6379
56-
node_type = "cache.t2.micro"
57-
subnet_ids = ["subnet-xxxxxxx","subnet-xxxxxxx","subnet-xxxxxxx"]
58-
security_group_ids = ["sg-xxxxxxxxx"]
59-
availability_zones = ["eu-west-1a","eu-west-1b" ]
60-
auto_minor_version_upgrade = true
61-
num_cache_clusters = 2
62-
}
47+
source = "clouddrove/elasticache/aws
48+
version = "1.3.0"
49+
50+
name = "redis"
51+
environment = "test"
52+
label_order = ["name", "environment"]
53+
54+
vpc_id = module.vpc.vpc_id
55+
allowed_ip = [module.vpc.vpc_cidr_block]
56+
allowed_ports = [6379]
57+
58+
cluster_replication_enabled = true
59+
replication_enabled = true
60+
engine = "redis"
61+
engine_version = "7.0"
62+
parameter_group_name = "default.redis7"
63+
port = 6379
64+
node_type = "cache.t2.micro"
65+
subnet_ids = module.subnets.public_subnet_id
66+
availability_zones = [""]
67+
automatic_failover_enabled = false
68+
multi_az_enabled = false
69+
num_cache_clusters = 1
70+
replicas_per_node_group = 1
71+
retention_in_days = 0
72+
snapshot_retention_limit = 7
73+
74+
log_delivery_configuration = [
75+
{
76+
destination_type = "cloudwatch-logs"
77+
log_format = "json"
78+
log_type = "slow-log"
79+
},
80+
{
81+
destination_type = "cloudwatch-logs"
82+
log_format = "json"
83+
log_type = "engine-log"
84+
}
85+
]
86+
extra_tags = {
87+
Application = "CloudDrove"
88+
}
6389
6490
```
6591
### Redis Cluster
6692
```hcl
6793
module "redis-cluster" {
68-
source = "clouddrove/elasticache/aws
69-
version = "1.3.0"
70-
name = "cluster"
71-
environment = "test"
72-
label_order = ["environment","name"]
94+
source = "clouddrove/elasticache/aws
95+
version = "1.3.0"
96+
97+
name = "redis-cluster"
98+
environment = "test"
99+
label_order = ["environment", "name"]
100+
101+
vpc_id = module.vpc.vpc_id
102+
allowed_ip = [module.vpc.vpc_cidr_block]
103+
allowed_ports = [6379]
104+
73105
cluster_replication_enabled = true
74106
engine = "redis"
75-
engine_version = "5.0.0"
76-
family = "redis5.0"
107+
engine_version = "7.0"
108+
parameter_group_name = "default.redis7.cluster.on"
77109
port = 6379
78110
node_type = "cache.t2.micro"
79111
subnet_ids = module.subnets.public_subnet_id
80-
security_group_ids = [module.redis-sg.security_group_ids]
81-
availability_zones = ["eu-west-1a","eu-west-1b" ]
82-
auto_minor_version_upgrade = true
112+
availability_zones = ["eu-west-1a", "eu-west-1b"]
83113
replicas_per_node_group = 2
84-
num_node_groups = 1
114+
num_cache_nodes = 1
115+
snapshot_retention_limit = 7
85116
automatic_failover_enabled = true
86-
}
117+
extra_tags = {
118+
Application = "CloudDrove"
119+
}
87120
```
88121
### Memcache
89122
```hcl
90123
module "memcached" {
91-
source = "clouddrove/elasticache/aws
92-
version = "1.3.0"
93-
name = "memcached"
94-
environment = "test"
95-
label_order = ["environment", "name"]
96-
cluster_enabled = true
97-
engine = "memcached"
98-
engine_version = "1.5.10"
99-
family = "memcached1.5"
100-
parameter_group_name = "default.memcached1.5"
101-
az_mode = "cross-az"
102-
port = 11211
103-
node_type = "cache.t2.micro"
104-
num_cache_nodes = 2
105-
subnet_ids = ["subnet-xxxxxxx","subnet-xxxxxxx","subnet-xxxxxxx"]
106-
security_group_ids = ["sg-xxxxxxxxx"]
107-
availability_zones = ["eu-west-1a","eu-west-1b" ]
124+
source = "clouddrove/elasticache/aws
125+
version = "1.3.0"
126+
127+
name = "memcached"
128+
environment = "test"
129+
label_order = ["name", "environment"]
130+
131+
vpc_id = module.vpc.vpc_id
132+
allowed_ip = [module.vpc.vpc_cidr_block]
133+
allowed_ports = [11211]
134+
135+
cluster_enabled = true
136+
engine = "memcached"
137+
engine_version = "1.6.17"
138+
family = "memcached1.5"
139+
parameter_group_name = ""
140+
az_mode = "cross-az"
141+
port = 11211
142+
node_type = "cache.t2.micro"
143+
num_cache_nodes = 2
144+
subnet_ids = module.subnets.public_subnet_id
145+
availability_zones = ["eu-west-1a", "eu-west-1b"]
146+
extra_tags = {
147+
Application = "CloudDrove"
108148
}
109149
```

_example/memcached/example.tf

Lines changed: 49 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,84 @@
1+
####----------------------------------------------------------------------------------
2+
## Provider block added, Use the Amazon Web Services (AWS) provider to interact with the many resources supported by AWS.
3+
####----------------------------------------------------------------------------------
14
provider "aws" {
25
region = "eu-west-1"
36
}
47

8+
####----------------------------------------------------------------------------------
9+
## A VPC is a virtual network that closely resembles a traditional network that you'd operate in your own data center.
10+
####----------------------------------------------------------------------------------
511
module "vpc" {
612
source = "clouddrove/vpc/aws"
7-
version = "1.3.0"
13+
version = "1.3.1"
814

915
name = "vpc"
1016
environment = "test"
11-
label_order = [
12-
"name", "environment"]
17+
label_order = ["environment", "name"]
1318

14-
cidr_block = "172.16.0.0/16"
19+
cidr_block = "10.0.0.0/16"
1520
}
1621

22+
####----------------------------------------------------------------------------------
23+
## A subnet is a range of IP addresses in your VPC.
24+
####----------------------------------------------------------------------------------
1725
module "subnets" {
1826
source = "clouddrove/subnet/aws"
1927
version = "1.3.0"
2028

21-
name = "subnets"
22-
environment = "test"
23-
label_order = ["name", "environment"]
24-
29+
name = "subnets"
30+
environment = "test"
31+
label_order = ["environment", "name"]
2532
availability_zones = ["eu-west-1a", "eu-west-1b", "eu-west-1c"]
2633
vpc_id = module.vpc.vpc_id
27-
ipv6_cidr_block = module.vpc.ipv6_cidr_block
2834
type = "public"
2935
igw_id = module.vpc.igw_id
3036
cidr_block = module.vpc.vpc_cidr_block
37+
ipv6_cidr_block = module.vpc.ipv6_cidr_block
3138
}
3239

33-
module "memcached-sg" {
34-
source = "clouddrove/security-group/aws"
35-
version = "1.3.0"
40+
####----------------------------------------------------------------------------------
41+
## Memcached holds its data in memory.
42+
####----------------------------------------------------------------------------------
43+
module "memcached" {
44+
source = "./../../"
3645

37-
name = "memcached-sg"
46+
name = "memcached"
3847
environment = "test"
3948
label_order = ["name", "environment"]
4049

50+
####----------------------------------------------------------------------------------
51+
## Below A security group controls the traffic that is allowed to reach and leave the resources that it is associated with.
52+
####----------------------------------------------------------------------------------
4153
vpc_id = module.vpc.vpc_id
4254
allowed_ip = [module.vpc.vpc_cidr_block]
4355
allowed_ports = [11211]
44-
}
45-
46-
module "kms_key" {
47-
source = "clouddrove/kms/aws"
48-
version = "1.3.0"
49-
50-
name = "kms"
51-
environment = "test"
52-
label_order = ["name", "environment"]
5356

54-
enabled = true
55-
description = "KMS key for aurora"
56-
alias = "alias/aurora"
57-
key_usage = "ENCRYPT_DECRYPT"
58-
customer_master_key_spec = "SYMMETRIC_DEFAULT"
59-
deletion_window_in_days = 7
60-
is_enabled = true
61-
policy = data.aws_iam_policy_document.default.json
62-
}
63-
64-
data "aws_iam_policy_document" "default" {
65-
version = "2012-10-17"
66-
67-
statement {
68-
sid = "Enable IAM User Permissions"
69-
effect = "Allow"
70-
principals {
71-
type = "AWS"
72-
identifiers = ["*"]
73-
}
74-
actions = ["kms:*"]
75-
resources = ["*"]
76-
}
77-
}
78-
79-
module "memcached" {
80-
source = "./../../"
81-
82-
name = "memcached"
83-
environment = "test"
84-
label_order = ["name", "environment"]
85-
86-
cluster_enabled = true
87-
engine = "memcached"
88-
engine_version = "1.5.10"
89-
family = "memcached1.5"
90-
parameter_group_name = ""
91-
az_mode = "cross-az"
92-
port = 11211
93-
node_type = "cache.t2.micro"
94-
num_cache_nodes = 2
95-
kms_key_id = module.kms_key.key_arn
96-
subnet_ids = module.subnets.public_subnet_id
97-
security_group_ids = [module.memcached-sg.security_group_ids]
98-
availability_zones = ["eu-west-1a", "eu-west-1b"]
57+
cluster_enabled = true
58+
memcached_ssm_parameter_endpoint_enabled = true
59+
memcached_route53_record_enabled = true
60+
engine = "memcached"
61+
engine_version = "1.6.17"
62+
family = "memcached1.5"
63+
parameter_group_name = ""
64+
az_mode = "cross-az"
65+
port = 11211
66+
node_type = "cache.t2.micro"
67+
num_cache_nodes = 2
68+
subnet_ids = module.subnets.public_subnet_id
69+
availability_zones = ["eu-west-1a", "eu-west-1b"]
9970
extra_tags = {
10071
Application = "CloudDrove"
10172
}
73+
74+
####----------------------------------------------------------------------------------
75+
## will create ROUTE-53 for redis which will add the dns of the cluster.
76+
####----------------------------------------------------------------------------------
77+
route53_record_enabled = false
78+
ssm_parameter_endpoint_enabled = false
79+
dns_record_name = "prod"
80+
route53_ttl = "300"
81+
route53_type = "CNAME"
82+
route53_zone_id = "SERFxxxx6XCsY9Lxxxxx"
83+
10284
}

_example/memcached/outputs.tf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
output "id" {
2+
value = module.memcached.*.id
3+
description = "memcached id."
4+
}
5+
16
output "tags" {
27
value = module.memcached.tags
38
description = "A mapping of tags to assign to the resource."
@@ -8,3 +13,12 @@ output "memcached_endpoint" {
813
description = "Memcached endpoint address."
914
}
1015

16+
output "hostname" {
17+
value = module.memcached.hostname
18+
description = "DNS hostname"
19+
}
20+
21+
output "redis_ssm_arn" {
22+
value = module.memcached.Memcached_ssm_arn
23+
description = "A map of the names and ARNs created"
24+
}

0 commit comments

Comments
 (0)