terraspace 0.2.3 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +31 -0
  3. data/README.md +14 -1
  4. data/lib/templates/base/git_hook/hook.sh +1 -1
  5. data/lib/templates/base/project/.gitignore +1 -0
  6. data/lib/templates/base/project/README.md +17 -0
  7. data/lib/terraspace.rb +5 -0
  8. data/lib/terraspace/all/base.rb +8 -0
  9. data/lib/terraspace/all/grapher.rb +129 -0
  10. data/lib/terraspace/all/preview.rb +43 -0
  11. data/lib/terraspace/all/runner.rb +169 -0
  12. data/lib/terraspace/all/summary.rb +99 -0
  13. data/lib/terraspace/app.rb +31 -9
  14. data/lib/terraspace/booter.rb +9 -0
  15. data/lib/terraspace/builder.rb +59 -22
  16. data/lib/terraspace/cli.rb +39 -12
  17. data/lib/terraspace/cli/all.rb +63 -0
  18. data/lib/terraspace/cli/build/placeholder.rb +2 -5
  19. data/lib/terraspace/cli/bundle.rb +1 -1
  20. data/lib/terraspace/cli/check_setup.rb +17 -5
  21. data/lib/terraspace/cli/cloud.rb +18 -2
  22. data/lib/terraspace/cli/cloud/runs.rb +24 -0
  23. data/lib/terraspace/cli/commander.rb +1 -8
  24. data/lib/terraspace/cli/down.rb +20 -0
  25. data/lib/terraspace/cli/help/cloud/runs/list.md +36 -0
  26. data/lib/terraspace/cli/help/cloud/runs/prune.md +25 -0
  27. data/lib/terraspace/cli/help/cloud/sync.md +19 -0
  28. data/lib/terraspace/cli/help/log.md +46 -0
  29. data/lib/terraspace/cli/init.rb +35 -7
  30. data/lib/terraspace/cli/list.rb +14 -1
  31. data/lib/terraspace/cli/log.rb +112 -0
  32. data/lib/terraspace/cli/log/concern.rb +24 -0
  33. data/lib/terraspace/cli/logs.rb +15 -0
  34. data/lib/terraspace/cli/logs/tasks.rb +32 -0
  35. data/lib/terraspace/cli/new/git_hook.rb +1 -1
  36. data/lib/terraspace/cli/tfc_concern.rb +14 -0
  37. data/lib/terraspace/cli/up.rb +32 -0
  38. data/lib/terraspace/compiler/backend.rb +10 -0
  39. data/lib/terraspace/compiler/builder.rb +5 -4
  40. data/lib/terraspace/compiler/cleaner.rb +1 -1
  41. data/lib/terraspace/compiler/cleaner/backend_change.rb +21 -7
  42. data/lib/terraspace/compiler/commands_concern.rb +18 -0
  43. data/lib/terraspace/compiler/dirs_concern.rb +47 -0
  44. data/lib/terraspace/compiler/dsl/syntax/helpers/common.rb +26 -1
  45. data/lib/terraspace/core.rb +11 -2
  46. data/lib/terraspace/dependency/graph.rb +139 -0
  47. data/lib/terraspace/dependency/node.rb +38 -0
  48. data/lib/terraspace/dependency/registry.rb +11 -0
  49. data/lib/terraspace/logger.rb +6 -18
  50. data/lib/terraspace/logger/formatter.rb +13 -0
  51. data/lib/terraspace/mod.rb +7 -1
  52. data/lib/terraspace/seeder/where.rb +6 -2
  53. data/lib/terraspace/shell.rb +97 -0
  54. data/lib/terraspace/terraform/api.rb +7 -45
  55. data/lib/terraspace/terraform/api/base.rb +7 -0
  56. data/lib/terraspace/terraform/api/client.rb +23 -3
  57. data/lib/terraspace/terraform/api/http.rb +14 -34
  58. data/lib/terraspace/terraform/api/http/concern.rb +10 -0
  59. data/lib/terraspace/terraform/api/runs.rb +28 -0
  60. data/lib/terraspace/terraform/api/token.rb +65 -0
  61. data/lib/terraspace/terraform/api/var.rb +20 -6
  62. data/lib/terraspace/terraform/api/vars.rb +2 -1
  63. data/lib/terraspace/terraform/api/workspace.rb +98 -0
  64. data/lib/terraspace/terraform/args/default.rb +48 -21
  65. data/lib/terraspace/terraform/cloud/runs.rb +13 -0
  66. data/lib/terraspace/terraform/cloud/runs/base.rb +33 -0
  67. data/lib/terraspace/terraform/cloud/runs/item_presenter.rb +37 -0
  68. data/lib/terraspace/terraform/cloud/runs/lister.rb +22 -0
  69. data/lib/terraspace/terraform/cloud/runs/pruner.rb +109 -0
  70. data/lib/terraspace/terraform/cloud/sync.rb +41 -0
  71. data/lib/terraspace/terraform/cloud/syncer.rb +52 -0
  72. data/lib/terraspace/terraform/cloud/workspace.rb +10 -21
  73. data/lib/terraspace/terraform/hooks/builder.rb +1 -1
  74. data/lib/terraspace/terraform/remote_state/fetcher.rb +143 -0
  75. data/lib/terraspace/terraform/remote_state/marker/output.rb +39 -0
  76. data/lib/terraspace/terraform/remote_state/marker/pretty_tracer.rb +37 -0
  77. data/lib/terraspace/terraform/remote_state/output_proxy.rb +29 -0
  78. data/lib/terraspace/terraform/runner.rb +24 -14
  79. data/lib/terraspace/util.rb +1 -5
  80. data/lib/terraspace/util/pretty.rb +18 -0
  81. data/lib/terraspace/version.rb +1 -1
  82. data/spec/fixtures/fetcher/c1.json +37 -0
  83. data/spec/fixtures/parser/cache_dirs/all/01-test.auto.tfvars +5 -0
  84. data/spec/fixtures/parser/cache_dirs/depends_on/01-test.auto.tfvars +2 -0
  85. data/spec/fixtures/parser/cache_dirs/output/01-test.auto.tfvars +2 -0
  86. data/spec/fixtures/summary/down.log +12 -0
  87. data/spec/fixtures/summary/output.log +5 -0
  88. data/spec/fixtures/summary/plan/error.log +20 -0
  89. data/spec/fixtures/summary/plan/success.log +17 -0
  90. data/spec/fixtures/summary/show.log +22 -0
  91. data/spec/fixtures/summary/up/error.log +13 -0
  92. data/spec/fixtures/summary/up/success.log +63 -0
  93. data/spec/fixtures/summary/validate/error.log +13 -0
  94. data/spec/fixtures/summary/validate/success.log +5 -0
  95. data/spec/terraspace/all/grapher_spec.rb +38 -0
  96. data/spec/terraspace/all/runner_spec.rb +48 -0
  97. data/spec/terraspace/all/summary_spec.rb +93 -0
  98. data/spec/terraspace/dependency/graph_spec.rb +162 -0
  99. data/spec/terraspace/seeder_spec.rb +0 -1
  100. data/spec/terraspace/terraform/remote_state/fetcher_spec.rb +52 -0
  101. data/terraspace.gemspec +5 -1
  102. metadata +138 -5
  103. data/lib/terraspace/terraform/cloud.rb +0 -25
  104. data/lib/terraspace/util/sh.rb +0 -19
