- Published on
Secret Manager
- Authors
- Name
- Bowen Y
How to retrive the plain text of Secret in terraform?
data "aws_secretsmanager_secret_version" "secret" {
secret_id = aws_db_instance.lodgr_db.master_user_secret[0].secret_arn
}
output "secret" {
value = nonsensitive(data.aws_secretsmanager_secret_version.secret.secret_string)
}
ouptut >>>
secret = jsonencode(
{
+ password = "XsAsabcdefg"
+ username = "user"
}
)
secret-value = jsondecode(data.aws_secretsmanager_secret_version.secret.secret_string)["password"]