Skip to content

Commit 1cd9158

Browse files
committed
chore: update demo and docs
1 parent 134e53e commit 1cd9158

24 files changed

+114
-134
lines changed

Diff for: Makefile

+4
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,7 @@ install-infracost:
6060
curl -L https://github.com/infracost/infracost/releases/download/v0.10.38/infracost-linux-amd64.tar.gz | tar -zxf -
6161
mv infracost-linux-amd64 ~/.local/bin/infracost
6262
chmod +x ~/.local/bin/infracost
63+
64+
.PHONY: demo
65+
demo:
66+
vhs demo/vhs.tape

Diff for: README.md

+43-65
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ FLAGS
6464
--data-dir STRING Directory in which to store plan files. (default: /home/louis/.pug)
6565
-e, --env STRING Environment variable to pass to terraform process. Can set more than once.
6666
-a, --arg STRING CLI arg to pass to terraform process. Can set more than once.
67-
-f, --first-page STRING The first page to open on startup. (default: modules)
6867
-d, --debug Log bubbletea messages to messages.log
6968
-v, --version Print version.
7069
-c, --config STRING Path to config file. (default: /home/louis/.pug.yaml)
@@ -84,55 +83,39 @@ max-tasks: 100
8483
8584
Pug automatically loads variables from a .tfvars file. It looks for a file named `<workspace>.tfvars` in the module directory, where `<workspace>` is the name of the workspace. For example, if the workspace is named `dev` then it'll look for `dev.tfvars`. If the file exists then it'll pass the name to `terraform plan`, e.g. for a workspace named `dev`, it'll invoke `terraform plan -vars-file=dev.tfvars`.
8685

87-
## Pages
86+
## Panes
8887

89-
### Modules
88+
### Explorer
9089

