RandomBytesArgs

data class RandomBytesArgs(val keepers: Output<Map<String, String>>? = null, val length: Output<Int>? = null) : ConvertibleToJava<RandomBytesArgs>

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.

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.random.RandomBytes;
import com.pulumi.random.RandomBytesArgs;
import com.pulumi.azure.keyvault.Secret;
import com.pulumi.azure.keyvault.SecretArgs;
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 jwtSecretRandomBytes = new RandomBytes("jwtSecretRandomBytes", RandomBytesArgs.builder()
.length(64)
.build());
var jwtSecretSecret = new Secret("jwtSecretSecret", SecretArgs.builder()
.keyVaultId("some-azure-key-vault-id")
.value(jwtSecretRandomBytes.base64())
.build());
}
}

Import

Random bytes can be imported by specifying the value as base64 string.

$ pulumi import random:index/randomBytes:RandomBytes basic "8/fu3q+2DcgSJ19i0jZ5Cw=="

Constructors

Link copied to clipboard
fun RandomBytesArgs(keepers: Output<Map<String, String>>? = null, length: Output<Int>? = null)

Functions

Link copied to clipboard
open override fun toJava(): RandomBytesArgs

Properties

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

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>? = null

The number of bytes requested. The minimum value for length is 1.