Skip to content

Commit c24a960

Browse files
committed
Fixing/changing code based on comments
1 parent 52e9002 commit c24a960

File tree

10 files changed

+34
-37
lines changed

10 files changed

+34
-37
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ This terraform module will create:
5050
|------|-------------|------|---------|:--------:|
5151
| password | The password for the master DB user. | `string` | n/a | yes |
5252
| rds\_subnet\_ids | VPC subnet IDs in subnet group | `list(string)` | n/a | yes |
53+
| security\_group\_ids | List of security group IDs to allow ingress from (i.e. Spark cluster SG IDs, Tamr VM SG ID) | `list(string)` | n/a | yes |
5354
| subnet\_group\_name | The name of the subnet group to add the RDS instance to | `string` | n/a | yes |
5455
| vpc\_id | VPC ID for the rds security group | `string` | n/a | yes |
5556
| additional\_cidrs | Additional CIDR to connect to RDS Postgres instance | `list(string)` | `[]` | no |
@@ -62,7 +63,6 @@ This terraform module will create:
6263
| db\_port | The port on which the database accepts connections. | `number` | `5432` | no |
6364
| engine\_version | Version of RDS Postgres | `string` | `"12.3"` | no |
6465
| identifier\_prefix | Identifier prefix for the RDS instance | `string` | `"tamr-rds-"` | no |
65-
| ingress\_sg\_ids | List of security group IDs to allow ingress from (i.e. Spark cluster SG IDs, Tamr VM SG ID) | `list(string)` | `[]` | no |
6666
| instance\_class | Instance class | `string` | `"db.m4.large"` | no |
6767
| maintenance\_window | Maintenance window | `string` | `"sun:04:32-sun:05:02"` | no |
6868
| max\_allocated\_storage | Max allocate storage | `number` | `1000` | no |

examples/minimal/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,18 @@ No provider.
1111

1212
| Name | Description | Type | Default | Required |
1313
|------|-------------|------|---------|:--------:|
14-
| ingress\_sg\_ids | List of security group IDs to allow ingress from (i.e. Spark cluster SG IDs, Tamr VM SG ID) | `list(string)` | n/a | yes |
15-
| name-prefix | A string to prepend to names of resources created by this example | `any` | n/a | yes |
14+
| ingress\_cidr\_blocks | CIDR blocks to attach to security groups for ingress | `list(string)` | n/a | yes |
15+
| name\_prefix | A string to prepend to names of resources created by this example | `any` | n/a | yes |
16+
| security\_group\_ids | List of security group IDs to allow ingress from (i.e. Spark cluster SG IDs, Tamr VM SG ID) | `list(string)` | n/a | yes |
1617
| subnet\_ids | List of at least 2 subnets in different AZs for DB subnet group | `list(string)` | n/a | yes |
1718
| vpc\_id | VPC ID of network. | `string` | n/a | yes |
18-
| additional\_ports | Additional ports to add to the output of this module | `list(number)` | `[]` | no |
19-
| ports | Ports used by the Elasticsearch | `list(number)` | <pre>[<br> 5432<br>]</pre> | no |
19+
| egress\_cidr\_blocks | CIDR blocks to attach to security groups for egress | `list(string)` | <pre>[<br> "0.0.0.0/0"<br>]</pre> | no |
2020

2121
## Outputs
2222

2323
| Name | Description |
2424
|------|-------------|
2525
| ingress\_ports | List of ingress ports |
26+
| rds | n/a |
2627

2728
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

examples/minimal/local.tfvars

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
vpc_id = "vpc-example"
2-
subnet_ids = ["subnet-az1", "subnet-az2"]
3-
ingress_sg_ids = ["example-spark-service-access-sg", "example-tamr-vm-sg"]
1+
vpc_id = "vpc-example"
2+
subnet_ids = ["subnet-az1", "subnet-az2"]
3+
security_group_ids = ["example-spark-service-access-sg", "example-tamr-vm-sg"]
4+
name_prefix = "test" # Replace me for a more specific prefix
5+
ingress_cidr_blocks = ["1.2.3.0/24"]

examples/minimal/main.tf

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,21 @@ module "rds_postgres" {
1212
subnet_group_name = "example_subnet_group"
1313
# Network requirement: DB subnet group needs a subnet in at least two Availability Zones
1414
rds_subnet_ids = var.subnet_ids
15-
ingress_sg_ids = var.ingress_sg_ids
15+
security_group_ids = module.rds-postgres-sg.security_group_ids
1616
}
1717

