1. Packages
  2. Random Provider
  3. API Docs
  4. RandomPassword
random v4.18.0 published on Wednesday, Feb 26, 2025 by Pulumi

random.RandomPassword

Explore with Pulumi AI

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import * as random from "@pulumi/random";

const password = new random.RandomPassword("password", {
    length: 16,
    special: true,
    overrideSpecial: "!#$%&*()-_=+[]{}<>:?",
});
const example = new aws.rds.Instance("example", {
    instanceClass: aws.rds.InstanceType.T3_Micro,
    allocatedStorage: 64,
    engine: "mysql",
    username: "someone",
    password: password.result,
});
Copy
import pulumi
import pulumi_aws as aws
import pulumi_random as random

password = random.RandomPassword("password",
    length=16,
    special=True,
    override_special="!#$%&*()-_=+[]{}<>:?")
example = aws.rds.Instance("example",
    instance_class=aws.rds.InstanceType.T3_MICRO,
    allocated_storage=64,
    engine="mysql",
    username="someone",
    password=password.result)
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/rds"
	"github.com/pulumi/pulumi-random/sdk/v4/go/random"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		password, err := random.NewRandomPassword(ctx, "password", &random.RandomPasswordArgs{
			Length:          pulumi.Int(16),
			Special:         pulumi.Bool(true),
			OverrideSpecial: pulumi.String("!#$%&*()-_=+[]{}<>:?"),
		})
		if err != nil {
			return err
		}
		_, err = rds.NewInstance(ctx, "example", &rds.InstanceArgs{
			InstanceClass:    pulumi.String(rds.InstanceType_T3_Micro),
			AllocatedStorage: pulumi.Int(64),
			Engine:           pulumi.String("mysql"),
			Username:         pulumi.String("someone"),
			Password:         password.Result,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
using Random = Pulumi.Random;

return await Deployment.RunAsync(() => 
{
    var password = new Random.RandomPassword("password", new()
    {
        Length = 16,
        Special = true,
        OverrideSpecial = "!#$%&*()-_=+[]{}<>:?",
    });

    var example = new Aws.Rds.Instance("example", new()
    {
        InstanceClass = Aws.Rds.InstanceType.T3_Micro,
        AllocatedStorage = 64,
        Engine = "mysql",
        Username = "someone",
        Password = password.Result,
    });

});
Copy
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());

    }
}
Copy
resources:
  password:
    type: random:RandomPassword
    properties:
      length: 16
      special: true
      overrideSpecial: '!#$%&*()-_=+[]{}<>:?'
  example:
    type: aws:rds:Instance
    properties:
      instanceClass: db.t3.micro
      allocatedStorage: 64
      engine: mysql
      username: someone
      password: ${password.result}
Copy

Create RandomPassword Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new RandomPassword(name: string, args: RandomPasswordArgs, opts?: CustomResourceOptions);
@overload
def RandomPassword(resource_name: str,
                   args: RandomPasswordArgs,
                   opts: Optional[ResourceOptions] = None)

@overload
def RandomPassword(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   length: Optional[int] = None,
                   keepers: Optional[Mapping[str, str]] = None,
                   lower: Optional[bool] = None,
                   min_lower: Optional[int] = None,
                   min_numeric: Optional[int] = None,
                   min_special: Optional[int] = None,
                   min_upper: Optional[int] = None,
                   number: Optional[bool] = None,
                   numeric: Optional[bool] = None,
                   override_special: Optional[str] = None,
                   special: Optional[bool] = None,
                   upper: Optional[bool] = None)
func NewRandomPassword(ctx *Context, name string, args RandomPasswordArgs, opts ...ResourceOption) (*RandomPassword, error)
public RandomPassword(string name, RandomPasswordArgs args, CustomResourceOptions? opts = null)
public RandomPassword(String name, RandomPasswordArgs args)
public RandomPassword(String name, RandomPasswordArgs args, CustomResourceOptions options)
type: random:RandomPassword
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. RandomPasswordArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. RandomPasswordArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. RandomPasswordArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. RandomPasswordArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. RandomPasswordArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var randomPasswordResource = new Random.RandomPassword("randomPasswordResource", new()
{
    Length = 0,
    Keepers = 
    {
        { "string", "string" },
    },
    Lower = false,
    MinLower = 0,
    MinNumeric = 0,
    MinSpecial = 0,
    MinUpper = 0,
    Numeric = false,
    OverrideSpecial = "string",
    Special = false,
    Upper = false,
});
Copy
example, err := random.NewRandomPassword(ctx, "randomPasswordResource", &random.RandomPasswordArgs{
	Length: pulumi.Int(0),
	Keepers: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	Lower:           pulumi.Bool(false),
	MinLower:        pulumi.Int(0),
	MinNumeric:      pulumi.Int(0),
	MinSpecial:      pulumi.Int(0),
	MinUpper:        pulumi.Int(0),
	Numeric:         pulumi.Bool(false),
	OverrideSpecial: pulumi.String("string"),
	Special:         pulumi.Bool(false),
	Upper:           pulumi.Bool(false),
})
Copy
var randomPasswordResource = new RandomPassword("randomPasswordResource", RandomPasswordArgs.builder()
    .length(0)
    .keepers(Map.of("string", "string"))
    .lower(false)
    .minLower(0)
    .minNumeric(0)
    .minSpecial(0)
    .minUpper(0)
    .numeric(false)
    .overrideSpecial("string")
    .special(false)
    .upper(false)
    .build());
