UNPKG

@pulumi/random

Version:

A Pulumi package to safely use randomness in Pulumi programs.

235 lines (234 loc) • 10.2 kB
import * as pulumi from "@pulumi/pulumi"; /** * ## Example Usage * * ```typescript * 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, * }); * ``` * * ## Import * * You can import external passwords into your Pulumi programs as follows: */ export declare class RandomPassword extends pulumi.CustomResource { /** * Get an existing RandomPassword resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input<pulumi.ID>, state?: RandomPasswordState, opts?: pulumi.CustomResourceOptions): RandomPassword; /** * Returns true if the given object is an instance of RandomPassword. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is RandomPassword; /** * A bcrypt hash of the generated random string. **NOTE**: If the generated random string is greater than 72 bytes in length, `bcryptHash` will contain a hash of the first 72 bytes. */ readonly bcryptHash: pulumi.Output<string>; /** * Arbitrary map of values that, when changed, will trigger recreation of resource. See the main provider documentation for more information. */ readonly keepers: pulumi.Output<{ [key: string]: string; } | undefined>; /** * The length of the string desired. The minimum value for length is 1 and, length must also be >= (`minUpper` + `minLower` + `minNumeric` + `minSpecial`). */ readonly length: pulumi.Output<number>; /** * Include lowercase alphabet characters in the result. Default value is `true`. */ readonly lower: pulumi.Output<boolean>; /** * Minimum number of lowercase alphabet characters in the result. Default value is `0`. */ readonly minLower: pulumi.Output<number>; /** * Minimum number of numeric characters in the result. Default value is `0`. */ readonly minNumeric: pulumi.Output<number>; /** * Minimum number of special characters in the result. Default value is `0`. */ readonly minSpecial: pulumi.Output<number>; /** * Minimum number of uppercase alphabet characters in the result. Default value is `0`. */ readonly minUpper: pulumi.Output<number>; /** * 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. */ readonly number: pulumi.Output<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`. */ readonly numeric: pulumi.Output<boolean>; /** * 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. */ readonly overrideSpecial: pulumi.Output<string | undefined>; /** * The generated random string. */ readonly result: pulumi.Output<string>; /** * Include special characters in the result. These are `!@#$%&*()-_=+[]{}<>:?`. Default value is `true`. */ readonly special: pulumi.Output<boolean>; /** * Include uppercase alphabet characters in the result. Default value is `true`. */ readonly upper: pulumi.Output<boolean>; /** * Create a RandomPassword resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: RandomPasswordArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering RandomPassword resources. */ export interface RandomPasswordState { /** * A bcrypt hash of the generated random string. **NOTE**: If the generated random string is greater than 72 bytes in length, `bcryptHash` will contain a hash of the first 72 bytes. */ bcryptHash?: pulumi.Input<string>; /** * Arbitrary map of values that, when changed, will trigger recreation of resource. See the main provider documentation for more information. */ keepers?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * The length of the string desired. The minimum value for length is 1 and, length must also be >= (`minUpper` + `minLower` + `minNumeric` + `minSpecial`). */ length?: pulumi.Input<number>; /** * Include lowercase alphabet characters in the result. Default value is `true`. */ lower?: pulumi.Input<boolean>; /** * Minimum number of lowercase alphabet characters in the result. Default value is `0`. */ minLower?: pulumi.Input<number>; /** * Minimum number of numeric characters in the result. Default value is `0`. */ minNumeric?: pulumi.Input<number>; /** * Minimum number of special characters in the result. Default value is `0`. */ minSpecial?: pulumi.Input<number>; /** * Minimum number of uppercase alphabet characters in the result. Default value is `0`. */ minUpper?: pulumi.Input<number>; /** * 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. */ number?: pulumi.Input<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`. */ numeric?: pulumi.Input<boolean>; /** * 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. */ overrideSpecial?: pulumi.Input<string>; /** * The generated random string. */ result?: pulumi.Input<string>; /** * Include special characters in the result. These are `!@#$%&*()-_=+[]{}<>:?`. Default value is `true`. */ special?: pulumi.Input<boolean>; /** * Include uppercase alphabet characters in the result. Default value is `true`. */ upper?: pulumi.Input<boolean>; } /** * The set of arguments for constructing a RandomPassword resource. */ export interface RandomPasswordArgs { /** * Arbitrary map of values that, when changed, will trigger recreation of resource. See the main provider documentation for more information. */ keepers?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * The length of the string desired. The minimum value for length is 1 and, length must also be >= (`minUpper` + `minLower` + `minNumeric` + `minSpecial`). */ length: pulumi.Input<number>; /** * Include lowercase alphabet characters in the result. Default value is `true`. */ lower?: pulumi.Input<boolean>; /** * Minimum number of lowercase alphabet characters in the result. Default value is `0`. */ minLower?: pulumi.Input<number>; /** * Minimum number of numeric characters in the result. Default value is `0`. */ minNumeric?: pulumi.Input<number>; /** * Minimum number of special characters in the result. Default value is `0`. */ minSpecial?: pulumi.Input<number>; /** * Minimum number of uppercase alphabet characters in the result. Default value is `0`. */ minUpper?: pulumi.Input<number>; /** * 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. */ number?: pulumi.Input<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`. */ numeric?: pulumi.Input<boolean>; /** * 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. */ overrideSpecial?: pulumi.Input<string>; /** * Include special characters in the result. These are `!@#$%&*()-_=+[]{}<>:?`. Default value is `true`. */ special?: pulumi.Input<boolean>; /** * Include uppercase alphabet characters in the result. Default value is `true`. */ upper?: pulumi.Input<boolean>; }