@@ -0,0 +1,99 @@
1
+ module Terraspace::All
2
+ class Summary
3
+ include Terraspace::CLI::Log::Concern
4
+ include Terraspace::Util::Logging
5
+
6
+ def initialize(data={})
7
+ @data = data
8
+ @command = data[:command]
9
+ @log_path = data[:log_path]
10
+ @terraspace_command = data[:terraspace_command]
11
+ end
12
+
13
+ @@header_shown = false
14
+ def run
15
+ @lines = readlines(@log_path)
16
+ if respond_to?(@command.to_sym)
17
+ send(@command)
18
+ else
19
+ default
20
+ end
21
+ summarize
22
+ end
23
+
24
+ # Examples of "complete" line:
25
+ # [2020-09-06T21:58:25 #11313 terraspace up b1]: Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
26
+ # [2020-09-07T08:28:15 #26093 terraspace down a1]: Destroy complete! Resources: 2 destroyed.
27
+ #
28
+ # handles: up and down
29
+ def default
30
+ @lines.select! do |line|
31
+ line.include?("complete! Resources:") || # success: handles both apply and destroy output
32
+ line.include?("Changes to Outputs") ||
33
+ line.include?("No changes") ||
34
+ line.include?("Error: ") # error
35
+ end
36
+ end
37
+
38
+ # Example 1:
39
+ # [2020-09-07T14:45:14 #23340 terraspace plan b1]: No changes. Infrastructure is up-to-date.
40
+ # Example 2:
41
+ # [2020-09-07T14:46:58 #31974 terraspace plan b1]: Changes to Outputs:
42
+ # [2020-09-07T14:46:58 #31974 terraspace plan b1]: ~ length = 1 -> 2
43
+ def plan
44
+ @lines.select! do |line|
45
+ line.include?("No changes. Infrastructure") ||
46
+ line.include?("Changes to Outputs") ||
47
+ line.include?("Plan:") ||
48
+ line.include?("Changes to ") ||
49
+ line.include?("Error: ") # error
50
+ end
51
+ end
52
+
53
+ def output
54
+ @lines # pass through all output info
55
+ end
56
+
57
+ def show
58
+ resources = @lines.grep(/: resource "/).count
59
+ outputs = count_outputs(@lines)
60
+ summary = "Resources: #{resources} Outputs: #{outputs}"
61
+ # get summary line before running select! which will remove lines
62
+ @lines.select! do |line|
63
+ line.include?("Error: ") # error
64
+ end
65
+ @lines.unshift(summary) # add to top
66
+ end
67
+
68
+ # [2020-09-07T14:53:36 #31106 terraspace show b1]: Outputs:
69
+ # [2020-09-07T14:53:36 #31106 terraspace show b1]:
70
+ # [2020-09-07T14:53:36 #31106 terraspace show b1]: length = 1
71
+ # [2020-09-07T14:53:36 #31106 terraspace show b1]: length2 = 2
72
+ # [2020-09-07T14:53:36 #31106 terraspace show b1]: random_pet_id = "corgi"
73
+ def count_outputs(lines)
74
+ count = 0
75
+ counting = false
76
+ lines.each do |line|
77
+ counting ||= line.include?(": Outputs:")
78
+ count += 1 if counting && line.include?(' = ')
79
+ end
80
+ count
81
+ end
82
+
83
+ # [2020-09-07T13:51:45 #21323 terraspace validate a1]: Success! The configuration is valid.
84
+ def validate
85
+ @lines.select! do |line|
86
+ line.include?("The configuration is") || # success
87
+ line.include?("Error: ") # error
88
+ end
89
+ end
90
+
91
+ private
92
+ def summarize
93
+ @lines.each do |line|
94
+ line.sub!(/.*\]:\s+/, ' ') # remove log info from line
95
+ logger.info("#{@terraspace_command}: #{line}")
96
+ end
97
+ end
98
+ end
99
+ end
@@ -10,18 +10,40 @@ module Terraspace
10
10
 