Copy
random_password_resource = random.RandomPassword("randomPasswordResource",
    length=0,
    keepers={
        "string": "string",
    },
    lower=False,
    min_lower=0,
    min_numeric=0,
    min_special=0,
    min_upper=0,
    numeric=False,
    override_special="string",
    special=False,
    upper=False)
Copy
const randomPasswordResource = new random.RandomPassword("randomPasswordResource", {
    length: 0,
    keepers: {
        string: "string",
    },
    lower: false,
    minLower: 0,
    minNumeric: 0,
    minSpecial: 0,
    minUpper: 0,
    numeric: false,
    overrideSpecial: "string",
    special: false,
    upper: false,
});
Copy
type: random:RandomPassword
properties:
    keepers:
        string: string
    length: 0
    lower: false
    minLower: 0
    minNumeric: 0
    minSpecial: 0
    minUpper: 0
    numeric: false
    overrideSpecial: string
    special: false
    upper: false
Copy

RandomPassword Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The RandomPassword resource accepts the following input properties:

Length This property is required. 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).
Keepers Dictionary<string, string>
Arbitrary map of values that, when changed, will trigger recreation of resource. See the main provider documentation for more information.
Lower bool
Include lowercase alphabet characters in the result. Default value is true.
MinLower int
Minimum number of lowercase alphabet characters in the result. Default value is 0.
MinNumeric int
Minimum number of numeric characters in the result. Default value is 0.
MinSpecial int
Minimum number of special characters in the result. Default value is 0.
MinUpper int
Minimum number of uppercase alphabet characters in the result. Default value is 0.
Number bool
Include numeric characters in the result. Default value is true. If number, upper, lower, and special are all configured, at least one of them must be set to true. NOTE: This is deprecated, use numeric instead.

Deprecated: NOTE: This is deprecated, use numeric instead.

Numeric bool
Include numeric characters in the result. Default value is true. If numeric, upper, lower, and special are all configured, at least one of them must be set to true.
OverrideSpecial 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.
Special bool
Include special characters in the result. These are !@#$%&*()-_=+[]{}<>:?. Default value is true.
Upper bool
Include uppercase alphabet characters in the result. Default value is true.
Length This property is required. 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).
Keepers map[string]string
Arbitrary map of values that, when changed, will trigger recreation of resource. See the main provider documentation for more information.
Lower bool
Include lowercase alphabet characters in the result. Default value is true.
MinLower int
Minimum number of lowercase alphabet characters in the result. Default value is 0.
MinNumeric int
Minimum number of numeric characters in the result. Default value is 0.
MinSpecial int
Minimum number of special characters in the result. Default value is 0.
MinUpper int
Minimum number of uppercase alphabet characters in the result. Default value is 0.
Number bool
Include numeric characters in the result. Default value is true. If number, upper, lower, and special are all configured, at least one of them must be set to true. NOTE: This is deprecated, use numeric instead.

Deprecated: NOTE: This is deprecated, use numeric instead.

Numeric bool
Include numeric characters in the result. Default value is true. If numeric, upper, lower, and special are all configured, at least one of them must be set to true.
OverrideSpecial 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.
Special bool
Include special characters in the result. These are !@#$%&*()-_=+[]{}<>:?. Default value is true.
Upper bool
Include uppercase alphabet characters in the result. Default value is true.
length This property is required. Integer
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).
keepers Map<String,String>
Arbitrary map of values that, when changed, will trigger recreation of resource. See the main provider documentation for more information.
lower Boolean
Include lowercase alphabet characters in the result. Default value is true.
minLower Integer
Minimum number of lowercase alphabet characters in the result. Default value is 0.
minNumeric Integer
Minimum number of numeric characters in the result. Default value is 0.
minSpecial Integer
Minimum number of special characters in the result. Default value is 0.
minUpper Integer
Minimum number of uppercase alphabet characters in the result. Default value is 0.
number Boolean
Include numeric characters in the result. Default value is true. If number, upper, lower, and special are all configured, at least one of them must be set to true. NOTE: This is deprecated, use numeric instead.

