Skip to content

Commit a8ba125

Browse files
authored
Added support for DB instance identifier (#2)
* Added support for DB instance identifier * Added var for controlling IAM DB authentication
1 parent 4b896f9 commit a8ba125

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ Create a postgres RDS instance
2929
| create\_ssm\_secret | True to create a SSM Parameter SecretString containing DB password | `bool` | `false` | no |
3030
| engine | Which RDS Engine to use | `string` | `"postgres"` | no |
3131
| engine\_version | Version of database engine to use | `string` | `"11.5"` | no |
32+
| iam\_db\_auth | True to enable IAM DB authentication | `bool` | `false` | no |
33+
| identifier | Identifier for DB Instance | `string` | n/a | yes |
3234
| instance\_class | What instance size to use | `string` | `"db.t3.small"` | no |
3335
| multi\_az | whether to make database multi-az | `string` | `true` | no |
3436
| name | common name for resources in this module | `string` | `"postgres-rds"` | no |

main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ resource "aws_db_instance" "this" {
1616
deletion_protection = true
1717
engine = var.engine
1818
engine_version = var.engine_version
19-
iam_database_authentication_enabled = true
19+
iam_database_authentication_enabled = var.iam_db_auth
20+
identifier = var.identifier
2021
instance_class = var.instance_class
2122
multi_az = var.multi_az
2223
name = var.name

variables.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,17 @@ variable "engine_version" {
5252
type = string
5353
}
5454

55+
variable "iam_db_auth" {
56+
default = false
57+
description = "True to enable IAM DB authentication"
58+
type = bool
59+
}
60+
61+
variable "identifier" {
62+
description = "Identifier for DB Instance"
63+
type = string
64+
}
65+
5566
variable "instance_class" {
5667
default = "db.t3.small"
5768
description = "What instance size to use"

0 commit comments

Comments
 (0)