Skip to content

Commit 5595741

Browse files
Merge pull request #3 from RohitSquareops/Release-v1.0.0
Initial Release
2 parents 7365645 + 60849b5 commit 5595741

File tree

6 files changed

+71
-29
lines changed

6 files changed

+71
-29
lines changed

IAM.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
## IAM Permission
2+
3+
The Policy required to deploy this module:
4+
```hcl
5+
{
6+
"Version": "2012-10-17",
7+
"Statement": [
8+
{
9+
"Sid": "VisualEditor0",
10+
"Effect": "Allow",
11+
"Action": [
12+
"ec2:AuthorizeSecurityGroupEgress",
13+
"ec2:AuthorizeSecurityGroupIngress",
14+
"ec2:CreateSecurityGroup",
15+
"ec2:CreateTags",
16+
"ec2:DeleteSecurityGroup",
17+
"ec2:DeleteTags",
18+
"ec2:DescribeAccountAttributes",
19+
"ec2:DescribeAvailabilityZones",
20+
"ec2:DescribeNetworkInterfaces",
21+
"ec2:DescribeSecurityGroups",
22+
"ec2:RevokeSecurityGroupEgress",
23+
"ec2:RevokeSecurityGroupIngress"
24+
],
25+
"Resource": [
26+
"*"
27+
]
28+
},
29+
]
30+
}
31+
```