Deprecated: NOTE: This is deprecated, use numeric instead.

numeric Boolean
Include numeric characters in the result. Default value is true. If numeric, upper, lower, and special are all configured, at least one of them must be set to true.
overrideSpecial 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.
special Boolean
Include special characters in the result. These are !@#$%&*()-_=+[]{}<>:?. Default value is true.
upper Boolean
Include uppercase alphabet characters in the result. Default value is true.
length This property is required. number
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).
keepers {[key: string]: string}
Arbitrary map of values that, when changed, will trigger recreation of resource. See the main provider documentation for more information.
lower boolean
Include lowercase alphabet characters in the result. Default value is true.
minLower number
Minimum number of lowercase alphabet characters in the result. Default value is 0.
minNumeric number
Minimum number of numeric characters in the result. Default value is 0.
minSpecial number
Minimum number of special characters in the result. Default value is 0.
minUpper number
Minimum number of uppercase alphabet characters in the result. Default value is 0.
number boolean
Include numeric characters in the result. Default value is true. If number, upper, lower, and special are all configured, at least one of them must be set to true. NOTE: This is deprecated, use numeric instead.

Deprecated: NOTE: This is deprecated, use numeric instead.

numeric boolean
Include numeric characters in the result. Default value is true. If numeric, upper, lower, and special are all configured, at least one of them must be set to true.
overrideSpecial 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.
special boolean
Include special characters in the result. These are !@#$%&*()-_=+[]{}<>:?. Default value is true.
upper boolean
Include uppercase alphabet characters in the result. Default value is true.
length This property is required. 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).
keepers Mapping[str, str]
Arbitrary map of values that, when changed, will trigger recreation of resource. See the main provider documentation for more information.
lower bool
Include lowercase alphabet characters in the result. Default value is true.
min_lower int
Minimum number of lowercase alphabet characters in the result. Default value is 0.
min_numeric int
Minimum number of numeric characters in the result. Default value is 0.
min_special int
Minimum number of special characters in the result. Default value is 0.
min_upper int
Minimum number of uppercase alphabet characters in the result. Default value is 0.
number bool
Include numeric characters in the result. Default value is true. If number, upper, lower, and special are all configured, at least one of them must be set to true. NOTE: This is deprecated, use numeric instead.

Deprecated: NOTE: This is deprecated, use numeric instead.

numeric bool
Include numeric characters in the result. Default value is true. If numeric, upper, lower, and special are all configured, at least one of them must be set to true.
override_special str
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.
special bool
Include special characters in the result. These are !@#$%&*()-_=+[]{}<>:?. Default value is true.
upper bool
Include uppercase alphabet characters in the result. Default value is true.
length This property is required. Number
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).
keepers Map<String>
Arbitrary map of values that, when changed, will trigger recreation of resource. See the main provider documentation for more information.
lower Boolean
Include lowercase alphabet characters in the result. Default value is true.
minLower Number
Minimum number of lowercase alphabet characters in the result. Default value is 0.
minNumeric Number
Minimum number of numeric characters in the result. Default value is 0.
minSpecial Number
Minimum number of special characters in the result. Default value is 0.
minUpper Number
Minimum number of uppercase alphabet characters in the result. Default value is 0.
number Boolean
Include numeric characters in the result. Default value is true. If number, upper, lower, and special are all configured, at least one of them must be set to true. NOTE: This is deprecated, use numeric instead.

Deprecated: NOTE: This is deprecated, use numeric instead.

numeric Boolean
Include numeric characters in the result. Default value is true. If numeric, upper, lower, and special are all configured, at least one of them must be set to true.
overrideSpecial 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.
special Boolean
Include special characters in the result. These are !@#$%&*()-_=+[]{}<>:?. Default value is true.
upper Boolean
Include uppercase alphabet characters in the result. Default value is true.

Outputs

All input properties are implicitly available as output properties. Additionally, the RandomPassword resource produces the following output properties:

BcryptHash 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.
Id string
The provider-assigned unique ID for this managed resource.
Result string
The generated random string.
BcryptHash 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.
Id string
The provider-assigned unique ID for this managed resource.
Result string
The generated random string.
bcryptHash 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.
id String
The provider-assigned unique ID for this managed resource.
result String
The generated random string.
bcryptHash 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.
id string
The provider-assigned unique ID for this managed resource.
result string
The generated random string.
bcrypt_hash str
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.
id str
The provider-assigned unique ID for this managed resource.
result str
The generated random string.
bcryptHash 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.
id String
The provider-assigned unique ID for this managed resource.
result String
The generated random string.

