Skip to content

Commit 8722dbe

Browse files
author
amanravi-squareops
committed
updated the repo
1 parent 4b1d355 commit 8722dbe

File tree

15 files changed

+205
-154
lines changed

15 files changed

+205
-154
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
*.tfvars
77
*.pem
88
vars
9-
.helmignore
9+
.helmignore

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,9 @@ The required IAM permissions to create resources from this module can be found [
166166
| <a name="input_performance_insights_enabled"></a> [performance\_insights\_enabled](#input\_performance\_insights\_enabled) | Specifies whether Performance Insights are enabled | `bool` | `false` | no |
167167
| <a name="input_performance_insights_retention_period"></a> [performance\_insights\_retention\_period](#input\_performance\_insights\_retention\_period) | The amount of time in days to retain Performance Insights data. Valid values are `7`, `731` (2 years) or a multiple of `31` | `number` | `7` | no |
168168
| <a name="input_port"></a> [port](#input\_port) | The port number for the database | `number` | `5432` | no |
169-
| <a name="input_postgresdb_backup_config"></a> [postgresdb\_backup\_config](#input\_postgresdb\_backup\_config) | configuration options for MySQL database backups. It includes properties such as the S3 bucket URI, the S3 bucket region, and the cron expression for full backups. | `map(string)` | <pre>{<br/> "bucket_uri": "",<br/> "cron_for_full_backup": "",<br/> "postgres_database_name": "",<br/> "s3_bucket_region": ""<br/>}</pre> | no |
169+
| <a name="input_postgresdb_backup_config"></a> [postgresdb\_backup\_config](#input\_postgresdb\_backup\_config) | configuration options for MySQL database backups. It includes properties such as the S3 bucket URI, the S3 bucket region, and the cron expression for full backups. | `map(string)` | <pre>{<br/> "bucket_uri": "",<br/> "cron_for_full_backup": "",<br/> "postgres_database_name": ""<br/>}</pre> | no |
170170
| <a name="input_postgresdb_backup_enabled"></a> [postgresdb\_backup\_enabled](#input\_postgresdb\_backup\_enabled) | Specifies whether to enable backups for MySQL database. | `bool` | `false` | no |
171-
| <a name="input_postgresdb_restore_config"></a> [postgresdb\_restore\_config](#input\_postgresdb\_restore\_config) | Configuration options for restoring dump to the MySQL database. | `any` | <pre>{<br/> "bucket_uri": "",<br/> "file_name": "",<br/> "s3_bucket_region": ""<br/>}</pre> | no |
171+
| <a name="input_postgresdb_restore_config"></a> [postgresdb\_restore\_config](#input\_postgresdb\_restore\_config) | Configuration options for restoring dump to the MySQL database. | `any` | <pre>{<br/> "bucket_uri": "",<br/> "file_name": ""<br/>}</pre> | no |
172172
| <a name="input_postgresdb_restore_enabled"></a> [postgresdb\_restore\_enabled](#input\_postgresdb\_restore\_enabled) | Specifies whether to enable restoring dump to the MySQL database. | `bool` | `false` | no |
173173
| <a name="input_publicly_accessible"></a> [publicly\_accessible](#input\_publicly\_accessible) | Specifies whether the RDS instance is publicly accessible over the internet | `bool` | `false` | no |
174174
| <a name="input_random_password_length"></a> [random\_password\_length](#input\_random\_password\_length) | The length of the randomly generated password for the RDS primary cluster (default: 16) | `number` | `16` | no |

examples/complete-psql-replica/main.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,16 +115,16 @@ module "rds-pg" {
115115
slack_channel = "postgresql-notification"
116116
slack_webhook_url = "https://hooks/xxxxxxxx"
117117
custom_user_password = local.custom_user_password
118-
#if you want backup and restore then you have to create your cluster with rds vpc , subnet, key_arn.
118+
#if you want backup and restore then you have to create your cluster with rds vpc , subnet, key_arn.
119119
#And allow cluster security group in rds security group
120-
# cluster_name = "cluster-name"
120+
# cluster_name = "cluster-name"
121121
# namespace = local.namespace
122122
# create_namespace = local.create_namespace
123123
# postgresdb_backup_enabled = false
124124
# postgresdb_backup_config = {
125125
# postgres_database_name = "" # which database backup you want
126126
# s3_bucket_region = "" #s3 bucket region
127-
# cron_for_full_backup = "*/3 * * * *"
127+
# cron_for_full_backup = "*/3 * * * *"
128128
# bucket_uri = "s3://xyz" #s3 bucket uri
129129
# }
130130
# postgresdb_restore_enabled = false

examples/complete/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,13 @@ This example will be very useful for users who are new to a module and want to q
2626

2727
| Name | Source | Version |
2828
|------|--------|---------|
29+
<<<<<<< Updated upstream
2930
| <a name="module_kms"></a> [kms](#module\_kms) | terraform-aws-modules/kms/aws | ~> 1.0 |
3031
| <a name="module_rds-pg"></a> [rds-pg](#module\_rds-pg) | squareops/rds-postgresql/aws | n/a |
3132
| <a name="module_vpc"></a> [vpc](#module\_vpc) | squareops/vpc/aws | n/a |
33+
=======
34+
| <a name="module_rds-pg"></a> [rds-pg](#module\_rds-pg) | ../../ | n/a |
35+
>>>>>>> Stashed changes
3236
3337
## Resources
3438

examples/complete/main.tf

Lines changed: 107 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,13 @@ locals {
1010
instance_class = "db.t4g.micro"
1111
storage_type = "gp3"
1212
current_identity = data.aws_caller_identity.current.arn
13+
<<<<<<< Updated upstream
1314
allowed_security_groups = ["sg-xxxxxxxxxxxxxxxx"]
1415
custom_user_password = ""
16+
=======
17+
allowed_security_groups = ["sg-0c982318e4a801035"]
18+
custom_user_password = "Amanrajj12"
19+
>>>>>>> Stashed changes
1520
additional_tags = {
1621
Owner = "Organization_Name"
1722
Expires = "Never"
@@ -22,6 +27,7 @@ locals {
2227
data "aws_caller_identity" "current" {}
2328
data "aws_region" "current" {}
2429

30+
<<<<<<< Updated upstream
2531
module "kms" {
2632
source = "terraform-aws-modules/kms/aws"
2733
version = "~> 1.0"
@@ -31,74 +37,86 @@ module "kms" {
3137
is_enabled = true
3238
key_usage = "ENCRYPT_DECRYPT"
3339
multi_region = true
40+
=======
41+
# module "kms" {
42+
# source = "terraform-aws-modules/kms/aws"
43+
# version = "~> 1.0"
44+
# deletion_window_in_days = 7
45+
# description = "Complete key example showing various configurations available"
46+
# enable_key_rotation = true
47+
# is_enabled = true
48+
# key_usage = "ENCRYPT_DECRYPT"
49+
# multi_region = true
50+
>>>>>>> Stashed changes
3451

35-
# Policy
36-
enable_default_policy = true
37-
key_owners = [local.current_identity]
38-
key_administrators = [local.current_identity]
39-
key_users = [local.current_identity]
40-
key_service_users = [local.current_identity]
41-
key_statements = [
42-
{
43-
sid = "Allow use of the key"
44-
actions = [
45-
"kms:Encrypt*",
46-
"kms:Decrypt*",
47-
"kms:ReEncrypt*",
48-
"kms:GenerateDataKey*",
49-
"kms:Describe*"
50-
]
51-
resources = ["*"]
52+
# # Policy
53+
# enable_default_policy = true
54+
# key_owners = [local.current_identity]
55+
# key_administrators = [local.current_identity]
56+
# key_users = [local.current_identity]
57+
# key_service_users = [local.current_identity]
58+
# key_statements = [
59+
# {
60+
# sid = "Allow use of the key"
61+
# actions = [
62+
# "kms:Encrypt*",
63+
# "kms:Decrypt*",
64+
# "kms:ReEncrypt*",
65+
# "kms:GenerateDataKey*",
66+
# "kms:Describe*"
67+
# ]
68+
# resources = ["*"]
5269

53-
principals = [
54-
{
55-
type = "Service"
56-
identifiers = [
57-
"monitoring.rds.amazonaws.com",
58-
"rds.amazonaws.com",
59-
]
60-
}
61-
]
62-
},
63-
{
64-
sid = "Enable IAM User Permissions"
65-
actions = ["kms:*"]
66-
resources = ["*"]
70+
# principals = [
71+
# {
72+
# type = "Service"
73+
# identifiers = [
74+
# "monitoring.rds.amazonaws.com",
75+
# "rds.amazonaws.com",
76+
# ]
77+
# }
78+
# ]
79+
# },
80+
# {
81+
# sid = "Enable IAM User Permissions"
82+
# actions = ["kms:*"]
83+
# resources = ["*"]
6784

68-
principals = [
69-
{
70-
type = "AWS"
71-
identifiers = [
72-
"arn:aws:iam::${data.aws_caller_identity.current.account_id}:root",
73-
data.aws_caller_identity.current.arn,
74-
]
75-
}
76-
]
77-
}
78-
]
85+
# principals = [
86+
# {
87+
# type = "AWS"
88+
# identifiers = [
89+
# "arn:aws:iam::${data.aws_caller_identity.current.account_id}:root",
90+
# data.aws_caller_identity.current.arn,
91+
# ]
92+
# }
93+
# ]
94+
# }
95+
# ]
7996

80-
# Aliases
81-
aliases = ["${local.name}"]
97+
# # Aliases
98+
# aliases = ["${local.name}"]
8299

83-
tags = local.additional_tags
84-
}
100+
# tags = local.additional_tags
101+
# }
85102

86103

87-
module "vpc" {
88-
source = "squareops/vpc/aws"
89-
name = local.name
90-
vpc_cidr = local.vpc_cidr
91-
environment = local.environment
92-
availability_zones = ["us-east-2a", "us-east-2b"]
93-
public_subnet_enabled = true
94-
auto_assign_public_ip = true
95-
intra_subnet_enabled = false
96-
private_subnet_enabled = true
97-
one_nat_gateway_per_az = false
98-
database_subnet_enabled = true
99-
}
104+
# module "vpc" {
105+
# source = "squareops/vpc/aws"
106+
# name = local.name
107+
# vpc_cidr = local.vpc_cidr
108+
# environment = local.environment
109+
# availability_zones = ["us-east-2a", "us-east-2b"]
110+
# public_subnet_enabled = true
111+
# auto_assign_public_ip = true
112+
# intra_subnet_enabled = false
113+
# private_subnet_enabled = true
114+
# one_nat_gateway_per_az = false
115+
# database_subnet_enabled = true
116+
# }
100117

101118
module "rds-pg" {
119+
<<<<<<< Updated upstream
102120
source = "squareops/rds-postgresql/aws"
103121
name = local.name
104122
db_name = "test"
@@ -109,10 +127,26 @@ module "rds-pg" {
109127
subnet_ids = module.vpc.database_subnets ## db subnets
110128
environment = local.environment
111129
kms_key_arn = module.kms.key_arn
130+
=======
131+
# source = "squareops/rds-postgresql/aws"
132+
source = "../../"
133+
name = local.name
134+
db_name = "test"
135+
multi_az = "true"
136+
family = local.family
137+
# vpc_id = module.vpc.vpc_id
138+
vpc_id = "vpc-0596c94ef9a8c1cf3"
139+
allowed_security_groups = local.allowed_security_groups
140+
# subnet_ids = module.vpc.database_subnets ## db subnets
141+
subnet_ids = ["subnet-02d397a523ad1b92c", "subnet-0786584f53f23322d"]
142+
environment = local.environment
143+
kms_key_arn = "arn:aws:kms:us-east-1:767398031518:key/b2b4a98b-ea65-4ebd-b304-0660735e1580"
144+
# kms_key_arn = module.kms.key_arn
145+
>>>>>>> Stashed changes
112146
storage_type = local.storage_type
113147
engine_version = local.engine_version
114148
instance_class = local.instance_class
115-
master_username = "admin"
149+
master_username = "pguser"
116150
allocated_storage = "20"
117151
max_allocated_storage = 120
118152
publicly_accessible = false
@@ -132,18 +166,30 @@ module "rds-pg" {
132166
custom_user_password = local.custom_user_password
133167
#if you want backup and restore then you have to create your cluster with rds vpc id , private subnets, kms key.
134168
#And allow cluster security group in rds security group
169+
<<<<<<< Updated upstream
135170
cluster_name = ""
171+
=======
172+
cluster_name = "non-prod-15nov"
173+
>>>>>>> Stashed changes
136174
namespace = local.namespace
137175
create_namespace = local.create_namespace
138176
postgresdb_backup_enabled = false
139177
postgresdb_backup_config = {
178+
<<<<<<< Updated upstream
140179
postgres_database_name = "" # Specify the database name or Leave empty if you wish to backup all databases
180+
=======
181+
postgres_database_name = "dummydb" # Specify the database name or Leave empty if you wish to backup all databases
182+
>>>>>>> Stashed changes
141183
cron_for_full_backup = "*/2 * * * *" # set cronjob for backup
142184
bucket_uri = "s3://mongodb-backups-atmosly" # s3 bucket uri
143185
}
144-
postgresdb_restore_enabled = false
186+
postgresdb_restore_enabled = true
145187
postgresdb_restore_config = {
146188
bucket_uri = "s3://mongodb-backups-atmosly" #S3 bucket URI (without a trailing slash /) containing the backup dump file.
189+
<<<<<<< Updated upstream
147190
backup_file_name = "db5_20241114111607.sql" #Give .sql or .zip file for restore
191+
=======
192+
backup_file_name = "dummydb_20241115100801.sql" #Give .sql or .zip file for restore
193+
>>>>>>> Stashed changes
148194
}
149195
}

examples/complete/provider.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ provider "aws" {
55
}
66
}
77
data "aws_eks_cluster" "cluster" {
8-
name = ""
8+
name = "non-prod-15nov"
99

1010
}
1111
data "aws_eks_cluster_auth" "cluster" {
12-
name = ""
12+
name = "non-prod-15nov"
1313
}
1414

1515
provider "kubernetes" {

helm/values/backup/values.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
## Enable Full backup
22
backup:
33
bucket_uri: ${bucket_uri}
4-
aws_default_region: ${s3_bucket_region}
54
cron_for_full_backup: "${cron_for_full_backup}"
65
postgres_database_name: "${postgres_database_name}"
76
database_endpoint: "${db_endpoint}"

helm/values/restore/values.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
restore:
22
bucket_uri: ${bucket_uri}
3-
aws_default_region: ${s3_bucket_region}
43
db_endpoint: "${db_endpoint}"
54
db_password: "${db_password}"
65
db_username: "${db_username}"
7-
DB_NAME: "${DB_NAME}"
86
backup_file_name: "${backup_file_name}"
97

108
auth:

0 commit comments

Comments
 (0)