Random ID random_id
The random_id
resource allows the creation of random IDs.
Properties
- Name
byte_length
- Type
- (int: )
- Required
- required
- Readonly
- Description
The number of random bytes to produce. The minimum value is 1, which produces eight bits of randomness.
- Name
base64
- Type
- (string: "")
- Required
- Readonly
- readonly
- Description
The generated ID presented in base64.
- Name
hex
- Type
- (string: "")
- Required
- Readonly
- readonly
- Description
The generated ID presented in padded hexadecimal digits. This result will always be twice as long as the requested byte length.
- Name
dec
- Type
- (string: "")
- Required
- Readonly
- readonly
- Description
The generated ID presented in non-padded decimal digits.
Meta Properties
In addition to the main properties, all resources have meta
properties, such
as the id
of the resource. To see the list of these properties please see the
Meta Properties
section in the documentation /docs/resources/meta.
Examples
resource "random_id" "id" {
byte_length = 4
}
output "id_base64" {
value = resource.random_id.meta.id.base64
}
output "id_hex" {
value = resource.random_id.meta.id.hex
}
output "id_dec" {
value = resource.random_id.meta.id.dec
}