91-
![Modules screenshot](./demo/modules.png)
92-
93-
Press `m` to go to the modules page.
94-
95-
*Note: what Pug calls a module is equivalent to a [root module](https://developer.hashicorp.com/terraform/language/modules#the-root-module), i.e. a directory containing terraform configuration, including a state backend. It is not to be confused with a [child module](https://developer.hashicorp.com/terraform/language/modules#child-modules).*
96-
97-
#### Key bindings
98-
99-
| Key | Description | Multi-select |
100-
|--|--|--|
101-
|`i`|Run `terraform init`|&check;|
102-
|`u`|Run `terraform init -upgrade`|&check;|
103-
|`f`|Run `terraform fmt`|&check;|
104-
|`v`|Run `terraform validate`|&check;|
105-
|`p`|Run `terraform plan`|&check;|
106-
|`P`|Run `terraform plan -destroy`|&check;|
107-
|`a`|Run `terraform apply`|&check;|
108-
|`d`|Run `terraform apply -destroy`|&check;|
109-
|`e`|Open module in editor|&cross;|
110-
|`x`|Run any program|&check;|
111-
|`Ctrl+r`|Reload all modules|-|
112-
|`Ctrl+w`|Reload module's workspaces|&check;|
113-
114-
### Workspaces
90+
The explorer pane a tree of [modules](#module) and [workspaces](#workspace) discovered on your filesystem. From here, terraform commands can be carried out on both modules and workspaces.
11591

116-
![Workspaces screenshot](./demo/workspaces.png)
92+
You can select multiple modules or workspaces; you cannot select a combination of the two. Any terraform commands are then carried out on the selection.
11793

118-
Press `w` to go to the workspaces page.
119-
120-
*Note: A workspace is directly equivalent to a [terraform workspace](https://developer.hashicorp.com/terraform/language/state/workspaces).*
94+
The number of resources in the state is shown alongside the workspace.
12195

96+
![Modules screenshot](./demo/modules.png)
97+
12298
#### Key bindings
12399

124-
| Key | Description | Multi-select |
125-
|--|--|--|
126-
|`i`|Run `terraform init`|&check;|
127-
|`u`|Run `terraform init -upgrade`|&check;|
128-
|`f`|Run `terraform fmt`|&check;|
129-
|`v`|Run `terraform validate`|&check;|
130-
|`p`|Run `terraform plan`|&check;|
131-
|`P`|Run `terraform plan -destroy`|&check;|
132-
|`a`|Run `terraform apply`|&check;|
133-
|`d`|Run `terraform apply -destroy`|&check;|
134-
|`C`|Run `terraform workspace select`|&cross;|
135-
|`$`|Run `infracost breakdown`|&check;|
100+
| Key | Description | Multi-select | Module | Workspace |
101+
|--|--|--|--|--|
102+
|`i`|Run `terraform init`|&check;|&check;|&check;\*\*|
103+
|`u`|Run `terraform init -upgrade`|&check;|&check;\*\*|
104+
|`f`|Run `terraform fmt`|&check;|&check;|&check;\*\*|
105+
|`v`|Run `terraform validate`|&check;|&check;|&check\*\*;|
106+
|`p`|Run `terraform plan`|&check;|&check;\*|&check;|
107+
|`P`|Run `terraform plan -destroy`|&check;\*|&check;|&check;|
108+
|`a`|Run `terraform apply`|&check;|&check;\*|&check;|
109+
|`d`|Run `terraform apply -destroy`|&check;\*|&check;|&check;|
110+
|`C`|Run `terraform workspace select`|&cross;|&cross;|&check;|
111+
|`$`|Run `infracost breakdown`|&check;|&check\*;|&check;|
112+
|`E`|Open module in editor|&cross;|&check;|&check;\*\*|
113+
|`x`|Run any program|&check;|&check;|&check;\*\*|
114+
|`Ctrl+r`|Reload all modules|-|&check;|&check;|
115+
|`Ctrl+w`|Reload module's workspaces|&check;|&check;|&check;\*\*|
116+
117+
\* Operate on module's current workspace.
118+
\*\* Operate on workspace's parent module.
136119

137120
### State
138121

@@ -149,14 +132,10 @@ Press `s` to go to the state page, listing a workspace's resources.
149132
|`a`|Run `terraform apply -target`|&check;|
150133
|`d`|Run `terraform apply -destroy -target`|&check;|
151134
|`D`|Run `terraform state rm`|&check;|
152-
|`M`|Run `terraform state mv`|&cross;|
135+
|`m`|Run `terraform state mv`|&cross;|
153136
|`Ctrl+t`|Run `terraform taint`|&check;|
154137
|`U`|Run `terraform untaint`|&check;|
155138
|`Ctrl+r`|Run `terraform state pull`|-|
156-
|`S`|Toggle split screen|-|
157-
|`+`|Increase split screen top pane|-|
158-
|`-`|Decrease split screen top pane|-|
159-
|`tab`|Switch split screen pane focus|-|
160139

161140
### Tasks
162141

@@ -170,11 +149,6 @@ Press `t` to go to the tasks page.
170149
|--|--|--|
171150
|`c`|Cancel task|&check;|
172151
|`r`|Retry task|&check;|
173-
|`Enter`|Full screen task output|&cross;|
174-
|`S`|Toggle split screen|-|
175-
|`+`|Increase split screen top pane|-|
176-
|`-`|Decrease split screen top pane|-|
177-
|`tab`|Switch split screen pane focus|-|
178152
|`I`|Toggle task info sidebar|-|
179153

180154
### Task Group
@@ -189,11 +163,6 @@ Creating multiple tasks, via a selection, creates a task group, and takes you to
189163
|--|--|--|
190164
|`c`|Cancel task|&check;|
191165
|`r`|Retry task|&check;|
192-
|`Enter`|Full screen task output|&cross;|
193-
|`S`|Toggle split screen|-|
194-
|`+`|Increase split screen top pane|-|
195-
|`-`|Decrease split screen top pane|-|
196-
|`tab`|Switch split screen pane focus|-|
197166
|`I`|Toggle task info sidebar|-|
198167

199168
### Task Groups Listing
@@ -218,16 +187,25 @@ These keys are valid on any page.
218187
|--|--|
219188
|`?`|Open help pane|
220189
|`Ctrl+c`|Quit|
221-
|`Esc`|Go to previous page|
222-
|`m`|Go to modules page|
223-
|`w`|Go to workspaces page|
224-
|`s`|Go to state page\*|
225-
|`t`|Go to tasks page|
226-
|`T`|Go to task groups page|
190+
|`Esc`|Go to previous page\*\*|
191+
|`0`|Focus left pane (explorer)|
192+
|`1`|Focus top right pane|
193+
|`2`|Focus bottom right pane|
194+
|`e`|Go to explorer|
195+
|`s`|Go to state \*|
196+
|`t`|Go to tasks|
197+
|`T`|Go to task groups|
227198
|`l`|Go to logs|
199+
|`X`|Close pane|
200+
|`+`|Increase pane height|-|
201+
|`-`|Decrease pane height|-|
202+
|`<`|Increase pane width|-|
203+
|`>`|Decrease pane width|-|
204+
|`tab`|Switch split screen pane focus|-|
228205
|`Ctrl+s`|Toggle auto-scrolling of terraform output|
229206

230207
\* Only where the workspace can be ascertained.
208+
\*\* Only history for the top right pane is maintained.
231209

232210
### Selections
233211

@@ -254,7 +232,7 @@ Items can be filtered to those containing a sub-string.
254232

255233
### Navigation
256234

257-
Common vim key bindings are supported for navigation.
235+
Common vim key bindings are supported for navigating task output.
258236

259237
| Key | Description |
260238
|--|--|

Diff for: demo/asdf_install_terraform_task_group.png

5.75 KB
Loading

Diff for: demo/demo.gif

177 KB
Loading

Diff for: demo/execute_asdf_install_terraform.png

-14.7 KB
Loading

Diff for: demo/filter.png

441 KB
Loading

Diff for: demo/infracost_output.png

-31.3 KB
Loading

Diff for: demo/logs.png

-763 KB
Loading

Diff for: demo/modules.png

280 KB
Loading

Diff for: demo/state.png

44.6 KB
Loading

Diff for: demo/task_group.png

91.5 KB
Loading

Diff for: demo/task_groups.png

25.1 KB
Loading

Diff for: demo/tasks.png

-11.2 KB
Loading

Diff for: demo/vhs.tape

+46-36
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,47 @@
11
Output demo/demo.gif
22

3+
Require terraform
4+
Require infracost
5+
Require asdf
6+
37
Set Shell "bash"
48
Set FontSize 14
59
Set Width 1200
610
Set Height 800
711
Set Framerate 24
812
Set Padding 5
13+
Set FontFamily "JetBrainsMono Nerd Font"
914

15+
# Clear any leftover artefacts from last demo
1016
Hide
11-
Type `TF_CLI_CONFIG_FILE=$PWD/mirror/mirror.tfrc go run main.go -w demo/dont_cost_money` Enter
17+
Type@1ms "asdf uninstall terraform" Enter
18+
Type@1ms "find demo/ -name .terraform -exec rm -rf {} \; > /dev/null 2>&1 || true" Enter
19+
Type@1ms "find demo/ -name terraform.tfstate -exec rm {} \; > /dev/null 2>&1 || true" Enter
20+
Type@1ms "find demo/ -name terraform.tfstate.* -exec rm {} \; > /dev/null 2>&1 || true" Enter
21+
Type@1ms "find demo/ -name .terraform.lock.hcl -exec rm {} \; > /dev/null 2>&1 || true" Enter
22+
Type@1ms "find demo/ -name environment -exec rm {} \; > /dev/null 2>&1 || true" Enter
23+
Show
24+
25+
Hide
26+
Type@1ms `TF_CLI_CONFIG_FILE=$PWD/mirror/mirror.tfrc go run main.go -w demo/dont_cost_money` Enter
1227
Sleep 1s
1328
Show
1429

15-
# show unintialized modules
30+
# show explorer tree
1631
Sleep 1s
1732

1833
# init all modules
1934
Ctrl+a Sleep 0.5s Type "i"
20-
# we're taken to the init task group page
35+
# show init task group
2136
Sleep 0.5s
2237
# preview output for several tasks
2338
Down Sleep 0.5s Down Sleep 0.5s Down Sleep 0.5s
2439

25-
# go back to modules
26-
Type "m"
40+
# go back to explorer
41+
Type "0"
2742
# validate all modules
2843
Type "v"
29-
# we're taken to the validate task group page
44+
# show validate task group
3045
Sleep 0.5s
3146
# enable task info side panel
3247
Type "I" Sleep 0.5s
@@ -37,13 +52,13 @@ Down Sleep 0.5s Down Sleep 0.5s Down Sleep 0.5s
3752
# disable task info side panel
3853
Type "I" Sleep 0.5s
3954

40-
# go back to modules
41-
Type "m" Sleep 0.5s
55+
# go back to explorer
56+
Type "0" Sleep 0.5s
4257
# show help
4358
Type "?" Sleep 0.5s
4459
# run plan on all modules
4560
Type "p"
46-
# we're taken to the plan task group page
61+
# show plan task group page
4762
Sleep 1s
4863
# hide help
4964
Type "?"
@@ -57,51 +72,48 @@ Sleep 0.5s Type "y"
5772
# preview output for several tasks
5873
Sleep 2s Down Sleep 1s Down Sleep 1s Down Sleep 1s
5974

60-
# go to workspaces
61-
Type "w" Sleep 1s
62-
# take screen shot of workspaces
75+
# go back to explorer
76+
Type "0" Sleep 1s
77+
# take screen shot of explorer tree populated with workspaces
6378
Screenshot demo/workspaces.png
6479
# filter dev workspaces
6580
Type "/" Sleep 0.5s Type "dev" Sleep 0.5s Enter
6681
# take screen shot of filter mode
6782
Screenshot demo/filter.png Sleep 0.5s
83+
# move cursor down one onto dev workspace belonging to module a
84+
Down Sleep 0.5s
6885
# select all dev workspaces and auto-apply
6986
Ctrl+a Sleep 0.5s Type "a"
7087
# accept confirmation
7188
Sleep 0.5s Type "y"
7289
# preview output for several tasks
7390
Sleep 2s Down Sleep 1s Down Sleep 1s
7491

75-
# go back to modules
76-
Type "m" Sleep 0.5s
92+
# go back to explorer
93+
Type "0" Sleep 0.5s
7794
# take screen shot of modules (sleep to ensure page doesn't switch too soon)
7895
Screenshot demo/modules.png Sleep 0.5s
7996

80-
# go to state for current module
97+
# go to state for current dev workspace
8198
Type "s" Sleep 0.5s
8299
# see preview for several resources
83100
Sleep 0.5s Down Sleep 0.5s Down Sleep 0.5s Down Sleep 0.5s
84101

85102
# move current resource
86-
Type "M" Sleep 0.5s Backspace 6 Sleep 0.5s Type "giraffe[99]" Sleep 0.5s Enter
87-
# look at task output for a bit
88-
Sleep 1s
103+
Type "m" Sleep 0.5s Backspace 6 Sleep 0.5s Type "giraffe[99]" Sleep 0.5s Enter
104+
# wait a bit of move to occur and message to appear in footer
105+
Sleep 1.5s
89106

90-
# go back to state
91-
Escape Sleep 0.5s
92107
# take screen shot of state
93108
Screenshot demo/state.png
94109

95110
# delete another resource
96111
Down Sleep 0.5s
97-
Type "D"
112+
Delete
98113
# confirm deletion
99114
Sleep 0.5s Type "y" Sleep 0.5s
100115
# look at task output for a bit
101-
Sleep 1s
102-
103-
# go back to state
104-
Escape Sleep 0.5s
116+
Sleep 1.5s
105117

106118
# select all resources
107119
Ctrl+a Sleep 0.5s
@@ -117,7 +129,7 @@ Escape Sleep 0.5s
117129

118130
# select all resources
119131
Ctrl+a Sleep 0.5s
120-
# taint all resources
132+
# untaint all resources
121133
Type "U"
122134
# we're taken to the untaint task group page
123135
Sleep 0.5s
@@ -167,17 +179,15 @@ Type `TF_CLI_CONFIG_FILE=$PWD/mirror/mirror.tfrc go run main.go -w demo/do_cost_
167179
Sleep 1s
168180
Show
169181

170-
# show unintialized modules
182+
# show explorer tree
171183
Sleep 1s
172184

173185
# init all modules
174186
Ctrl+a Sleep 0.5s Type "i"
175187
# we're taken to the init task group page, wait for a few seconds for tasks to finish
176188
Sleep 2s
177189

178-
# go to workspaces
179-
Type "w" Sleep 2s
180-
# select all workspaces
190+
# select all modules
181191
Ctrl+a Sleep 0.5s
182192
# calculate cost
183193
Type "$"
@@ -186,27 +196,27 @@ Sleep 6s
186196
# take screen shot of infracost output (sleep to ensure page doesn't switch too soon)
187197
Screenshot demo/infracost_output.png Sleep 0.5s
188198

189-
# go back to workspaces
190-
Type "w" Sleep 0.5s
191-
# take screen shot of workspaces (sleep to ensure page doesn't switch too soon)
199+
# go back to explorer
200+
Type "0" Sleep 0.5s
201+
# take screen shot of workspaces with costs (sleep to ensure page doesn't switch too soon)
192202
Screenshot demo/workspaces_with_cost.png Sleep 0.5s
193203
Sleep 3s
194204

195205
# quit app and restart, this time with modules with .tool-versions files, to demonstrate support for executing arbitrary programs, in this case, `asdf`
196206
Hide
197207
Ctrl+c Type "y"
198-
Type `TF_CLI_CONFIG_FILE=$PWD/mirror/mirror.tfrc go run main.go -w demo/multiple_versions` Enter
208+
Type@1ms `TF_CLI_CONFIG_FILE=$PWD/mirror/mirror.tfrc go run main.go -w demo/multiple_versions` Enter
199209
Sleep 1s
200210
Show
201211

202-
# show unintialized modules
212+
# show explorer
203213
Sleep 1s
204214

205215
# select all modules
206216
Ctrl+a Sleep 0.5s
207217
# install terraform for each module
208218
Type "x" Sleep 1s
209-
Type "asdf install terraform" Sleep 1s
219+
Type@1ms "asdf install terraform" Sleep 1s
210220
# take screen shot (sleep to ensure page doesn't switch too soon)
211221
Screenshot demo/execute_asdf_install_terraform.png Sleep 0.5s
212222
# Execute asdf

Diff for: demo/workspaces.png

387 KB
Loading

Diff for: demo/workspaces_with_cost.png

175 KB
Loading

Diff for: hacks/make_demo.sh

-5
This file was deleted.

Diff for: hacks/reset_demo.sh

-8
This file was deleted.

0 commit comments

Comments
 (0)