random_bytes (Resource)

The resource random_bytes generates random bytes that are intended to be used as a secret, or key. Use this in preference to random_id 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

# DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug
from constructs import Construct
from cdktf import TerraformStack
#
# Provider bindings are generated by running `cdktf get`.
# See https://cdk.tf/provider-generation for more details.
#
from imports.azurerm.key_vault_secret import KeyVaultSecret
from imports.random.bytes import Bytes
class MyConvertedCode(TerraformStack):
    def __init__(self, scope, name):
        super().__init__(scope, name)
        # The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
        #     For a more precise conversion please use the --provider flag in convert.
        jwt_secret = Bytes(self, "jwt_secret",
            length=64
        )
        azurerm_key_vault_secret_jwt_secret = KeyVaultSecret(self, "jwt_secret_1",
            key_vault_id="some-azure-key-vault-id",
            name="JwtSecret",
            value=jwt_secret.base64
        )
        # This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.
        azurerm_key_vault_secret_jwt_secret.override_logical_id("jwt_secret")

Schema

Required

Optional

Read-Only

Import

Import is supported using the following syntax:

# Random bytes can be imported by specifying the value as base64 string.
terraform import random_bytes.basic "8/fu3q+2DcgSJ19i0jZ5Cw=="