1818
module "sg-ports" {
19-
# source = "git::https://github.com/Datatamer/terraform-aws-rds-postgres.git?ref=2.0.0"
19+
# source = "git::https://github.com/Datatamer/terraform-aws-rds-postgres.git//modules/rds-postgres-ports?ref=2.0.0"
2020
source = "../../modules/rds-postgres-ports"
2121
}
2222

2323
module "rds-postgres-sg" {
2424
source = "git::git@github.com:Datatamer/terraform-aws-security-groups.git?ref=1.0.0"
2525
vpc_id = var.vpc_id
26-
ingress_cidr_blocks = [
27-
"1.2.3.0/24"
28-
]
29-
egress_cidr_blocks = [
30-
"0.0.0.0/0"
31-
]
26+
ingress_cidr_blocks = var.ingress_cidr_blocks
27+
egress_cidr_blocks = var.egress_cidr_blocks
3228
ingress_ports = module.sg-ports.ingress_ports
33-
sg_name_prefix = var.name-prefix
29+
sg_name_prefix = var.name_prefix
3430
egress_protocol = "all"
3531
ingress_protocol = "tcp"
3632
}

examples/minimal/outputs.tf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
output "ingress_ports" {
2-
value = concat(
3-
var.ports,
4-
var.additional_ports,
5-
)
2+
value = module.sg-ports
63
description = "List of ingress ports"
74
}
5+
6+
output "rds" {
7+
value = module.rds_postgres
8+
}

examples/minimal/variables.tf

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,22 @@ variable "subnet_ids" {
88
description = "List of at least 2 subnets in different AZs for DB subnet group"
99
}
1010

11-
variable "ingress_sg_ids" {
11+
variable "security_group_ids" {
1212
description = "List of security group IDs to allow ingress from (i.e. Spark cluster SG IDs, Tamr VM SG ID)"
1313
type = list(string)
1414
}
1515

16-
variable "name-prefix" {
16+
variable "name_prefix" {
1717
description = "A string to prepend to names of resources created by this example"
1818
}
1919

20-
variable "ports" {
21-
type = list(number)
22-
description = "Ports used by RDS Postgres"
23-
default = [
24-
5432
25-
]
20+
variable "ingress_cidr_blocks" {
21+
description = "CIDR blocks to attach to security groups for ingress"
22+
type = list(string)
2623
}
2724

28-
variable "additional_ports" {
29-
type = list(number)
30-
description = "Additional ports to add to the output of this module"
31-
default = []
25+
variable "egress_cidr_blocks" {
26+
description = "CIDR blocks to attach to security groups for egress"
27+
type = list(string)
28+
default = ["0.0.0.0/0"]
3229
}

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ resource "aws_db_instance" "rds_postgres" {
3030
db_subnet_group_name = aws_db_subnet_group.rds_postgres_subnet_group.name
3131
multi_az = true
3232
publicly_accessible = false
33-
vpc_security_group_ids = var.ingress_sg_ids
33+
vpc_security_group_ids = var.security_group_ids
3434
parameter_group_name = aws_db_parameter_group.rds_postgres_pg.name
3535

3636
maintenance_window = var.maintenance_window

modules/rds-postgres-ports/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This module returns a list of ports used by the RDS Postgres Service.
66
Inline example implementation of the module. This is the most basic example of what it would look like to use this module.
77
```
88
module "rds_postgres" {
9-
source = "git::https://github.com/Datatamer/terraform-aws-rds-postgres//modules/es-ports?ref=2.0.0"
9+
source = "git::https://github.com/Datatamer/terraform-aws-rds-postgres//modules/rds-postgres-ports?ref=2.0.0"
1010
}
1111
```
1212

outputs.tf

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

1111
output "rds_security_group_ids" {
12-
value = var.ingress_sg_ids
12+
value = var.security_group_ids
1313
description = "List of security group ids attached to the rds instance"
1414
}
1515

variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ variable "security_group_name" {
115115
default = "tamr_rds_sg"
116116
}
117117

118-
variable "ingress_sg_ids" {
118+
variable "security_group_ids" {
119119
description = "List of security group IDs to allow ingress from (i.e. Spark cluster SG IDs, Tamr VM SG ID)"
120120
type = list(string)
121121
}

0 commit comments

Comments
 (0)