JournalEventListener
Index
Constructors
Methods
Constructors
constructor
Names this command to every process it starts.
Returns JournalEventListener
Methods
onEvent
Records every event but registrations and serializations, adds the journal to every state save, and writes it at the end of a command, or a mode outside one, and before the lock is released.
Parameters
event: Event<unknown>
Returns Promise<void>
Writes the journal: every event of this command, in the order it happened, into Octo's state.
A command is one process, named after the CLI command it runs, or the mode where no command runs it. Its events go to
journal.<commandId>.<command>.json, and what terraform and terragrunt wrote to a temporary file, each chunk as it arrives, a copy of which each save moves tojournal.<commandId>.<command>.terraform.json. A copy of every model and resource state file written is kept asjournal.<commandId>.<command>.<md5>.json, so each version a command wrote survives the next command overwriting it. Ids start with the time they were made, so files sort in the order their commands started.The listener only creates files: the state provider archives them when the lock is released. A command that runs under a lock, run when none is held, writes nothing, because its files would belong to no lock. They are written with every other state file written, at the end of a command, and before the lock is released, after which nothing more is recorded. It never fails a command: a write that fails is reported on stderr. The one write that fails loudly is the one before the release, which keeps the lock held.
The terraform log is written as each chunk arrives into a temporary file the state provider names, and holds nothing in memory. That file is valid JSON after every chunk. Each state save takes a copy of it and hands the state provider that copy's path to move into the state, so an apply's output reaches the state provider at every terraform state check-in without ever being read into memory. The temporary file is deleted when the command ends.
A command that another one started, such as a
run-actionterraform starts mid-apply, names that command asparentCommandId.Event Listeners