Skip to content

Commit 2a6f538

Browse files
committed
Update docs, add Mike Arnold to contributors, fix code-style
1 parent f3ab47c commit 2a6f538

File tree

3 files changed

+40
-24
lines changed

3 files changed

+40
-24
lines changed

README.md

+22-14
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,18 @@ in a VPC. Supported engines are `postgres` and `mysql`. A newly created user, or
3232
don't need a new user) will be granted all permissions to created database.
3333

3434
**Features**:
35-
- Master user password as well as new user password can be passed to the module either via variables or via SSM
36-
Parameters (**preferred**).
35+
- Master user password as well as new user password can be passed to the module either via
36+
- Module variables
37+
- Parameters in SSM Parameter Store (**Recommended!**)
38+
- Secrets in Secrets Manager (**Recommended!**)
3739
- Lambda function execution logs are shipped to Cloudwatch.
3840
- No database or user will be created if they are already exist.
3941

42+
**Notes on using secrets from AWS Secrets Manager**:
43+
- When [referencing secrets stored in Secrets Manager](https://docs.aws.amazon.com/systems-manager/latest/userguide/integration-ps-secretsmanager.html),
44+
the `/aws/reference/secretsmanager` prefix must be used
45+
- A secret must contain password in the `password` field or be a plain-text secret
46+
4047
**Caveats**:
4148
- This lambda function needs internet access in order to comminitcate with AWS API. You need to associate this
4249
function with one or more private subnets in your VPC and make sure that their routing tables have a default
@@ -49,10 +56,9 @@ don't need a new user) will be granted all permissions to created database.
4956
security groups and/or subnets.
5057
More context: [Corresponding issue on github](https://github.com/terraform-providers/terraform-provider-aws/issues/10329)
5158

52-
**TODOs**:
53-
- Support SSL connections to RDS
54-
- Switch to Circle CI for CI/CD pipelines
55-
- Pack source code to a ZIP file (?)
59+
**Backlog**:
60+
[ ] Support SSL connections to RDS
61+
[ ] Switch to Circle CI for CI/CD pipelines
5662

5763
This module is backed by best of breed terraform modules maintained by [Cloudposse](https://github.com/cloudposse).
5864

@@ -178,17 +184,17 @@ module "db_provisioner" {
178184
| db\_instance\_id | DB Instance Identifier | `string` | n/a | yes |
179185
| db\_instance\_security\_group\_id | DB instance security group to add rules to. Rules will allow communication between Lambda and DB instance | `string` | `null` | no |
180186
| db\_master\_password | DB Instance master password. The usage of this parameter is discouraged. Consider putting db password in SSM Parameter Store and passing its ARN to the module via `db_master_password_ssm_parameter_arn` parameter | `string` | `null` | no |
181-
| db\_master\_password\_ssm\_param | Name of SSM Parameter that stores password for master user. This param takes precendence other `db_master_password` | `string` | `null` | no |
187+
| db\_master\_password\_ssm\_param | Name of SSM Parameter that stores password for master user. This param takes precedence other `db_master_password` | `string` | `null` | no |
182188
| db\_master\_password\_ssm\_param\_kms\_key | Identifier of KMS key used for encryption of SSM Parameter that stores password for master user | `string` | `null` | no |
183189
| db\_name | Database name that should be created | `string` | n/a | yes |
184-
| db\_user | Name of user that should be created and own (has all persmiison to) the provisioned database. If left empty, no user will be created | `string` | `null` | no |
185-
| db\_user\_password | Password for the user that should be created and own (has all persmiison to) the provisioned database. Ignored if `db_user` is set to null | `string` | `null` | no |
186-
| db\_user\_password\_ssm\_param | Name of SSM Parameter that stores password for provisioned user. This param takes precendence other `db_user_password` | `string` | `null` | no |
190+
| db\_user | Name of user that should be created and own (has all permission to) the provisioned database. If left empty, no user will be created | `string` | `null` | no |
191+
| db\_user\_password | Password for the user that should be created and own (has all permission to) the provisioned database. Ignored if `db_user` is set to null | `string` | `null` | no |
192+
| db\_user\_password\_ssm\_param | Name of SSM Parameter that stores password for provisioned user. This param takes precedence other `db_user_password` | `string` | `null` | no |
187193
| db\_user\_password\_ssm\_param\_kms\_key | Identifier of KMS key used for encryption of SSM Parameter that stores password for provisioned user | `string` | `null` | no |
188194
| delimiter | Delimiter to be used between `namespace`, `name`, `stage` and `attributes` | `string` | `"-"` | no |
189195
| enabled | Defines whether this module should create resources | `bool` | `true` | no |
190196
| invoke | Defines whether lambda function should be invoked immediately after provisioning | `bool` | `true` | no |
191-
| kms\_key | KMS key identifier. Acceptes the same format as KMS key data source (https://www.terraform.io/docs/providers/aws/d/kms_key.html). If this configuration is not provided when environment variables are in use, AWS Lambda uses a default service key. | `string` | `null` | no |
197+
| kms\_key | KMS key identifier. Accepts the same format as KMS key data source (https://www.terraform.io/docs/providers/aws/d/kms_key.html). If this configuration is not provided when environment variables are in use, AWS Lambda uses a default service key. | `string` | `null` | no |
192198
| logs\_kms\_key\_id | KMS Key Id for Lambda function logs ecnryption | `string` | `null` | no |
193199
| logs\_retention\_days | Lambda function logs retentions in days | `number` | `null` | no |
194200
| memory | Amount of memory in MB your Lambda Function can use at runtime | `number` | `256` | no |
@@ -197,7 +203,7 @@ module "db_provisioner" {
197203
| stage | Stage (e.g. `prod`, `dev`, `staging`) | `string` | `""` | no |
198204
| tags | Additional tags (e.g. `map(`BusinessUnit`,`XYZ`)` | `map(string)` | `{}` | no |
199205
| timeout | The amount of time your Lambda Function has to run in seconds | `number` | `30` | no |
200-
| vpc\_config | VPC configuratiuon for Lambda function | <pre>object({<br> vpc_id = string<br> subnet_ids = list(string)<br> security_group_ids = list(string)<br> })</pre> | n/a | yes |
206+
| vpc\_config | VPC configuration for Lambda function | <pre>object({<br> vpc_id = string<br> subnet_ids = list(string)<br> security_group_ids = list(string)<br> })</pre> | n/a | yes |
201207

202208
## Outputs
203209

@@ -283,11 +289,13 @@ All other trademarks referenced herein are the property of their respective owne
283289

284290
### Contributors
285291

286-
| [![Aleksandr Fofanov][aleks-fofanov_avatar]][aleks-fofanov_homepage]<br/>[Aleksandr Fofanov][aleks-fofanov_homepage] |
287-
|---|
292+
| [![Aleksandr Fofanov][aleks-fofanov_avatar]][aleks-fofanov_homepage]<br/>[Aleksandr Fofanov][aleks-fofanov_homepage] | [![Mike Arnold][razorsedge_avatar]][razorsedge_homepage]<br/>[Mike Arnold][razorsedge_homepage] |
293+
|---|---|
288294

289295
[aleks-fofanov_homepage]: https://github.com/aleks-fofanov
290296
[aleks-fofanov_avatar]: https://github.com/aleks-fofanov.png?size=150
297+
[razorsedge_homepage]: https://github.com/razorsedge
298+
[razorsedge_avatar]: https://github.com/razorsedge.png?size=150
291299

292300

293301

README.yaml

+14-6
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,18 @@ introduction: |-
4848
don't need a new user) will be granted all permissions to created database.
4949
5050
**Features**:
51-
- Master user password as well as new user password can be passed to the module either via variables or via SSM
52-
Parameters (**preferred**).
51+
- Master user password as well as new user password can be passed to the module either via
52+
- Module variables
53+
- Parameters in SSM Parameter Store (**Recommended!**)
54+
- Secrets in Secrets Manager (**Recommended!**)
5355
- Lambda function execution logs are shipped to Cloudwatch.
5456
- No database or user will be created if they are already exist.
5557
58+
**Notes on using secrets from AWS Secrets Manager**:
59+
- When [referencing secrets stored in Secrets Manager](https://docs.aws.amazon.com/systems-manager/latest/userguide/integration-ps-secretsmanager.html),
60+
the `/aws/reference/secretsmanager` prefix must be used
61+
- A secret must contain password in the `password` field or be a plain-text secret
62+
5663
**Caveats**:
5764
- This lambda function needs internet access in order to comminitcate with AWS API. You need to associate this
5865
function with one or more private subnets in your VPC and make sure that their routing tables have a default
@@ -65,10 +72,9 @@ introduction: |-
6572
security groups and/or subnets.
6673
More context: [Corresponding issue on github](https://github.com/terraform-providers/terraform-provider-aws/issues/10329)
6774
68-
**TODOs**:
69-
- Support SSL connections to RDS
70-
- Switch to Circle CI for CI/CD pipelines
71-
- Pack source code to a ZIP file (?)
75+
**Backlog**:
76+
[ ] Support SSL connections to RDS
77+
[ ] Switch to Circle CI for CI/CD pipelines
7278
7379
This module is backed by best of breed terraform modules maintained by [Cloudposse](https://github.com/cloudposse).
7480
@@ -165,3 +171,5 @@ include:
165171
contributors:
166172
- name: "Aleksandr Fofanov"
167173
github: "aleks-fofanov"
174+
- name: "Mike Arnold"
175+
github: "razorsedge"

main.tf

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ locals {
99
master_password_in_ssm_param = var.db_master_password_ssm_param != null ? true : false
1010
master_password_ssm_param_ecnrypted = var.db_master_password_ssm_param_kms_key != null ? true : false
1111
# Replace null with empty string so that the following regexall will work.
12-
db_master_password_ssm_param = var.db_master_password_ssm_param == null ? "" : var.db_master_password_ssm_param
13-
master_password_in_secretsmanager = length(regexall("/aws/reference/secretsmanager/", local.db_master_password_ssm_param)) > 0
12+
db_master_password_ssm_param = var.db_master_password_ssm_param == null ? "" : var.db_master_password_ssm_param
13+
master_password_in_secretsmanager = length(regexall("/aws/reference/secretsmanager/", local.db_master_password_ssm_param)) > 0
1414

1515
// Provisioned user password
1616
user_password_in_ssm_param = var.db_user_password_ssm_param != null ? true : false
1717
user_password_ssm_param_ecnrypted = var.db_user_password_ssm_param_kms_key != null ? true : false
1818
# Replace null with empty string so that the following regexall will work.
19-
db_user_password_ssm_param = var.db_user_password_ssm_param == null ? "" : var.db_user_password_ssm_param
20-
user_password_in_secretsmanager = length(regexall("/aws/reference/secretsmanager/", local.db_user_password_ssm_param)) > 0
19+
db_user_password_ssm_param = var.db_user_password_ssm_param == null ? "" : var.db_user_password_ssm_param
20+
user_password_in_secretsmanager = length(regexall("/aws/reference/secretsmanager/", local.db_user_password_ssm_param)) > 0
2121
}
2222

2323
#############################################################

0 commit comments

Comments
 (0)