11
11
  def defaults
12
12
  config = ActiveSupport::OrderedOptions.new
13
- config.test_framework = "rspec"
14
- config.logger = Logger.new($stdout)
15
- config.logger.level = :info
16
- config.hooks = Hooks.new
17
- config.cloud = ActiveSupport::OrderedOptions.new
18
- config.cloud.overwrite = true
19
- config.cloud.overwrite_sensitive = true
20
- config.cloud.relative_root = nil
13
+ config.all = ActiveSupport::OrderedOptions.new
14
+ config.all.concurrency = 5
15
+ config.all.exit_on_fail = ActiveSupport::OrderedOptions.new
16
+ config.all.exit_on_fail.down = true
17
+ config.all.exit_on_fail.up = true
18
+ config.all.ignore_stacks = []
19
+ config.auto_create_backend = true
21
20
  config.build = ActiveSupport::OrderedOptions.new
22
- config.build.cache_root = nil # defaults to /full/path/to/.terraspace-cache
23
21
  config.build.cache_dir = ":CACHE_ROOT/:REGION/:ENV/:BUILD_DIR"
22
+ config.build.cache_root = nil # defaults to /full/path/to/.terraspace-cache
24
23
  config.build.clean_cache = nil # defaults to /full/path/to/.terraspace-cache
