Skip to content

Commit c66cd73

Browse files
decayofmindgruckionbryantbiggs
authored
feat!: Replace random password generation with manage master password, min AWS provider version increased to 5.0, id output replaced with identifier (#489)
Co-authored-by: Stephen Rayner <[email protected]> Co-authored-by: Bryant Biggs <[email protected]>
1 parent 51ededc commit c66cd73

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+259
-357
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# Crash log files
1212
crash.log
1313

14-
# Exclude all .tfvars files, which are likely to contain sentitive data, such as
14+
# Exclude all .tfvars files, which are likely to contain sensitive data, such as
1515
# password, private keys, and other secrets. These should not be part of version
1616
# control as they are data points which are potentially sensitive and subject
1717
# to change depending on the environment.

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.78.0
3+
rev: v1.81.0
44
hooks:
55
- id: terraform_fmt
66
- id: terraform_validate

CHANGELOG.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ All notable changes to this project will be documented in this file
394394
## [v2.19.0] - 2020-10-15
395395

396396
- fix: Added tflint and fixes in README ([#265](https://github.com/terraform-aws-modules/terraform-aws-rds/issues/265))
397-
- docs: Change accound to account ([#261](https://github.com/terraform-aws-modules/terraform-aws-rds/issues/261))
397+
- docs: Change account to account ([#261](https://github.com/terraform-aws-modules/terraform-aws-rds/issues/261))
398398

399399

400400
<a name="v2.18.0"></a>
@@ -814,7 +814,7 @@ All notable changes to this project will be documented in this file
814814
<a name="v1.14.0"></a>
815815
## [v1.14.0] - 2018-03-14
816816

817-
- Updated readme with conditional creatino section
817+
- Updated readme with conditional creation section
818818
- Enable db_parameter_group_name variable ([#47](https://github.com/terraform-aws-modules/terraform-aws-rds/issues/47))
819819

820820

@@ -852,7 +852,7 @@ All notable changes to this project will be documented in this file
852852
<a name="v1.8.0"></a>
853853
## [v1.8.0] - 2018-01-23
854854

855-
- Add availability zone to instance ressource module ([#35](https://github.com/terraform-aws-modules/terraform-aws-rds/issues/35))
855+
- Add availability zone to instance resource module ([#35](https://github.com/terraform-aws-modules/terraform-aws-rds/issues/35))
856856

857857

858858
<a name="v1.7.0"></a>
@@ -922,7 +922,7 @@ All notable changes to this project will be documented in this file
922922
- Merge branch 'master' of https://github.com/terraform-aws-modules/terraform-aws-rds
923923
- Updated README.md for MySQL RDS example
924924
- Updated README.md for Postgres RDS example
925-
- fianl-snapshot_identifier should default to nothing
925+
- final-snapshot_identifier should default to nothing
926926
- Add enhanced monitoring example to README, and add current contributors link
927927
- Merge branch 'master' into final_snapshot_identifier
928928
- Updated links using upstream path
@@ -952,7 +952,7 @@ All notable changes to this project will be documented in this file
952952
- Removed unused variable
953953
- Improved kms_key_id description
954954
- Cleaned duplicated attributes & variables
955-
- Merge branch 'encryption' of github.com:fmartingr/terraform-aws-rds into encryption
955+
- Merge branch 'encryption' of github.com:formatting/terraform-aws-rds into encryption
956956
- Added parameters to example
957957
- Added kms_key_id parameter
958958
- Using `encrypted` to set the db_instance.storage_encrypted

README.md

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Root module calls these modules which can also be used separately to create inde
1515

1616
```hcl
1717
module "db" {
18-
source = "terraform-aws-modules/rds/aws"
18+
source = "terraform-aws-modules/rds/aws"
1919
2020
identifier = "demodb"
2121
@@ -37,8 +37,8 @@ module "db" {
3737
3838
# Enhanced Monitoring - see example for details on how to create the role
3939
# by yourself, in case you don't want to create it automatically
40-
monitoring_interval = "30"
41-
monitoring_role_name = "MyRDSMonitoringRole"
40+
monitoring_interval = "30"
41+
monitoring_role_name = "MyRDSMonitoringRole"
4242
create_monitoring_role = true
4343
4444
tags = {
@@ -61,11 +61,11 @@ module "db" {
6161
6262
parameters = [
6363
{
64-
name = "character_set_client"
64+
name = "character_set_client"
6565
value = "utf8mb4"
6666
},
6767
{
68-
name = "character_set_server"
68+
name = "character_set_server"
6969
value = "utf8mb4"
7070
}
7171
]
@@ -201,23 +201,19 @@ Users have the ability to:
201201
## Notes
202202

203203
1. This module does not create RDS security group. Use [terraform-aws-security-group](https://github.com/terraform-aws-modules/terraform-aws-security-group) module for this.
204-
2. By default, the variable `create_random_password` is set to true. Therefore, even if the user provides a password, it will not be read. The `create_random_password` variable should be set to false and the `password` variable should have a non-null value to be read and used.
205-
3. For an RDS instance with `storage_type` using `gp3`, be aware that `iops` and `storage_throughput` cannot be specified if the `allocated_storage` value is below a per-`engine` threshold. See the [RDS User Guide](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#gp3-storage) for details.
204+
2. For an RDS instance with `storage_type` using `gp3`, be aware that `iops` and `storage_throughput` cannot be specified if the `allocated_storage` value is below a per-`engine` threshold. See the [RDS User Guide](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#gp3-storage) for details.
206205

207206
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
208207
## Requirements
209208

210209
| Name | Version |
211210
|------|---------|
212211
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
213-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.65 |
214-
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.1 |
212+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.0 |
215213

216214
## Providers
217215

218-
| Name | Version |
219-
|------|---------|
220-
| <a name="provider_random"></a> [random](#provider\_random) | >= 3.1 |
216+
No providers.
221217

222218
## Modules
223219

@@ -230,9 +226,7 @@ Users have the ability to:
230226

231227
## Resources
232228

233-
| Name | Type |
234-
|------|------|
235-
| [random_password.master_password](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/password) | resource |
229+
No resources.
236230

237231
## Inputs
238232

@@ -257,7 +251,6 @@ Users have the ability to:
257251
| <a name="input_create_db_parameter_group"></a> [create\_db\_parameter\_group](#input\_create\_db\_parameter\_group) | Whether to create a database parameter group | `bool` | `true` | no |
258252
| <a name="input_create_db_subnet_group"></a> [create\_db\_subnet\_group](#input\_create\_db\_subnet\_group) | Whether to create a database subnet group | `bool` | `false` | no |
259253
| <a name="input_create_monitoring_role"></a> [create\_monitoring\_role](#input\_create\_monitoring\_role) | Create IAM role with a defined name that permits RDS to send enhanced monitoring metrics to CloudWatch Logs | `bool` | `false` | no |
260-
| <a name="input_create_random_password"></a> [create\_random\_password](#input\_create\_random\_password) | Whether to create random password for RDS primary cluster | `bool` | `true` | no |
261254
| <a name="input_custom_iam_instance_profile"></a> [custom\_iam\_instance\_profile](#input\_custom\_iam\_instance\_profile) | RDS custom iam instance profile | `string` | `null` | no |
262255
| <a name="input_db_instance_tags"></a> [db\_instance\_tags](#input\_db\_instance\_tags) | Additional tags for the DB instance | `map(string)` | `{}` | no |
263256
| <a name="input_db_name"></a> [db\_name](#input\_db\_name) | The DB name to create. If omitted, no database is created initially | `string` | `null` | no |
@@ -285,6 +278,8 @@ Users have the ability to:
285278
| <a name="input_license_model"></a> [license\_model](#input\_license\_model) | License model information for this DB instance. Optional, but required for some DB engines, i.e. Oracle SE1 | `string` | `null` | no |
286279
| <a name="input_maintenance_window"></a> [maintenance\_window](#input\_maintenance\_window) | The window to perform maintenance in. Syntax: 'ddd:hh24:mi-ddd:hh24:mi'. Eg: 'Mon:00:00-Mon:03:00' | `string` | `null` | no |
287280
| <a name="input_major_engine_version"></a> [major\_engine\_version](#input\_major\_engine\_version) | Specifies the major version of the engine that this option group should be associated with | `string` | `null` | no |
281+
| <a name="input_manage_master_user_password"></a> [manage\_master\_user\_password](#input\_manage\_master\_user\_password) | Set to true to allow RDS to manage the master user password in Secrets Manager | `bool` | `true` | no |
282+
| <a name="input_master_user_secret_kms_key_id"></a> [master\_user\_secret\_kms\_key\_id](#input\_master\_user\_secret\_kms\_key\_id) | The key ARN, key ID, alias ARN or alias name for the KMS key to encrypt the master user password secret in Secrets Manager.<br> If not specified, the default KMS key for your Amazon Web Services account is used. | `string` | `null` | no |
288283
| <a name="input_max_allocated_storage"></a> [max\_allocated\_storage](#input\_max\_allocated\_storage) | Specifies the value for Storage Autoscaling | `number` | `0` | no |
289284
| <a name="input_monitoring_interval"></a> [monitoring\_interval](#input\_monitoring\_interval) | The interval, in seconds, between points when Enhanced Monitoring metrics are collected for the DB instance. To disable collecting Enhanced Monitoring metrics, specify 0. The default is 0. Valid Values: 0, 1, 5, 10, 15, 30, 60 | `number` | `0` | no |
290285
| <a name="input_monitoring_role_arn"></a> [monitoring\_role\_arn](#input\_monitoring\_role\_arn) | The ARN for the IAM role that permits RDS to send enhanced monitoring metrics to CloudWatch Logs. Must be specified if monitoring\_interval is non-zero | `string` | `null` | no |
@@ -304,14 +299,13 @@ Users have the ability to:
304299
| <a name="input_parameter_group_name"></a> [parameter\_group\_name](#input\_parameter\_group\_name) | Name of the DB parameter group to associate or create | `string` | `null` | no |
305300
| <a name="input_parameter_group_use_name_prefix"></a> [parameter\_group\_use\_name\_prefix](#input\_parameter\_group\_use\_name\_prefix) | Determines whether to use `parameter_group_name` as is or create a unique name beginning with the `parameter_group_name` as the prefix | `bool` | `true` | no |
306301
| <a name="input_parameters"></a> [parameters](#input\_parameters) | A list of DB parameters (map) to apply | `list(map(string))` | `[]` | no |
307-
| <a name="input_password"></a> [password](#input\_password) | Password for the master DB user. Note that this may show up in logs, and it will be stored in the state file.<br> The password provided will not be used if the variable create\_random\_password is set to true. | `string` | `null` | no |
302+
| <a name="input_password"></a> [password](#input\_password) | Password for the master DB user. Note that this may show up in logs, and it will be stored in the state file.<br> The password provided will not be used if `manage_master_user_password` is set to true. | `string` | `null` | no |
308303
| <a name="input_performance_insights_enabled"></a> [performance\_insights\_enabled](#input\_performance\_insights\_enabled) | Specifies whether Performance Insights are enabled | `bool` | `false` | no |
309304
| <a name="input_performance_insights_kms_key_id"></a> [performance\_insights\_kms\_key\_id](#input\_performance\_insights\_kms\_key\_id) | The ARN for the KMS key to encrypt Performance Insights data | `string` | `null` | no |
310305
| <a name="input_performance_insights_retention_period"></a> [performance\_insights\_retention\_period](#input\_performance\_insights\_retention\_period) | The amount of time in days to retain Performance Insights data. Valid values are `7`, `731` (2 years) or a multiple of `31` | `number` | `7` | no |
311306
| <a name="input_port"></a> [port](#input\_port) | The port on which the DB accepts connections | `string` | `null` | no |
312307
| <a name="input_publicly_accessible"></a> [publicly\_accessible](#input\_publicly\_accessible) | Bool to control if instance is publicly accessible | `bool` | `false` | no |
313308
| <a name="input_putin_khuylo"></a> [putin\_khuylo](#input\_putin\_khuylo) | Do you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info: https://en.wikipedia.org/wiki/Putin_khuylo! | `bool` | `true` | no |
314-
| <a name="input_random_password_length"></a> [random\_password\_length](#input\_random\_password\_length) | Length of random password to create | `number` | `16` | no |
315309
| <a name="input_replica_mode"></a> [replica\_mode](#input\_replica\_mode) | Specifies whether the replica is in either mounted or open-read-only mode. This attribute is only supported by Oracle instances. Oracle replicas operate in open-read-only mode unless otherwise specified | `string` | `null` | no |
316310
| <a name="input_replicate_source_db"></a> [replicate\_source\_db](#input\_replicate\_source\_db) | Specifies that this resource is a Replicate database, and to use this value as the source database. This correlates to the identifier of another Amazon RDS Database to replicate | `string` | `null` | no |
317311
| <a name="input_restore_to_point_in_time"></a> [restore\_to\_point\_in\_time](#input\_restore\_to\_point\_in\_time) | Restore to a point in time (MySQL is NOT supported) | `map(string)` | `null` | no |
@@ -338,14 +332,13 @@ Users have the ability to:
338332
| <a name="output_db_instance_ca_cert_identifier"></a> [db\_instance\_ca\_cert\_identifier](#output\_db\_instance\_ca\_cert\_identifier) | Specifies the identifier of the CA certificate for the DB instance |
339333
| <a name="output_db_instance_cloudwatch_log_groups"></a> [db\_instance\_cloudwatch\_log\_groups](#output\_db\_instance\_cloudwatch\_log\_groups) | Map of CloudWatch log groups created and their attributes |
340334
| <a name="output_db_instance_domain"></a> [db\_instance\_domain](#output\_db\_instance\_domain) | The ID of the Directory Service Active Directory domain the instance is joined to |
341-
| <a name="output_db_instance_domain_iam_role_name"></a> [db\_instance\_domain\_iam\_role\_name](#output\_db\_instance\_domain\_iam\_role\_name) | The name of the IAM role to be used when making API calls to the Directory Service. |
335+
| <a name="output_db_instance_domain_iam_role_name"></a> [db\_instance\_domain\_iam\_role\_name](#output\_db\_instance\_domain\_iam\_role\_name) | The name of the IAM role to be used when making API calls to the Directory Service |
342336
| <a name="output_db_instance_endpoint"></a> [db\_instance\_endpoint](#output\_db\_instance\_endpoint) | The connection endpoint |
343337
| <a name="output_db_instance_engine"></a> [db\_instance\_engine](#output\_db\_instance\_engine) | The database engine |
344338
| <a name="output_db_instance_engine_version_actual"></a> [db\_instance\_engine\_version\_actual](#output\_db\_instance\_engine\_version\_actual) | The running version of the database |
345339
| <a name="output_db_instance_hosted_zone_id"></a> [db\_instance\_hosted\_zone\_id](#output\_db\_instance\_hosted\_zone\_id) | The canonical hosted zone ID of the DB instance (to be used in a Route 53 Alias record) |
346-
| <a name="output_db_instance_id"></a> [db\_instance\_id](#output\_db\_instance\_id) | The RDS instance ID |
340+
| <a name="output_db_instance_identifier"></a> [db\_instance\_identifier](#output\_db\_instance\_identifier) | The RDS instance identifier |
347341
| <a name="output_db_instance_name"></a> [db\_instance\_name](#output\_db\_instance\_name) | The database name |
348-
| <a name="output_db_instance_password"></a> [db\_instance\_password](#output\_db\_instance\_password) | The database password (this password may be old, because Terraform doesn't track it after initial creation) |
349342
| <a name="output_db_instance_port"></a> [db\_instance\_port](#output\_db\_instance\_port) | The database port |
350343
| <a name="output_db_instance_resource_id"></a> [db\_instance\_resource\_id](#output\_db\_instance\_resource\_id) | The RDS Resource ID of this instance |
351344
| <a name="output_db_instance_status"></a> [db\_instance\_status](#output\_db\_instance\_status) | The RDS instance status |

examples/complete-mssql/README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ Note that this example may create resources which cost money. Run `terraform des
2020
| Name | Version |
2121
|------|---------|
2222
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
23-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.65 |
23+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.00 |
2424

2525
## Providers
2626

2727
| Name | Version |
2828
|------|---------|
29-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.65 |
29+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.00 |
3030

3131
## Modules
3232

@@ -35,8 +35,8 @@ Note that this example may create resources which cost money. Run `terraform des
3535
| <a name="module_db"></a> [db](#module\_db) | ../../ | n/a |
3636
| <a name="module_db_automated_backups_replication"></a> [db\_automated\_backups\_replication](#module\_db\_automated\_backups\_replication) | ../../modules/db_instance_automated_backups_replication | n/a |
3737
| <a name="module_db_disabled"></a> [db\_disabled](#module\_db\_disabled) | ../../ | n/a |
38-
| <a name="module_security_group"></a> [security\_group](#module\_security\_group) | terraform-aws-modules/security-group/aws | ~> 4.0 |
39-
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 4.0 |
38+
| <a name="module_security_group"></a> [security\_group](#module\_security\_group) | terraform-aws-modules/security-group/aws | ~> 5.0 |
39+
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 5.0 |
4040

4141
## Resources
4242

@@ -67,9 +67,8 @@ No inputs.
6767
| <a name="output_db_instance_engine"></a> [db\_instance\_engine](#output\_db\_instance\_engine) | The database engine |
6868
| <a name="output_db_instance_engine_version_actual"></a> [db\_instance\_engine\_version\_actual](#output\_db\_instance\_engine\_version\_actual) | The running version of the database |
6969
| <a name="output_db_instance_hosted_zone_id"></a> [db\_instance\_hosted\_zone\_id](#output\_db\_instance\_hosted\_zone\_id) | The canonical hosted zone ID of the DB instance (to be used in a Route 53 Alias record) |
70-
| <a name="output_db_instance_id"></a> [db\_instance\_id](#output\_db\_instance\_id) | The RDS instance ID |
70+
| <a name="output_db_instance_identifier"></a> [db\_instance\_identifier](#output\_db\_instance\_identifier) | The RDS instance identifier |
7171
| <a name="output_db_instance_name"></a> [db\_instance\_name](#output\_db\_instance\_name) | The database name |
72-
| <a name="output_db_instance_password"></a> [db\_instance\_password](#output\_db\_instance\_password) | The database password (this password may be old, because Terraform doesn't track it after initial creation) |
7372
| <a name="output_db_instance_port"></a> [db\_instance\_port](#output\_db\_instance\_port) | The database port |
7473
| <a name="output_db_instance_resource_id"></a> [db\_instance\_resource\_id](#output\_db\_instance\_resource\_id) | The RDS Resource ID of this instance |
7574
| <a name="output_db_instance_status"></a> [db\_instance\_status](#output\_db\_instance\_status) | The RDS instance status |

examples/complete-mssql/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ resource "aws_directory_service_directory" "demo" {
160160

161161
module "vpc" {
162162
source = "terraform-aws-modules/vpc/aws"
163-
version = "~> 4.0"
163+
version = "~> 5.0"
164164

165165
name = local.name
166166
cidr = local.vpc_cidr
@@ -177,7 +177,7 @@ module "vpc" {
177177

178178
module "security_group" {
179179
source = "terraform-aws-modules/security-group/aws"
180-
version = "~> 4.0"
180+
version = "~> 5.0"
181181

182182
name = local.name
183183
description = "Complete SqlServer example security group"

examples/complete-mssql/outputs.tf

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ output "db_instance_hosted_zone_id" {
3333
value = module.db.db_instance_hosted_zone_id
3434
}
3535

36-
output "db_instance_id" {
37-
description = "The RDS instance ID"
38-
value = module.db.db_instance_id
36+
output "db_instance_identifier" {
37+
description = "The RDS instance identifier"
38+
value = module.db.db_instance_identifier
3939
}
4040

4141
output "db_instance_resource_id" {
@@ -59,12 +59,6 @@ output "db_instance_username" {
5959
sensitive = true
6060
}
6161

62-
output "db_instance_password" {
63-
description = "The database password (this password may be old, because Terraform doesn't track it after initial creation)"
64-
value = module.db.db_instance_password
65-
sensitive = true
66-
}
67-
6862
output "db_instance_port" {
6963
description = "The database port"
7064
value = module.db.db_instance_port

examples/complete-mssql/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 4.65"
7+
version = ">= 5.00"
88
}
99
}
1010
}

0 commit comments

Comments
 (0)