RandomPassword

class RandomPassword : KotlinCustomResource

Identical to random_string. This resource does use a cryptographic random number generator.

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.random.RandomPassword;
import com.pulumi.random.RandomPasswordArgs;
import com.pulumi.aws.rds.Instance;
import com.pulumi.aws.rds.InstanceArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var password = new RandomPassword("password", RandomPasswordArgs.builder()
.length(16)
.special(true)
.overrideSpecial("!#$%&*()-_=+[]{}<>:?")
.build());
var example = new Instance("example", InstanceArgs.builder()
.instanceClass("db.t3.micro")
.allocatedStorage(64)
.engine("mysql")
.username("someone")
.password(password.result())
.build());
}
}

Import

You can import external passwords into your Pulumi programs as follows:

$ import random:index/randomPassword:RandomPassword newPassword supersecret

This command will encode the supersecret token in Pulumi state and generate a code suggestion to include a new RandomPassword resource in your Pulumi program. Include the suggested code and do a pulumi up. Your secret password is now securely stored in Pulumi, and you can reference it in your Pulumi program as newPassword.result.

Properties

Link copied to clipboard
val bcryptHash: Output<String>

A bcrypt hash of the generated random string. NOTE: If the generated random string is greater than 72 bytes in length, bcrypt_hash will contain a hash of the first 72 bytes.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val keepers: Output<Map<String, String>>?

Arbitrary map of values that, when changed, will trigger recreation of resource. See the main provider documentation for more information.

Link copied to clipboard
val length: Output<Int>

The length of the string desired. The minimum value for length is 1 and, length must also be >= (min_upper + min_lower + min_numeric + min_special).

Link copied to clipboard
val lower: Output<Boolean>

Include lowercase alphabet characters in the result. Default value is true.

Link copied to clipboard
val minLower: Output<Int>

Minimum number of lowercase alphabet characters in the result. Default value is 0.

Link copied to clipboard
val minNumeric: Output<Int>

Minimum number of numeric characters in the result. Default value is 0.

Link copied to clipboard
val minSpecial: Output<Int>

Minimum number of special characters in the result. Default value is 0.

Link copied to clipboard
val minUpper: Output<Int>

Minimum number of uppercase alphabet characters in the result. Default value is 0.

Link copied to clipboard
val number: Output<Boolean>

Include numeric characters in the result. Default value is true. NOTE: This is deprecated, use numeric instead.

Link copied to clipboard
val numeric: Output<Boolean>

Include numeric characters in the result. Default value is true.

Link copied to clipboard
val overrideSpecial: Output<String>?

Supply your own list of special characters to use for string generation. This overrides the default character list in the special argument. The special argument must still be set to true for any overwritten characters to be used in generation.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val result: Output<String>

The generated random string.

Link copied to clipboard
val special: Output<Boolean>

Include special characters in the result. These are !@#$%&*()-_=+[]{}<>:?. Default value is true.

Link copied to clipboard
val upper: Output<Boolean>

Include uppercase alphabet characters in the result. Default value is true.

Link copied to clipboard
val urn: Output<String>