24
+ config.cloud = ActiveSupport::OrderedOptions.new
25
+ config.cloud.auto_sync = true
26
+ config.cloud.working_dir_prefix = nil
27
+ config.cloud.hostname = nil
28
+ config.cloud.vars = ActiveSupport::OrderedOptions.new
29
+ config.cloud.vars.overwrite = true
30
+ config.cloud.vars.overwrite_sensitive = true
31
+ config.cloud.vars.show_message = "create"
32
+ config.cloud.workspace = ActiveSupport::OrderedOptions.new
33
+ config.cloud.workspace.attrs = ActiveSupport::OrderedOptions.new
34
+ config.hooks = Hooks.new
35
+ config.init = ActiveSupport::OrderedOptions.new
36
+ config.init.mode = "auto" # auto, never, always
37
+ config.log = ActiveSupport::OrderedOptions.new
38
+ config.log.root = Terraspace.log_root
39
+ config.logger = Logger.new(ENV['TS_LOG_PATH'] || $stderr)
40
+ config.logger.level = ENV['TS_LOG_LEVEL'] || :info
41
+ config.logger.formatter = Logger::Formatter.new
42
+ config.test_framework = "rspec"
43
+ config.terraform = ActiveSupport::OrderedOptions.new
44
+ config.terraform.plugin_cache = ActiveSupport::OrderedOptions.new
45
+ config.terraform.plugin_cache.enabled = true
46
+ config.terraform.plugin_cache.dir = ENV['TF_PLUGIN_CACHE_DIR'] || "#{Terraspace.tmp_root}/plugin_cache"
25
47
  config
26
48
  end
27
49
 
@@ -5,6 +5,7 @@ module Terraspace
5
5
  load_plugin_default_configs
6
6
  Terraspace.config # load project config
7
7
  Terraspace::App::Hooks.run_hook(:on_boot)
8
+ set_plugin_cache!
8
9
  end
9
10
 
10
11
  def load_plugin_default_configs
@@ -14,6 +15,14 @@ module Terraspace
14
15
  end
15
16
  end
16
17
 
18
+ def set_plugin_cache!
19
+ plugin_cache = Terraspace.config.terraform.plugin_cache
20
+ return unless plugin_cache.enabled
21
+ dir = ENV['TF_PLUGIN_CACHE_DIR'] ||= plugin_cache.dir
22
+ FileUtils.mkdir_p(dir)
23
+ dir
24
+ end
25
+
17
26
  extend self
18
27
  end
19
28
  end
@@ -1,48 +1,85 @@
1
1
  module Terraspace
2
2
  class Builder < Terraspace::CLI::Base
3
+ include Compiler::DirsConcern
4
+ include Compiler::CommandsConcern
5
+
6
+ attr_reader :graph
7
+
3
8
  def run
9
+ return if @options[:build] == false
4
10
  Terraspace::CLI::CheckSetup.check!
5
11
  @mod.root_module = true
6
- Compiler::Cleaner.new(@mod, @options).clean if clean?
12
+ clean
7
13
  build_dir = Util.pretty_path(@mod.cache_dir)