Look up Existing RandomPassword Resource

Get an existing RandomPassword resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: RandomPasswordState, opts?: CustomResourceOptions): RandomPassword
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        bcrypt_hash: Optional[str] = None,
        keepers: Optional[Mapping[str, str]] = None,
        length: Optional[int] = None,
        lower: Optional[bool] = None,
        min_lower: Optional[int] = None,
        min_numeric: Optional[int] = None,
        min_special: Optional[int] = None,
        min_upper: Optional[int] = None,
        number: Optional[bool] = None,
        numeric: Optional[bool] = None,
        override_special: Optional[str] = None,
        result: Optional[str] = None,
        special: Optional[bool] = None,
        upper: Optional[bool] = None) -> RandomPassword
func GetRandomPassword(ctx *Context, name string, id IDInput, state *RandomPasswordState, opts ...ResourceOption) (*RandomPassword, error)
public static RandomPassword Get(string name, Input<string> id, RandomPasswordState? state, CustomResourceOptions? opts = null)
public static RandomPassword get(String name, Output<String> id, RandomPasswordState state, CustomResourceOptions options)
resources:  _:    type: random:RandomPassword    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
BcryptHash 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.
Keepers Dictionary<string, string>
Arbitrary map of values that, when changed, will trigger recreation of resource. See the main provider documentation for more information.
Length 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).
Lower bool
Include lowercase alphabet characters in the result. Default value is true.
MinLower int
Minimum number of lowercase alphabet characters in the result. Default value is 0.
MinNumeric int
Minimum number of numeric characters in the result. Default value is 0.
MinSpecial int
Minimum number of special characters in the result. Default value is 0.
MinUpper int
Minimum number of uppercase alphabet characters in the result. Default value is 0.
Number bool
Include numeric characters in the result. Default value is true. If number, upper, lower, and special are all configured, at least one of them must be set to true. NOTE: This is deprecated, use numeric instead.

Deprecated: NOTE: This is deprecated, use numeric instead.

Numeric bool
Include numeric characters in the result. Default value is true. If numeric, upper, lower, and special are all configured, at least one of them must be set to true.
OverrideSpecial 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.
Result string
The generated random string.
Special bool
Include special characters in the result. These are !@#$%&*()-_=+[]{}<>:?. Default value is true.
Upper bool
Include uppercase alphabet characters in the result. Default value is true.
BcryptHash 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.
Keepers map[string]string
Arbitrary map of values that, when changed, will trigger recreation of resource. See the main provider documentation for more information.
Length 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).
Lower bool
Include lowercase alphabet characters in the result. Default value is true.
MinLower int
Minimum number of lowercase alphabet characters in the result. Default value is 0.
MinNumeric int
Minimum number of numeric characters in the result. Default value is 0.
MinSpecial int
Minimum number of special characters in the result. Default value is 0.
MinUpper int
Minimum number of uppercase alphabet characters in the result. Default value is 0.
Number bool
Include numeric characters in the result. Default value is true. If number, upper, lower, and special are all configured, at least one of them must be set to true. NOTE: This is deprecated, use numeric instead.

Deprecated: NOTE: This is deprecated, use numeric instead.

Numeric bool
Include numeric characters in the result. Default value is true. If numeric, upper, lower, and special are all configured, at least one of them must be set to true.
OverrideSpecial 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.
Result string
The generated random string.
Special bool
Include special characters in the result. These are !@#$%&*()-_=+[]{}<>:?. Default value is true.
Upper bool
Include uppercase alphabet characters in the result. Default value is true.
bcryptHash 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.
keepers Map<String,String>
Arbitrary map of values that, when changed, will trigger recreation of resource. See the main provider documentation for more information.
length Integer
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).
lower Boolean
Include lowercase alphabet characters in the result. Default value is true.
minLower Integer
Minimum number of lowercase alphabet characters in the result. Default value is 0.
minNumeric Integer
Minimum number of numeric characters in the result. Default value is 0.
minSpecial Integer
Minimum number of special characters in the result. Default value is 0.
minUpper Integer
Minimum number of uppercase alphabet characters in the result. Default value is 0.
number Boolean
Include numeric characters in the result. Default value is true. If number, upper, lower, and special are all configured, at least one of them must be set to true. NOTE: This is deprecated, use numeric instead.

Deprecated: NOTE: This is deprecated, use numeric instead.

