Random Bytes Args
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());
}
}
Content copied to clipboard
Import
Random bytes can be imported by specifying the value as base64 string.
$ pulumi import random:index/randomBytes:RandomBytes basic "8/fu3q+2DcgSJ19i0jZ5Cw=="
Content copied to clipboard