Skip to content

UUID

The random_uuid resource allows the creation of random UUIDs.

resource "random_uuid" "name" {
...
}

These attributes are computed when the config is parsed and applied, and are
therefore only known at parsetime or runtime.

AttributeDescription

Meta ID meta.id

string

The full ID of the resource e.g. resource.type.name.
This is computed from the full resource path:

// given the following resource
resource “container” “ubuntu” {
}

// the resulting id will be resource.container.ubuntu | |

Meta Type meta.type

string

|

The type of the resource.
This taken from the type label of the resource definition.

// given the following resource
resource “container” “ubuntu” {
…
}

// the resulting type will be container

| |

Meta Name meta.name

string

|

The name of the resource.
This taken from the name label of the resource definition.

// given the following resource
resource “container” “ubuntu” {
…
}

// the resulting name will be ubuntu

| |

Value value

type: string

| The generated random UUID. |

resource "random_uuid" "uuid" {}
output "uuid" {
value = resource.random_uuid.uuid.value
}