From b0a6af948c01d15b3fc0245233162bf21e2928f2 Mon Sep 17 00:00:00 2001 From: Genevieve LEsperance Date: Sat, 9 Dec 2017 10:24:16 -0800 Subject: [PATCH] Use random_string resource for rds password. [#153526683] --- rds.tf | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rds.tf b/rds.tf index 88793f95..9860aa20 100644 --- a/rds.tf +++ b/rds.tf @@ -1,3 +1,8 @@ +resource "random_string" "rds_password" { + length = 16 + special = true +} + resource "aws_db_instance" "rds" { allocated_storage = 100 instance_class = "${var.rds_instance_class}" @@ -5,7 +10,7 @@ resource "aws_db_instance" "rds" { engine_version = "5.6.35" identifier = "${var.env_name}" username = "${var.rds_db_username}" - password = "${md5(timestamp())}" + password = "${random_string.rds_password.result}" db_subnet_group_name = "${aws_db_subnet_group.rds_subnet_group.name}" publicly_accessible = false vpc_security_group_ids = ["${aws_security_group.mysql_security_group.id}"]