8
- logger.info "Building #{build_dir}"
14
+ placeholder_stack_message
15
+ logger.info "Building #{build_dir}" unless @options[:quiet] # from terraspace all
16
+
17
+ build_unresolved
18
+ auto_create_backend
19
+ batches = build_batches
20
+ build_all
21
+ logger.info "Built in #{build_dir}" unless @options[:quiet] # from terraspace all
22
+ batches
23
+ end
24
+
25
+ # Builds dependency graph and returns the batches to run
26
+ def build_batches
27
+ dependencies = Terraspace::Dependency::Registry.data # populated after build_unresolved
28
+ @graph = Terraspace::Dependency::Graph.new(stack_names, dependencies, @options)
29
+ @graph.build
30
+ end
9
31
 
10
- build_all("modules") # build all modules and stacks as dependencies
11
- build_all("stacks")
32
+ def build_all
33
+ # At this point dependencies have been resolved.
34
+ Terraspace::Terraform::RemoteState::Fetcher.flush!
35
+ @resolved = true
36
+ build_unresolved
37
+ end
38
+
39
+ def build_unresolved
40
+ build_dir("modules")
41
+ build_dir("stacks")
12
42
  build_root_module
13
- logger.info "Built in #{build_dir}"
14
43
  end
15
44
 
16
45
  def build_root_module
46
+ @mod.resolved = @resolved
17
47
  Compiler::Builder.new(@mod).build
18
48
  end
19
49
 
20
- def build_all(type_dir)
21
- built = []
22
- local_paths(type_dir).each do |path|
23
- next unless File.directory?(path)
24
- mod_name = File.basename(path)
25
- next if built.include?(mod_name) # ensures modules in app folder take higher precedence than vendor folder
26
-
27
- consider_stacks = type_dir == "stacks"
28
- mod = Mod.new(mod_name, consider_stacks: consider_stacks)
29
-
50
+ def build_dir(type_dir)
51
+ with_each_mod(type_dir) do |mod|
52
+ mod.resolved = @resolved
53
+ is_root_module = mod.cache_dir == @mod.cache_dir
54
+ next if is_root_module # handled by build_root_module
30
55
  Compiler::Builder.new(mod).build
31
- built << mod_name
32
56
  end
33
57
  end
34
58
 
35
- def local_paths(type_dir)
36
- dirs("app/#{type_dir}/*") + dirs("vendor/#{type_dir}/*")
59
+ # Auto create after build_unresolved since will need to run state pull for dependencies
60
+ def auto_create_backend
61
+ return if Terraspace.config.auto_create_backend == false
62
+ return unless requires_backend?
63
+ Terraspace::Compiler::Backend.new(@mod).create
37
64
  end
38
65
 
39
- def dirs(path)
40
- Dir.glob("#{Terraspace.root}/#{path}")
66
+ def clean
67
+ Compiler::Cleaner.new(@mod, @options).clean if clean?
41
68
  end
42
69
 
43
70
  def clean?
44
- clean_cache = Terraspace.config.build.clean_cache
45
- clean_cache.nil? ? true : clean_cache
71
+ if @options[:clean].nil?
72
+ clean_cache = Terraspace.config.build.clean_cache
73
+ clean_cache.nil? ? true : clean_cache
74
+ else
75
+ @options[:clean]
76
+ end
77
+ end
78
+
79
+ def placeholder_stack_message
80
+ return if @options[:quiet]
81
+ return unless @options[:mod] == "placeholder"
82
+ logger.info "Building one stack to build all stacks"
46
83
  end
47
84
  end
48
85
  end
@@ -28,21 +28,29 @@ module Terraspace
28
28
  option :reconfigure, type: :boolean, desc: "Add terraform -reconfigure option"
29
29
  }
30
30
 
31
- desc "new SUBCOMMAND", "new subcommands"
32
- long_desc Help.text(:new)
33
- subcommand "new", New
31
+ desc "all SUBCOMMAND", "all subcommands"
32
+ long_desc Help.text(:all)
33
+ subcommand "all", All
34
34
 
