Skip to content

Commit

Permalink
feat: update and added resource description
Browse files Browse the repository at this point in the history
  • Loading branch information
anmolnagpal committed Jun 5, 2023
1 parent 7266012 commit 1b53d4e
Show file tree
Hide file tree
Showing 11 changed files with 522 additions and 295 deletions.
92 changes: 35 additions & 57 deletions _example/memcached/example.tf
Original file line number Diff line number Diff line change
@@ -1,102 +1,80 @@
####----------------------------------------------------------------------------------
## Provider block added, Use the Amazon Web Services (AWS) provider to interact with the many resources supported by AWS.
####----------------------------------------------------------------------------------
provider "aws" {
region = "eu-west-1"
}

####----------------------------------------------------------------------------------
## A VPC is a virtual network that closely resembles a traditional network that you'd operate in your own data center.
####----------------------------------------------------------------------------------
module "vpc" {
source = "clouddrove/vpc/aws"
version = "1.3.0"
version = "1.3.1"

name = "vpc"
environment = "test"
label_order = [
"name", "environment"]
label_order = ["environment", "name"]

cidr_block = "172.16.0.0/16"
cidr_block = "10.0.0.0/16"
}

####----------------------------------------------------------------------------------
## A subnet is a range of IP addresses in your VPC.
####----------------------------------------------------------------------------------
module "subnets" {
source = "clouddrove/subnet/aws"
version = "1.3.0"

name = "subnets"
environment = "test"
label_order = ["name", "environment"]

name = "subnets"
environment = "test"
label_order = ["environment", "name"]
availability_zones = ["eu-west-1a", "eu-west-1b", "eu-west-1c"]
vpc_id = module.vpc.vpc_id
ipv6_cidr_block = module.vpc.ipv6_cidr_block
type = "public"
igw_id = module.vpc.igw_id
cidr_block = module.vpc.vpc_cidr_block
ipv6_cidr_block = module.vpc.ipv6_cidr_block
}

