@pulumi/random
Version:
A Pulumi package to safely use randomness in Pulumi programs.
111 lines (110 loc) • 4.33 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
/**
* The resource `random.RandomBytes` generates random bytes that are intended to be used as a secret, or key. Use this in preference to `random.RandomId` when the output is considered sensitive, and should not be displayed in the CLI.
*
* This resource *does* use a cryptographic random number generator.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azurerm from "@pulumi/azurerm";
* import * as random from "@pulumi/random";
*
* const jwtSecret = new random.RandomBytes("jwt_secret", {length: 64});
* const jwtSecretKeyVaultSecret = new azurerm.index.KeyVaultSecret("jwt_secret", {
* keyVaultId: "some-azure-key-vault-id",
* name: "JwtSecret",
* value: jwtSecret.base64,
* });
* ```
*
* ## Import
*
* Random bytes can be imported by specifying the value as base64 string.
*
* ```sh
* $ pulumi import random:index/randomBytes:RandomBytes basic "8/fu3q+2DcgSJ19i0jZ5Cw=="
* ```
*/
export declare class RandomBytes extends pulumi.CustomResource {
/**
* Get an existing RandomBytes 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?: RandomBytesState, opts?: pulumi.CustomResourceOptions): RandomBytes;
/**
* Returns true if the given object is an instance of RandomBytes. 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 RandomBytes;
/**
* The generated bytes presented in base64 string format.
*/
readonly base64: pulumi.Output<string>;
/**
* The generated bytes presented in lowercase hexadecimal string format. The length of the encoded string is exactly twice the `length` parameter.
*/
readonly hex: 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 number of bytes requested. The minimum value for length is 1.
*/
readonly length: pulumi.Output<number>;
/**
* Create a RandomBytes 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: RandomBytesArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering RandomBytes resources.
*/
export interface RandomBytesState {
/**
* The generated bytes presented in base64 string format.
*/
base64?: pulumi.Input<string>;
/**
* The generated bytes presented in lowercase hexadecimal string format. The length of the encoded string is exactly twice the `length` parameter.
*/
hex?: 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 number of bytes requested. The minimum value for length is 1.
*/
length?: pulumi.Input<number>;
}
/**
* The set of arguments for constructing a RandomBytes resource.
*/
export interface RandomBytesArgs {
/**
* 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 number of bytes requested. The minimum value for length is 1.
*/
length: pulumi.Input<number>;
}