35
35
  desc "cloud SUBCOMMAND", "cloud subcommands"
36
36
  long_desc Help.text(:cloud)
37
37
  subcommand "cloud", Cloud
38
38
 
39
- desc "build STACK", "build"
39
+ desc "logs SUBCOMMAND", "logs management subcommands"
40
+ long_desc Help.text(:logs)
41
+ subcommand "logs", Logs
42
+
43
+ desc "new SUBCOMMAND", "new subcommands"
44
+ long_desc Help.text(:new)
45
+ subcommand "new", New
46
+
47
+ desc "build [STACK]", "build"
40
48
  long_desc Help.text(:build)
41
- option :quiet, type: :boolean, default: true, desc: "quiet output"
49
+ option :quiet, type: :boolean, desc: "quiet output"
42
50
  instance_option.call
43
51
  yes_option.call
44
- def build(mod)
45
- Terraspace::Builder.new(@options.merge(mod: mod)).run
52
+ def build(mod="placeholder")
53
+ Terraspace::Builder.new(options.merge(mod: mod)).run # building any stack builds them all
46
54
  end
47
55
 
48
56
  desc "bundle", "bundle"
@@ -77,8 +85,7 @@ module Terraspace
77
85
  reconfigure_option.call
78
86
  option :destroy_workspace, type: :boolean, desc: "Also destroy the Cloud workspace. Only applies when using Terraform Cloud remote backend."
79
87
  def down(mod)
80
- Commander.new("destroy", options.merge(mod: mod, command: "down")).run
81
- Terraspace::Terraform::Cloud::Workspace.new(options.merge(mod: mod)).destroy if @options[:destroy_workspace]
88
+ Down.new(options.merge(mod: mod)).run
82
89
  end
83
90
 
84
91
  desc "info STACK", "info"
@@ -89,12 +96,30 @@ module Terraspace
89
96
  Info.new(options.merge(mod: mod)).run
90
97
  end
91
98
 
99
+ desc "init STACK", "init"
100
+ long_desc Help.text(:init)
101
+ instance_option.call
102
+ def init(mod)
103
+ Commander.new("init", options.merge(mod: mod, quiet: false)).run
104
+ end
105
+
92
106
  desc "list", "list stacks and modules"
93
107
  long_desc Help.text(:list)
108
+ option :type, aliases: %w[t], desc: "Type: stack or module. Default all"
94
109
  def list
95
110
  List.new(options).run
96
111
  end
97
112
 
113
+ desc "log [ACTION] [STACK]", "The log command allows you to view multiple logs."
114
+ long_desc Help.text("log")
115
+ option :timestamps, aliases: %w[t], type: :boolean, desc: "Whether or not to show the leading timestamp. Defaults to timestamps for multiple logs, and no timestamp if a single log is specified. Note: In follow mode, timestamp always shown"
116
+ option :follow, aliases: %w[f], type: :boolean, desc: "Follow the log in live tail fashion. Must specify a stack if using this option."
117
+ option :limit, aliases: %w[n], default: 10, type: :numeric, desc: "Number of lines to limit showing. Only applies in no-follow mode."
118
+ option :all, aliases: %w[a], type: :boolean, desc: "All mode turns off the limit. Defaults to all if a single log is specified. Only applies in no-follow mode."
119
+ def log(action=nil, stack=nil)
120
+ Log.new(@options.merge(action: action, stack: stack)).run
121
+ end
122
+
98
123
  desc "plan STACK", "plan stack"
99
124
  long_desc Help.text(:plan)
100
125
  auto_option.call
@@ -142,6 +167,8 @@ module Terraspace
142
167
  desc "show STACK", "show"
143
168
  long_desc Help.text(:show)
144
169
  instance_option.call
170
+ option :plan, desc: "path to created.plan"
171
+ option :json, type: :boolean, desc: "show plan in json format"
145
172
  def show(mod)
