Skip to content

Commit 1b53d4e

Browse files
committed
feat: update and added resource description
1 parent 7266012 commit 1b53d4e

File tree

11 files changed

+522
-295
lines changed

11 files changed

+522
-295
lines changed

_example/memcached/example.tf

Lines changed: 35 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,80 @@
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"]
53-
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"]
8556

8657
cluster_enabled = true
8758
engine = "memcached"
88-
engine_version = "1.5.10"
59+
engine_version = "1.6.17"
8960
family = "memcached1.5"
9061
parameter_group_name = ""
9162
az_mode = "cross-az"
9263
port = 11211
9364
node_type = "cache.t2.micro"
9465
num_cache_nodes = 2
95-
kms_key_id = module.kms_key.key_arn
9666
subnet_ids = module.subnets.public_subnet_id
97-
security_group_ids = [module.memcached-sg.security_group_ids]
9867
availability_zones = ["eu-west-1a", "eu-west-1b"]
9968
extra_tags = {
10069
Application = "CloudDrove"
10170
}
71+
72+
####----------------------------------------------------------------------------------
73+
## will create ROUTE-53 for redis which will add the dns of the cluster.
74+
####----------------------------------------------------------------------------------
75+
dns_record_name = "prod"
76+
route53_ttl = "300"
77+
route53_type = "CNAME"
78+
route53_zone_id = "FTOFGXXXXDFDFF"
79+
10280
}

_example/redis-cluster/example.tf

Lines changed: 37 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,34 @@
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 = ["name", "environment"]
17+
label_order = ["environment", "name"]
1218

13-
cidr_block = "172.16.0.0/16"
19+
cidr_block = "10.0.0.0/16"
1420
}
1521

22+
####----------------------------------------------------------------------------------
23+
## A subnet is a range of IP addresses in your VPC.
24+
####----------------------------------------------------------------------------------
1625
module "subnets" {
1726
source = "clouddrove/subnet/aws"
1827
version = "1.3.0"
1928

2029
name = "subnets"
2130
environment = "test"
22-
label_order = ["name", "environment"]
31+
label_order = ["environment", "name"]
2332
availability_zones = ["eu-west-1a", "eu-west-1b", "eu-west-1c"]
2433
vpc_id = module.vpc.vpc_id
2534
type = "public"
@@ -28,76 +37,49 @@ module "subnets" {
2837
ipv6_cidr_block = module.vpc.ipv6_cidr_block
2938
}
3039

31-
module "redis-sg" {
32-
source = "clouddrove/security-group/aws"
33-
version = "1.3.0"
40+
####----------------------------------------------------------------------------------
41+
## Amazon ElastiCache [REDIS-CLUSTER] is a fully managed in-memory data store and cache service by Amazon Web Services.
42+
## The service improves the performance of web applications by retrieving information from managed in-memory caches,
43+
## instead of relying entirely on slower disk-based databases.
44+
####----------------------------------------------------------------------------------
45+
module "redis-cluster" {
46+
source = "./../../"
3447

35-
name = "redis-sg"
48+
name = "redis-cluster"
3649
environment = "test"
37-
label_order = ["name", "environment"]
50+
label_order = ["environment", "name"]
3851

52+
####----------------------------------------------------------------------------------
53+
## Below A security group controls the traffic that is allowed to reach and leave the resources that it is associated with.
54+
####----------------------------------------------------------------------------------
3955
vpc_id = module.vpc.vpc_id
4056
allowed_ip = [module.vpc.vpc_cidr_block]
4157
allowed_ports = [6379]
42-
}
43-
44-
module "kms_key" {
45-
source = "clouddrove/kms/aws"
46-
version = "1.3.0"
47-
48-
name = "kms"
49-
environment = "test"
50-
label_order = ["name", "environment"]
51-
52-
enabled = true
53-
54-
description = "KMS key for aurora"
55-
alias = "alias/redis-cluster"
56-
key_usage = "ENCRYPT_DECRYPT"
57-
customer_master_key_spec = "SYMMETRIC_DEFAULT"
58-
deletion_window_in_days = 7
59-
is_enabled = true
60-
policy = data.aws_iam_policy_document.default.json
61-
}
62-
63-
data "aws_iam_policy_document" "default" {
64-
version = "2012-10-17"
65-
66-
statement {
67-
sid = "Enable IAM User Permissions"
68-
effect = "Allow"
69-
principals {
70-
type = "AWS"
71-
identifiers = ["*"]
72-
}
73-
actions = ["kms:*"]
74-
resources = ["*"]
75-
}
76-
}
77-
78-
module "redis-cluster" {
79-
source = "./../../"
80-
81-
name = "cluster"
82-
environment = "test"
83-
label_order = ["name", "environment"]
8458

59+
####----------------------------------------------------------------------------------
60+
## will create ROUTE-53 for redis which will add the dns of the cluster.
61+
####----------------------------------------------------------------------------------
8562
cluster_replication_enabled = true
8663
engine = "redis"
8764
engine_version = "7.0"
8865
parameter_group_name = "default.redis7.cluster.on"
8966
port = 6379
9067
node_type = "cache.t2.micro"
91-
kms_key_id = module.kms_key.key_arn
9268
subnet_ids = module.subnets.public_subnet_id
93-
security_group_ids = [module.redis-sg.security_group_ids]
9469
availability_zones = ["eu-west-1a", "eu-west-1b"]
95-
auto_minor_version_upgrade = true
9670
replicas_per_node_group = 2
97-
num_node_groups = 1
71+
num_cache_nodes = 1
9872
snapshot_retention_limit = 7
9973
automatic_failover_enabled = true
10074
extra_tags = {
10175
Application = "CloudDrove"
10276
}
77+
78+
####----------------------------------------------------------------------------------
79+
## will create ROUTE-53 for redis which will add the dns of the cluster.
80+
####----------------------------------------------------------------------------------
81+
dns_record_name = "prod"
82+
route53_ttl = "300"
83+
route53_type = "CNAME"
84+
route53_zone_id = "Z0xxxx16XCxxxxxxx4"
10385
}

_example/redis-cluster/outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ output "tags" {
99
}
1010

1111
output "redis_endpoint" {
12-
value = module.redis-cluster.redis_endpoint
12+
value = module.redis-cluster.*.redis_endpoint
1313
description = "Redis endpoint address."
1414
}

_example/redis-cluster/versions.tf

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

0 commit comments

Comments
 (0)