-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpassword.tf
More file actions
24 lines (20 loc) · 860 Bytes
/
password.tf
File metadata and controls
24 lines (20 loc) · 860 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
locals {
admin_username = "admin"
admin_password = random_password.this.result
}
resource "random_password" "this" {
// Master password length constraints differ for each database engine. For more information, see the available settings when creating each DB instance.
length = 16
special = true
// The password for the master database user can include any printable ASCII character except /, ", @, or a space.
override_special = "!#$%&*()-_=+[]{}<>:?"
}
resource "aws_secretsmanager_secret" "password" {
name = "${local.resource_name}/master"
tags = local.tags
kms_key_id = aws_kms_key.this.id
}
resource "aws_secretsmanager_secret_version" "password" {
secret_id = aws_secretsmanager_secret.password.id
secret_string = jsonencode(tomap({ "username" = local.admin_username, "password" = local.admin_password }))
}