numeric Boolean
Include numeric characters in the result. Default value is true. If numeric, upper, lower, and special are all configured, at least one of them must be set to true.
overrideSpecial 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.
result String
The generated random string.
special Boolean
Include special characters in the result. These are !@#$%&*()-_=+[]{}<>:?. Default value is true.
upper Boolean
Include uppercase alphabet characters in the result. Default value is true.
bcryptHash 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.
keepers {[key: string]: string}
Arbitrary map of values that, when changed, will trigger recreation of resource. See the main provider documentation for more information.
length number
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).
lower boolean
Include lowercase alphabet characters in the result. Default value is true.
minLower number
Minimum number of lowercase alphabet characters in the result. Default value is 0.
minNumeric number
Minimum number of numeric characters in the result. Default value is 0.
minSpecial number
Minimum number of special characters in the result. Default value is 0.
minUpper number
Minimum number of uppercase alphabet characters in the result. Default value is 0.
number boolean
Include numeric characters in the result. Default value is true. If number, upper, lower, and special are all configured, at least one of them must be set to true. NOTE: This is deprecated, use numeric instead.

Deprecated: NOTE: This is deprecated, use numeric instead.

numeric boolean
Include numeric characters in the result. Default value is true. If numeric, upper, lower, and special are all configured, at least one of them must be set to true.
overrideSpecial 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.
result string
The generated random string.
special boolean
Include special characters in the result. These are !@#$%&*()-_=+[]{}<>:?. Default value is true.
upper boolean
Include uppercase alphabet characters in the result. Default value is true.
bcrypt_hash str
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.
keepers Mapping[str, str]
Arbitrary map of values that, when changed, will trigger recreation of resource. See the main provider documentation for more information.
length 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).
lower bool
Include lowercase alphabet characters in the result. Default value is true.
min_lower int
Minimum number of lowercase alphabet characters in the result. Default value is 0.
min_numeric int
Minimum number of numeric characters in the result. Default value is 0.
min_special int
Minimum number of special characters in the result. Default value is 0.
min_upper int
Minimum number of uppercase alphabet characters in the result. Default value is 0.
number bool
Include numeric characters in the result. Default value is true. If number, upper, lower, and special are all configured, at least one of them must be set to true. NOTE: This is deprecated, use numeric instead.

Deprecated: NOTE: This is deprecated, use numeric instead.

numeric bool
Include numeric characters in the result. Default value is true. If numeric, upper, lower, and special are all configured, at least one of them must be set to true.
override_special str
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.
result str
The generated random string.
special bool
Include special characters in the result. These are !@#$%&*()-_=+[]{}<>:?. Default value is true.
upper bool
Include uppercase alphabet characters in the result. Default value is true.
bcryptHash 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.
keepers Map<String>
Arbitrary map of values that, when changed, will trigger recreation of resource. See the main provider documentation for more information.
length Number
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).
lower Boolean
Include lowercase alphabet characters in the result. Default value is true.
minLower Number
Minimum number of lowercase alphabet characters in the result. Default value is 0.
minNumeric Number
Minimum number of numeric characters in the result. Default value is 0.
minSpecial Number
Minimum number of special characters in the result. Default value is 0.
minUpper Number
Minimum number of uppercase alphabet characters in the result. Default value is 0.
number Boolean
Include numeric characters in the result. Default value is true. If number, upper, lower, and special are all configured, at least one of them must be set to true. NOTE: This is deprecated, use numeric instead.

Deprecated: NOTE: This is deprecated, use numeric instead.

numeric Boolean
Include numeric characters in the result. Default value is true. If numeric, upper, lower, and special are all configured, at least one of them must be set to true.
overrideSpecial 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.
result String
The generated random string.
special Boolean
Include special characters in the result. These are !@#$%&*()-_=+[]{}<>:?. Default value is true.
upper Boolean
Include uppercase alphabet characters in the result. Default value is true.

Import

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

$ import random:index/randomPassword:RandomPassword newPassword supersecret
<break>```

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`.


To learn more about importing existing cloud resources, see [Importing resources](/docs/using-pulumi/adopting-pulumi/import/).




<h2 id="package-details">Package Details</h2>
<dl class="package-details">
	<dt>Repository</dt>
	<dd><a href="https://github.com/pulumi/pulumi-random">random pulumi/pulumi-random</a></dd>
	<dt>License</dt>
	<dd>Apache-2.0</dd>
	<dt>Notes</dt>
	<dd>This Pulumi package is based on the <a href="https://github.com/terraform-providers/terraform-provider-random"><code>random</code> Terraform Provider</a>.</dd>
</dl>