Skip to content

Commit 4a3dfff

Browse files
authored
Merge pull request #7 from Datatamer/DEV-14200
DEV-14200 Add aws_db_subnet_group resource and variable changes
2 parents 941d024 + c81e880 commit 4a3dfff

File tree

6 files changed

+28
-10
lines changed

6 files changed

+28
-10
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
# Tamr Terraform Template Repo
2+
3+
## v0.3.0 - Sep 10th 2020
4+
* Adds creation of aws_db_subnet_group resource
5+
* Adds variable rds_subnet_ids to specify subnet IDs in subnet group
6+
* Renames variable subnet_name to subnet_group_name
7+
28
## v0.2.1 - Jun 22nd 2020
39
* Adds variable "engine_version" to set the postgres version
410
* Formatting and documentation updates

README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ This repo follows the [terraform standard module structure](https://www.terrafor
77
Inline example implementation of the module. This is the most basic example of what it would look like to use this module.
88
```
99
module "rds_postgres" {
10-
source = "git::https://github.com/Datatamer/terraform-rds-postgres.git?ref=0.1.0"
10+
source = "git::https://github.com/Datatamer/terraform-rds-postgres.git?ref=0.3.0"
1111
postgres_name = "example_rds_postgres"
1212
parameter_group_name = "example-rds-postgres-pg"
1313
identifier_prefix = "example-rds-"
1414
username = "exampleUsername"
1515
password = "examplePassword"
1616
17-
subnet_name = "example_subnet"
17+
subnet_group_name = "example_subnet"
18+
rds_subnet_ids = ["example-subnet-1", "example-subnet-2"]
1819
spark_cluster_sg_ids = ["sg-examplesecuritygroup1", "sg-examplesecuritygroup2"]
1920
tamr_vm_sg_id = "sg-exampletamrsecuritygroup"
2021
vpc_id = "vpc-examplevpcnetworkid"
@@ -48,6 +49,8 @@ This terraform module will create:
4849
| spark\_cluster\_sg\_ids | Security group is attached to the ec2 instances of EMR Spark | `list(string)` | n/a | yes |
4950
| tamr\_vm\_sg\_id | Security group id attached to the tamr vm | `string` | n/a | yes |
5051
| vpc\_id | VPC ID for the rds security group | `string` | n/a | yes |
52+
| subnet\_group\_name | The name of the subnet group to add the RDS instance to | `string` | n/a | yes |
53+
| rds\_subnet\_ids | List of subnet IDs to add to subnet group | `list(string)` | n/a | yes |
5154
| additional\_cidrs | Additional CIDR to connect to RDS Postgres instance | `list(string)` | `[]` | no |
5255
| additional\_tags | Additional tags to set on the RDS instance | `map` | `{}` | no |
5356
| allocated\_storage | Allocate storage | `number` | `20` | no |
@@ -66,7 +69,6 @@ This terraform module will create:
6669
| security\_group\_name | Name for the security group for the rds instance | `string` | `"tamr_rds_sg"` | no |
6770
| skip\_final\_snapshot | Skip final snapshot | `bool` | `true` | no |
6871
| storage\_type | Storage type (e.g. gp2, io1) | `string` | `"gp2"` | no |
69-
| subnet\_name | The name of the subnet to add the RDS instance to | `string` | `null` | no |
7072
| username | The postgres username | `string` | `"tamr"` | no |
7173

7274
## Outputs

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.2.1
1+
0.3.0

examples/minimal/main.tf

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
module "rds_postgres" {
2-
source = "git::https://github.com/Datatamer/terraform-rds-postgres.git?ref=0.1.0"
2+
source = "git::https://github.com/Datatamer/terraform-rds-postgres.git?ref=0.3.0"
33
postgres_name = "example_rds_postgres"
44
parameter_group_name = "example-rds-postgres-pg"
55
identifier_prefix = "example-rds-"
66

77
username = "exampleUsername"
88
password = "examplePassword"
99

10-
subnet_name = "example_subnet"
10+
subnet_group_name = "example_subnet"
11+
rds_subnet_ids = ["example-subnet-1", "example-subnet-2"]
1112
spark_cluster_sg_ids = ["sg-examplesecuritygroup1", "sg-examplesecuritygroup2"]
1213
tamr_vm_sg_id = "sg-exampletamrsecuritygroup"
1314
vpc_id = "vpc-examplevpcnetworkid"

main.tf

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ resource "aws_db_parameter_group" "rds_postgres_pg" {
55
tags = var.additional_tags
66
}
77

8+
resource "aws_db_subnet_group" "rds_postgres_subnet_group" {
9+
name = var.subnet_group_name
10+
subnet_ids = var.rds_subnet_ids
11+
}
12+
813
module "rds_sg" {
914
source = "./modules/rds-postgres-sg"
1015
spark_cluster_sg_ids = var.spark_cluster_sg_ids
@@ -31,7 +36,7 @@ resource "aws_db_instance" "rds_postgres" {
3136
username = var.username
3237
password = var.password
3338

34-
db_subnet_group_name = var.subnet_name
39+
db_subnet_group_name = aws_db_subnet_group.rds_postgres_subnet_group.name
3540
multi_az = true
3641
publicly_accessible = false
3742
vpc_security_group_ids = [module.rds_sg.rds_sg_id]

variables.tf

+7-3
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,14 @@ variable "apply_immediately" {
8181
default = false
8282
}
8383

84-
variable "subnet_name" {
85-
description = "The name of the subnet to add the RDS instance to"
84+
variable "subnet_group_name" {
85+
description = "The name of the subnet group to add the RDS instance to"
8686
type = string
87-
default = null
87+
}
88+
89+
variable "rds_subnet_ids" {
90+
description = "VPC subnet IDs in subnet group"
91+
type = list(string)
8892
}
8993

9094
variable "copy_tags_to_snapshot" {

0 commit comments

Comments
 (0)