From 61613682621ec3fab28277c10246bba729051881 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Thu, 27 Jun 2024 13:39:28 -0400 Subject: [PATCH] docs/resources/instance: add multiple ordered `execs` Fixes #486 Signed-off-by: Simon Deziel --- docs/resources/instance.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/docs/resources/instance.md b/docs/resources/instance.md index bf6f1e9c..e8859174 100644 --- a/docs/resources/instance.md +++ b/docs/resources/instance.md @@ -238,8 +238,8 @@ resource "lxd_instance" "instance1" { ## Executing Commands in Instances The `execs` map defines commands to be executed within an instance. Each element in the map -represents an exec command, uniquely identified by its map key. The commands are executed in -an order determined alphabetically by their map keys. +represents an exec command, uniquely identified by its map key. **The commands +are executed in alphabetical order of their map keys.** ### Commands and Environment Access @@ -252,9 +252,19 @@ resource "lxd_instance" "inst" { image = "ubuntu-daily:22.04" execs = { - "simple_cmd" = { + "00-run-first" = { + # wait for boot to complete + command = ["systemctl", "is-system-running", "--wait", "--quiet"] + trigger = "on_start" + } + "simple-cmd" = { command = ["ls", "/"] } + "zz-run-last" = { + # show how long it took to boot + command = ["systemd-analyze", "--no-pager"] + trigger = "on_start" + } } } ```