README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ This Terraform module provisions an Amazon RDS PostgreSQL database on AWS. Amazo
2121
## Usage Examples
2222
```hcl
2323
module "rds-pg" {
24-
source = "https://github.com/sq-ia/terraform-aws-rds-postgresql.git"
25-
name = "skaf"
26-
db_name = "postgres"
27-
vpc_id = "vpc-047eb87de44acfb73"
24+
source = "squareops/rds-postgresql/aws"
25+
name = "postgresql"
26+
db_name = "proddb"
27+
vpc_id = "vpc-047eb8acfb73"
2828
multi_az = "true"
2929
subnet_ids = ["subnet-b39cfc", "subnet-090b8d8"]
3030
environment = "prod"
@@ -37,13 +37,16 @@ module "rds-pg" {
3737
skip_final_snapshot = true
3838
backup_window = "03:00-06:00"
3939
maintenance_window = "Mon:00:00-Mon:03:00"
40-
allowed_security_groups = ["sg-013cb57dc3bc6f880"]
4140
major_engine_version = "15.2"
4241
deletion_protection = false
42+
allowed_security_groups = ["sg-013cbf880"]
4343
final_snapshot_identifier_prefix = "final"
4444
}
4545
```
46-
Refer [examples](https://github.com/sq-ia/terraform-aws-rds-postgresql/tree/main/example/complete) for more details.
46+
Refer [examples](https://github.com/squareops/terraform-aws-rds-postgresql/tree/main/example/complete) for more details.
47+
48+
## IAM Permissions
49+
The required IAM permissions to create resources from this module can be found [here](https://github.com/squareops/terraform-aws-rds-postgresql/blob/main/IAM.md)
4750

4851
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
4952
## Requirements
@@ -130,7 +133,7 @@ Refer [examples](https://github.com/sq-ia/terraform-aws-rds-postgresql/tree/main
130133

131134
To report an issue with a project:
132135

133-
1. Check the repository's [issue tracker](https://github.com/sq-ia/terraform-aws-rds-postgresql/issues) on GitHub
136+
1. Check the repository's [issue tracker](https://github.com/squareops/terraform-aws-rds-postgresql/issues) on GitHub
134137
2. Search to check if the issue has already been reported
135138
3. If you can't find an answer to your question in the documentation or issue tracker, you can ask a question by creating a new issue. Make sure to provide enough context and details.
136139

@@ -142,7 +145,7 @@ Apache License, Version 2.0, January 2004 (https://www.apache.org/licenses/LICEN
142145

143146
To support our GitHub project by liking it, you can follow these steps:
144147

145-
1. Visit the repository: Navigate to the [GitHub repository](https://github.com/sq-ia/terraform-aws-rds-postgresql)
148+
1. Visit the repository: Navigate to the [GitHub repository](https://github.com/squareops/terraform-aws-rds-postgresql)
146149

147150
2. Click the "Star" button: On the repository page, you'll see a "Star" button in the upper right corner. Clicking on it will star the repository, indicating your support for the project.
148151

example/complete/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ No providers.
2424

2525
| Name | Source | Version |
2626
|------|--------|---------|
27-
| <a name="module_rds-pg"></a> [rds-pg](#module\_rds-pg) | [email protected]:sq-ia/terraform-aws-rds-postgresql.git | n/a |
27+
| <a name="module_rds-pg"></a> [rds-pg](#module\_rds-pg) | squareops/postgresql-rds/aws | n/a |
2828

2929
## Resources
3030

example/complete/main.tf

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
locals {
22
region = "us-east-2"
3-
name = "skaf"
4-
vpc_id = "vpc-00ae5511ee10671c1"
3+
name = "postgresql"
4+
vpc_id = "vpc-00ae5571c1"
55
family = "postgres15"
6-
subnet_ids = ["subnet-0d9a81939c6dd2a6e","subnet-0fd26f0d73dc9e73d"]
6+
subnet_ids = ["subnet-0d9a8193d2a6e","subnet-0fd263dc9e73d"]
77
environment = "prod"
8-
kms_key_arn = "arn:aws:kms:us-east-2:271251951598:key/73ff9e84-83e1-4097-b388-fe29623338a9"
8+
kms_key_arn = "arn:aws:kms:us-east-2:22222222:key/73ff9e84-83e1-fe29623338a9"
99
engine_version = "15.2"
1010
instance_class = "db.m5d.large"
11-
allowed_security_groups = ["sg-0a680184e11eafd35"]
11+
allowed_security_groups = ["sg-0a680afd35"]
12+
additional_tags = {
13+
Owner = "Organization_Name"
14+
Expires = "Never"
15+
Department = "Engineering"
16+
}
1217
}
1318

1419
module "rds-pg" {
15-
source = "[email protected]:sq-ia/terraform-aws-rds-postgresql.git"
20+
source = "squareops/rds-postgresql/aws"
1621
name = local.name
1722
db_name = "postgres"
1823
multi_az = "true"

example/complete/provider.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
provider "aws" {
22
region = local.region
3+
default_tags {
4+
tags = local.additional_tags
5+
}
36
}

main.tf

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,32 @@ module "db" {
1212
source = "terraform-aws-modules/rds/aws"
1313
version = "~> 3.0"
1414
identifier = format("%s-%s", var.environment, var.name)
15+
name = var.db_name
16+
port = var.port
1517
engine = var.engine
16-
engine_version = var.engine_version
18+
username = var.master_username
19+
multi_az = var.multi_az
20+
subnet_ids = var.subnet_ids
21+
kms_key_id = var.kms_key_arn
1722
instance_class = var.instance_class
23+
engine_version = var.engine_version
1824
allocated_storage = var.allocated_storage
1925
storage_encrypted = var.storage_encrypted
20-
kms_key_id = var.kms_key_arn
2126
publicly_accessible = var.publicly_accessible
2227
replicate_source_db = var.replicate_source_db
23-
name = var.db_name
24-
username = var.master_username
25-
port = var.port
26-
multi_az = var.multi_az
27-
subnet_ids = var.subnet_ids
2828
vpc_security_group_ids = split(",", module.security_group_rds.security_group_id)
2929
skip_final_snapshot = var.skip_final_snapshot
30-
final_snapshot_identifier_prefix = var.final_snapshot_identifier_prefix
3130
snapshot_identifier = var.snapshot_identifier
3231
maintenance_window = var.maintenance_window
3332
backup_window = var.backup_window
34-
backup_retention_period = var.backup_retention_period
3533
apply_immediately = var.apply_immediately
34+
backup_retention_period = var.backup_retention_period
3635
random_password_length = var.random_password_length
3736
create_random_password = var.create_random_password
3837
monitoring_interval = "30"
3938
monitoring_role_name = format("%s-%s-RDSPostgresql", var.name, var.environment)
4039
create_monitoring_role = true
40+
final_snapshot_identifier_prefix = var.final_snapshot_identifier_prefix
4141
enabled_cloudwatch_logs_exports = ["postgresql"]
4242
tags = merge(
4343
{ "Name" = format("%s-%s", var.environment, var.name) },
@@ -60,8 +60,8 @@ resource "aws_security_group_rule" "default_ingress" {
6060
description = "From allowed SGs"
6161

6262
type = "ingress"
63-
from_port = var.port
6463
to_port = var.port
64+
from_port = var.port
6565
protocol = "tcp"
6666
source_security_group_id = element(var.allowed_security_groups, count.index)
6767
security_group_id = module.security_group_rds.security_group_id
@@ -73,8 +73,8 @@ resource "aws_security_group_rule" "cidr_ingress" {
7373
description = "From allowed CIDRs"
7474

7575
type = "ingress"
76-
from_port = var.port
7776
to_port = var.port
77+
from_port = var.port
7878
protocol = "tcp"
7979
cidr_blocks = var.allowed_cidr_blocks
8080
security_group_id = module.security_group_rds.security_group_id
@@ -83,15 +83,15 @@ resource "aws_security_group_rule" "cidr_ingress" {
8383
module "security_group_rds" {
8484
source = "terraform-aws-modules/security-group/aws"
8585
version = "~> 4"
86-
create = var.create_security_group
8786
name = format("%s-%s-%s", var.environment, var.name, "rds-sg")
88-
description = "Complete PostgreSQL example security group"
87+
create = var.create_security_group
8988
vpc_id = var.vpc_id
89+
description = "Complete PostgreSQL example security group"
9090

9191
egress_with_cidr_blocks = [
9292
{
93-
from_port = 0
9493
to_port = 0
94+
from_port = 0
9595
protocol = "-1"
9696
cidr_blocks = "0.0.0.0/0"
9797
},

0 commit comments

Comments
 (0)