layout | page_title | sidebar_current | description |
---|---|---|---|
random |
Random: random_password |
docs-random-resource-password |
Produces a random string of a length using alphanumeric characters and optionally special characters. The result will not be displayed to console. |
~> Note: Requires random provider version >= 2.2.0
Identical to random_string with the exception that the result is treated as sensitive and, thus, not displayed in console output.
~> Note: All attributes including the generated password will be stored in the raw state as plain-text. Read more about sensitive data in state.
This resource does use a cryptographic random number generator.
resource "random_password" "password" {
length = 16
special = true
override_special = "!#$%&*()-_=+[]{}<>:?"
}
resource "aws_db_instance" "example" {
instance_class = "db.t3.micro"
allocated_storage = 64
engine = "mysql"
username = "someone"
password = random_password.password.result
}
Random Password can be imported by specifying the value of the string:
terraform import random_password.password securepassword