conn3x apply
conn3x apply makes the changes a plan proposes. Without a plan file, it plans first, shows the plan, and asks you to confirm. With a plan file from conn3x plan -out, it applies that plan without asking.
conn3x apply [options] [PLAN]What Conn3x changes
Section titled “What Conn3x changes”Host steps are applied over SSH, alongside cloud resources, in one run:
- Within a circuit, steps run in the order you write them. A circuit whose
hostsrefers to a resource, such as a server’s address, waits for that resource. - A handler runs after the steps that notify it, and only on the hosts where one of them changed something.
- The first time Conn3x writes write-only content without
CONN3X_HMAC_KEYset, it creates~/.config/conn3x/hmac.key.
If a step fails on one host, apply reports the error and exits 1. State keeps everything that finished, so the next plan picks up where it stopped.
Planning works as described on the plan page, including reading the hosts first.
Sample output
Section titled “Sample output”$ conn3x apply...Plan: 3 to add, 0 to change, 0 to destroy.
Do you want to perform these actions? Conn3x will perform the actions described above. Only 'yes' will be accepted to approve.
Enter a value: yes
...Apply complete! Resources: 3 added, 0 changed, 0 destroyed.Options
Section titled “Options”| Option | Description |
|---|---|
-auto-approve |
Don’t ask for confirmation. Applying a plan file never asks. |
-input=false |
Don’t prompt for variables. With no plan file, also use -auto-approve. |
-parallelism=N |
How many resource operations run at once, host steps included. Defaults to 10. |
-lock=false |
Don’t lock state. |
-lock-timeout=DURATION |
How long to retry a state lock, such as 30s. |
-json |
Write machine-readable output as JSON lines. Needs -auto-approve or a plan file. |
-no-color |
Don’t use terminal colors. |
-compact-warnings |
Show warnings as summaries only, when there are no errors. |
-concise |
Leave out progress messages. |
-show-sensitive |
Show sensitive values. |
Without a plan file, apply also takes the planning options from plan: -var, -var-file, -target, -exclude, -replace, -refresh=false, -refresh-only and -destroy. With a plan file, those were fixed when the plan was made.
For the remaining options, see OpenTofu’s apply page.
Examples
Section titled “Examples”Plan and apply in one step, confirming at the prompt:
conn3x applyApply a saved plan:
conn3x plan -out=tfplanconn3x apply tfplanIf state changed between the two commands, apply refuses the plan as stale. Plan again.
Apply in CI without prompts:
conn3x apply -auto-approve -input=falseAccept what changed outside Conn3x into state, without changing any host:
conn3x apply -refresh-onlyExit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
| 0 | Applied, or nothing to do. |
| 1 | An error, or you didn’t confirm. |