module "memcached-sg" {
source = "clouddrove/security-group/aws"
version = "1.3.0"
####----------------------------------------------------------------------------------
## Memcached holds its data in memory.
####----------------------------------------------------------------------------------
module "memcached" {
source = "./../../"

name = "memcached-sg"
name = "memcached"
environment = "test"
label_order = ["name", "environment"]

####----------------------------------------------------------------------------------
## Below A security group controls the traffic that is allowed to reach and leave the resources that it is associated with.
####----------------------------------------------------------------------------------
vpc_id = module.vpc.vpc_id
allowed_ip = [module.vpc.vpc_cidr_block]
allowed_ports = [11211]
}

module "kms_key" {
source = "clouddrove/kms/aws"
version = "1.3.0"

name = "kms"
environment = "test"
label_order = ["name", "environment"]

enabled = true
description = "KMS key for aurora"
alias = "alias/aurora"
key_usage = "ENCRYPT_DECRYPT"
customer_master_key_spec = "SYMMETRIC_DEFAULT"
deletion_window_in_days = 7
is_enabled = true
policy = data.aws_iam_policy_document.default.json
}

data "aws_iam_policy_document" "default" {
version = "2012-10-17"

statement {
sid = "Enable IAM User Permissions"
effect = "Allow"
principals {
type = "AWS"
identifiers = ["*"]
}
actions = ["kms:*"]
resources = ["*"]
}
}

module "memcached" {
source = "./../../"

name = "memcached"
environment = "test"
label_order = ["name", "environment"]

cluster_enabled = true
engine = "memcached"
engine_version = "1.5.10"
engine_version = "1.6.17"
family = "memcached1.5"
parameter_group_name = ""
az_mode = "cross-az"
port = 11211
node_type = "cache.t2.micro"
num_cache_nodes = 2
kms_key_id = module.kms_key.key_arn
subnet_ids = module.subnets.public_subnet_id
security_group_ids = [module.memcached-sg.security_group_ids]
availability_zones = ["eu-west-1a", "eu-west-1b"]
extra_tags = {
Application = "CloudDrove"
}

####----------------------------------------------------------------------------------
## will create ROUTE-53 for redis which will add the dns of the cluster.
####----------------------------------------------------------------------------------
dns_record_name = "prod"
route53_ttl = "300"
route53_type = "CNAME"
route53_zone_id = "FTOFGXXXXDFDFF"

}
92 changes: 37 additions & 55 deletions _example/redis-cluster/example.tf
Original file line number Diff line number Diff line change
@@ -1,25 +1,34 @@
####----------------------------------------------------------------------------------
## Provider block added, Use the Amazon Web Services (AWS) provider to interact with the many resources supported by AWS.
####----------------------------------------------------------------------------------
provider "aws" {
region = "eu-west-1"
}

####----------------------------------------------------------------------------------
## A VPC is a virtual network that closely resembles a traditional network that you'd operate in your own data center.
####----------------------------------------------------------------------------------
module "vpc" {
source = "clouddrove/vpc/aws"
version = "1.3.0"
version = "1.3.1"

name = "vpc"
environment = "test"
label_order = ["name", "environment"]
label_order = ["environment", "name"]

cidr_block = "172.16.0.0/16"
cidr_block = "10.0.0.0/16"
}

####----------------------------------------------------------------------------------
## A subnet is a range of IP addresses in your VPC.
####----------------------------------------------------------------------------------
module "subnets" {
source = "clouddrove/subnet/aws"
version = "1.3.0"

name = "subnets"
environment = "test"
label_order = ["name", "environment"]
label_order = ["environment", "name"]
availability_zones = ["eu-west-1a", "eu-west-1b", "eu-west-1c"]
vpc_id = module.vpc.vpc_id
type = "public"
Expand All @@ -28,76 +37,49 @@ module "subnets" {
ipv6_cidr_block = module.vpc.ipv6_cidr_block
}

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

name = "redis-sg"
name = "redis-cluster"
environment = "test"
label_order = ["name", "environment"]
label_order = ["environment", "name"]

####----------------------------------------------------------------------------------
## Below A security group controls the traffic that is allowed to reach and leave the resources that it is associated with.
####----------------------------------------------------------------------------------
vpc_id = module.vpc.vpc_id
allowed_ip = [module.vpc.vpc_cidr_block]
allowed_ports = [6379]
}

module "kms_key" {
source = "clouddrove/kms/aws"
version = "1.3.0"

name = "kms"
environment = "test"
label_order = ["name", "environment"]

enabled = true

description = "KMS key for aurora"
alias = "alias/redis-cluster"
key_usage = "ENCRYPT_DECRYPT"
customer_master_key_spec = "SYMMETRIC_DEFAULT"
deletion_window_in_days = 7
is_enabled = true
policy = data.aws_iam_policy_document.default.json
}

data "aws_iam_policy_document" "default" {
version = "2012-10-17"

statement {
sid = "Enable IAM User Permissions"
effect = "Allow"
principals {
type = "AWS"
identifiers = ["*"]
}
actions = ["kms:*"]
resources = ["*"]
}
}

module "redis-cluster" {
source = "./../../"

name = "cluster"
environment = "test"
label_order = ["name", "environment"]

####----------------------------------------------------------------------------------
## will create ROUTE-53 for redis which will add the dns of the cluster.
####----------------------------------------------------------------------------------
cluster_replication_enabled = true
engine = "redis"
engine_version = "7.0"
parameter_group_name = "default.redis7.cluster.on"
port = 6379
node_type = "cache.t2.micro"
kms_key_id = module.kms_key.key_arn
subnet_ids = module.subnets.public_subnet_id
security_group_ids = [module.redis-sg.security_group_ids]
availability_zones = ["eu-west-1a", "eu-west-1b"]
auto_minor_version_upgrade = true
replicas_per_node_group = 2
num_node_groups = 1
num_cache_nodes = 1
snapshot_retention_limit = 7
automatic_failover_enabled = true
extra_tags = {
Application = "CloudDrove"
}

####----------------------------------------------------------------------------------
## will create ROUTE-53 for redis which will add the dns of the cluster.
####----------------------------------------------------------------------------------
dns_record_name = "prod"
route53_ttl = "300"
route53_type = "CNAME"
route53_zone_id = "Z0xxxx16XCxxxxxxx4"
}
2 changes: 1 addition & 1 deletion _example/redis-cluster/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ output "tags" {
}

output "redis_endpoint" {
value = module.redis-cluster.redis_endpoint
value = module.redis-cluster.*.redis_endpoint
description = "Redis endpoint address."
}
11 changes: 0 additions & 11 deletions _example/redis-cluster/versions.tf

This file was deleted.

Loading

0 comments on commit 1b53d4e

Please sign in to comment.