Skip to content

Commit

Permalink
add postgresql and mariadb
Browse files Browse the repository at this point in the history
  • Loading branch information
themaheshyadav committed Apr 4, 2022
1 parent 04c3bdc commit fdd9667
Show file tree
Hide file tree
Showing 9 changed files with 358 additions and 66 deletions.
92 changes: 92 additions & 0 deletions _examples/MariaDb/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
provider "aws" {
region = "ap-south-1"
}

module "vpc" {
source = "clouddrove/vpc/aws"
version = "0.15.0"

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

cidr_block = "10.0.0.0/16"
}

module "private_subnets" {
source = "clouddrove/subnet/aws"
version = "0.15.3"

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

availability_zones = ["ap-south-1a", "ap-south-1b"]
vpc_id = module.vpc.vpc_id
type = "public-private"
igw_id = module.vpc.igw_id
cidr_block = module.vpc.vpc_cidr_block
ipv6_cidr_block = module.vpc.ipv6_cidr_block
}

module "security_group" {
source = "clouddrove/security-group/aws"
version = "0.15.0"

name = "security-group"
environment = "test"
protocol = "tcp"
label_order = ["environment", "name"]
vpc_id = module.vpc.vpc_id
allowed_ip = ["0.0.0.0/0"]
allowed_ports = [3306]
}


module "mariadb" {
source = "../../"

name = "sg"
application = "clouddrove"
environment = "test"
label_order = ["environment", "name"]

engine = "mariadb"
engine_version = "10.6.7"
instance_class = "db.t2.small"
allocated_storage = 50

# kms_key_id = "arm:aws:kms:<region>:<accound id>:key/<kms key id>"

# DB Details
database_name = "test"
username = "user"
password = "esfsgcGdfawAhdxtfjm!"
port = "3306"

vpc_security_group_ids = [module.security_group.security_group_ids]

maintenance_window = "Mon:00:00-Mon:03:00"
backup_window = "03:00-06:00"
multi_az = false

family = "mariadb10.6"
# disable backups to create DB faster
backup_retention_period = 0

enabled_cloudwatch_logs_exports = ["audit", "general"]

# DB subnet group
subnet_ids = module.private_subnets.public_subnet_id
publicly_accessible = true

# DB parameter group

# DB option group
major_engine_version = "10.6"

# Snapshot name upon DB deletion

# Database Deletion Protection
deletion_protection = false
}
94 changes: 94 additions & 0 deletions _examples/PostgreSQL/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
provider "aws" {
region = "ap-south-1"
}

module "vpc" {
source = "clouddrove/vpc/aws"
version = "0.15.0"

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

cidr_block = "10.0.0.0/16"
}

module "private_subnets" {
source = "clouddrove/subnet/aws"
version = "0.15.3"

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

nat_gateway_enabled = true

availability_zones = ["ap-south-1a", "ap-south-1b"]
vpc_id = module.vpc.vpc_id
type = "public-private"
igw_id = module.vpc.igw_id
cidr_block = module.vpc.vpc_cidr_block
ipv6_cidr_block = module.vpc.ipv6_cidr_block
assign_ipv6_address_on_creation = false
}


module "security_group" {
source = "clouddrove/security-group/aws"
version = "0.15.0"

name = "security-group"
environment = "test"
protocol = "tcp"
label_order = ["environment", "name"]
vpc_id = module.vpc.vpc_id
allowed_ip = ["0.0.0.0/0"]
allowed_ports = [5432]
}

module "postgresql" {
source = "../../"

name = "sg"
application = "clouddrove"
environment = "test"
label_order = ["environment", "name"]

engine = "postgres"
engine_version = "14.1"
instance_class = "db.t3.medium"
allocated_storage = 50
storage_encrypted = true
# kms_key_id = "arm:aws:kms:<region>:<accound id>:key/<kms key id>"
family = "postgres14"
# DB Details
database_name = "test"
username = "dbname"
password = "esfsgcGdfawAhdxtfjm!"
port = "5432"

vpc_security_group_ids = [module.security_group.security_group_ids]

maintenance_window = "Mon:00:00-Mon:03:00"
backup_window = "03:00-06:00"
multi_az = false


# disable backups to create DB faster
backup_retention_period = 0

enabled_cloudwatch_logs_exports = ["postgresql", "upgrade"]

# DB subnet group
subnet_ids = module.private_subnets.public_subnet_id
publicly_accessible = true

# DB option group
major_engine_version = "14"

# Snapshot name upon DB deletion

# Database Deletion Protection
deletion_protection = false

}
5 changes: 2 additions & 3 deletions _examples/complete-mysql/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ module "vpc" {

module "subnets" {
source = "clouddrove/subnet/aws"
version = "0.15.0"
version = "0.15.3"

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

availability_zones = ["ap-south-1a", "ap-south-1b", "ap-south-1c"]
availability_zones = ["ap-south-1a", "ap-south-1b"]
vpc_id = module.vpc.vpc_id
type = "public"
igw_id = module.vpc.igw_id
Expand Down Expand Up @@ -91,7 +91,6 @@ module "mysql" {
# Database Deletion Protection
deletion_protection = false


parameters = [
{
name = "character_set_client"
Expand Down
18 changes: 6 additions & 12 deletions _examples/oracle_db/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
provider "aws" {
region = "eu-west-1"
region = "ap-south-1"
}

module "vpc" {
Expand All @@ -23,7 +23,7 @@ module "private_subnets" {

nat_gateway_enabled = true

availability_zones = ["eu-west-1a", "eu-west-1b"]
availability_zones = ["ap-south-1a", "ap-south-1b"]
vpc_id = module.vpc.vpc_id
type = "public-private"
igw_id = module.vpc.igw_id
Expand All @@ -43,7 +43,7 @@ module "security_group" {
label_order = ["environment", "name"]
vpc_id = module.vpc.vpc_id
allowed_ip = ["0.0.0.0/0"]
allowed_ports = [3306]
allowed_ports = [1521]
}

module "oracle" {
Expand All @@ -58,9 +58,9 @@ module "oracle" {
engine_version = "19.0.0.0.ru-2021-10.rur-2021-10.r1"
instance_class = "db.t3.medium"
allocated_storage = 50

storage_encrypted = true
# kms_key_id = "arm:aws:kms:<region>:<accound id>:key/<kms key id>"

family = "oracle-se2-19"
# DB Details
database_name = "test"
username = "admin"
Expand All @@ -82,18 +82,12 @@ module "oracle" {
# DB subnet group
subnet_ids = module.private_subnets.public_subnet_id
publicly_accessible = true

# DB parameter group
parameter_group_name = "default.oracle-se2-19"
option_group_name = "default:oracle-se2-19"

# DB option group
major_engine_version = "12.1"
major_engine_version = "19"

# Snapshot name upon DB deletion

# Database Deletion Protection
deletion_protection = false


}
4 changes: 2 additions & 2 deletions _examples/replica-mysql/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module "vpc" {

module "subnets" {
source = "clouddrove/subnet/aws"
version = "0.15.0"
version = "0.15.3"

name = "subnets"
environment = "test"
Expand Down Expand Up @@ -142,7 +142,7 @@ module "master" {
module "replica" {
source = "../../"

identifier = "demodb-replica-mysql"
# identifier = "demodb-replica-mysql"

# Source database. For cross-region use this_db_instance_arn
replicate_source_db = module.master.id
Expand Down
Loading

0 comments on commit fdd9667

Please sign in to comment.