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, without its terraform log, to every state save, and writes it, with the log, at the end of a command, or a mode outside one, and before the lock is released.
Parameters
event: Event<unknown>
Returns Promise<void>
staticfileNameOf
The name of a command's journal,
journal.<commandId>.<command>.json, or of its terraform log,journal.<commandId>.<command>.terraform.json.Parameters
header: Pick<JournalHeader, command | commandId>
file: journal | terraform log
Returns string
staticreadJournalFileName
The command whose journal the file named
fileNameis, orundefinedfor any other file: a terraform log, a state file copy, a file the journal did not write.Parameters
fileName: string
Returns Pick<JournalHeader, command | commandId> | undefined
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 the command's last write 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. Only the command's last write, at its end or the unlock, takes a copy of it and hands the state provider that copy's path to move into the state, so the output is never read into memory, nor sent with every state save. 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