146
173
  Commander.new("show", options.merge(mod: mod)).run
147
174
  end
@@ -161,7 +188,7 @@ module Terraspace
161
188
  Commander.new("output", options.merge(mod: mod)).run
162
189
  end
163
190
 
164
- desc "update STACK", "Update infrasturcture. IE: apply plan"
191
+ desc "up STACK", "Deploy infrastructure. IE: terraform apply"
165
192
  long_desc Help.text(:update)
166
193
  auto_option.call
167
194
  init_option.call
@@ -171,8 +198,8 @@ module Terraspace
171
198
  reconfigure_option.call
172
199
  option :plan, desc: "Execution plan that can be used to only execute a pre-determined set of actions."
173
200
  option :var_files, type: :array, desc: "list of var files"
174
- def update(mod)
175
- Commander.new("apply", options.merge(mod: mod)).run
201
+ def up(mod)
202
+ Up.new(options.merge(mod: mod)).run
176
203
  end
177
204
 
178
205
  desc "validate STACK", "validate"
@@ -0,0 +1,63 @@
1
+ class Terraspace::CLI
2
+ class All < Terraspace::Command
3
+ class_option :yes, aliases: :y, type: :boolean, desc: "auto approve all batch commands"
4
+ class_option :exit_on_fail, type: :boolean, desc: "whether or not to exit when one of the batch commands fails"
5
+
6
+ desc "down", "destroy all"
7
+ long_desc Help.text("all/down")
8
+ option :destroy_workspace, type: :boolean, desc: "Also destroy the Cloud workspace. Only applies when using Terraform Cloud remote backend."
9
+ def down(*stacks)
10
+ Terraspace::All::Runner.new("down", @options.merge(stacks: stacks)).run
11
+ end
12
+
13
+ desc "graph", "graph all"
14
+ long_desc Help.text("all/graph")
15
+ option :format, default: "png", desc: "format: text or diagram"
16
+ option :full,type: :boolean, desc: "draw the full graph with highlighted nodes or draw the subgraph. text format defaults to false, graph format defaults to true"
17
+ def graph(*stacks)
18
+ Terraspace::All::Grapher.new(@options.merge(stacks: stacks)).run
19
+ end
20
+
21
+ desc "refresh", "refresh all"
22
+ long_desc Help.text("all/refresh")
23
+ def refresh(*stacks)
24
+ Terraspace::All::Runner.new("refresh", @options.merge(stacks: stacks)).run
25
+ end
26
+
27
+ desc "output", "output all"
28
+ long_desc Help.text("all/output")
29
+ def output(*stacks)
30
+ Terraspace::All::Runner.new("output", @options.merge(stacks: stacks)).run
31
+ end
32
+
33
+ desc "plan", "plan all"
34
+ long_desc Help.text("all/plan")
35
+ def plan(*stacks)
36
+ Terraspace::All::Runner.new("plan", @options.merge(stacks: stacks)).run
37
+ end
38
+
39
+ desc "providers", "providers all"
40
+ long_desc Help.text("all/providers")
41
+ def providers(*stacks)
42
+ Terraspace::All::Runner.new("providers", @options.merge(stacks: stacks)).run
43
+ end
44
+
45
+ desc "show", "show all"
46
+ long_desc Help.text("all/show")
47
+ def show(*stacks)
48
+ Terraspace::All::Runner.new("show", @options.merge(stacks: stacks)).run
49
+ end
50
+
51
+ desc "up", "deploy all"
52
+ long_desc Help.text("all/up")
53
+ def up(*stacks)
54
+ Terraspace::All::Runner.new("up", @options.merge(stacks: stacks)).run
55
+ end
56
+
57
+ desc "validate", "validate all"
58
+ long_desc Help.text("all/validate")
59
+ def validate(*stacks)
60
+ Terraspace::All::Runner.new("validate", @options.merge(stacks: stacks)).run
61
+ end
62
+ end
63
+ end