terraspace 0.5.8 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE.md +2 -2
  3. data/.github/ISSUE_TEMPLATE/bug_report.md +4 -3
  4. data/.github/ISSUE_TEMPLATE/question.md +2 -2
  5. data/CHANGELOG.md +32 -7
  6. data/README.md +2 -0
  7. data/lib/terraspace.rb +1 -0
  8. data/lib/terraspace/all/grapher.rb +21 -4
  9. data/lib/terraspace/app.rb +36 -14
  10. data/lib/terraspace/app/inits.rb +13 -0
  11. data/lib/terraspace/booter.rb +1 -0
  12. data/lib/terraspace/cli.rb +13 -6
  13. data/lib/terraspace/cli/build/placeholder.rb +6 -1
  14. data/lib/terraspace/cli/commander.rb +1 -1
  15. data/lib/terraspace/cli/down.rb +1 -1
  16. data/lib/terraspace/cli/help/{cloud → tfc}/destroy.md +1 -1
  17. data/lib/terraspace/cli/help/{cloud → tfc}/list.md +1 -1
  18. data/lib/terraspace/cli/help/{cloud → tfc}/runs/list.md +3 -3
  19. data/lib/terraspace/cli/help/{cloud → tfc}/runs/prune.md +3 -3
  20. data/lib/terraspace/cli/help/{cloud → tfc}/sync.md +3 -3
  21. data/lib/terraspace/cli/init.rb +21 -8
  22. data/lib/terraspace/cli/state.rb +10 -0
  23. data/lib/terraspace/cli/{cloud.rb → tfc.rb} +3 -3
  24. data/lib/terraspace/cli/{cloud → tfc}/runs.rb +4 -4
  25. data/lib/terraspace/cli/up.rb +5 -3
  26. data/lib/terraspace/compiler/builder.rb +2 -0
  27. data/lib/terraspace/compiler/dirs_concern.rb +11 -1
  28. data/lib/terraspace/compiler/select.rb +28 -0
  29. data/lib/terraspace/compiler/strategy/tfvar.rb +16 -4
  30. data/lib/terraspace/compiler/strategy/tfvar/layer.rb +75 -52
  31. data/lib/terraspace/layering.rb +24 -0
  32. data/lib/terraspace/logger.rb +8 -1
  33. data/lib/terraspace/mod.rb +18 -3
  34. data/lib/terraspace/plugin/expander/friendly.rb +10 -0
  35. data/lib/terraspace/plugin/expander/interface.rb +6 -1
  36. data/lib/terraspace/plugin/summary/interface.rb +1 -1
  37. data/lib/terraspace/shell.rb +16 -1
  38. data/lib/terraspace/shell/error.rb +1 -1
  39. data/lib/terraspace/terraform/api/runs.rb +13 -2
  40. data/lib/terraspace/terraform/api/token.rb +2 -2
  41. data/lib/terraspace/terraform/api/var.rb +1 -1
  42. data/lib/terraspace/terraform/api/vars.rb +1 -1
  43. data/lib/terraspace/terraform/api/vars/base.rb +2 -0
  44. data/lib/terraspace/terraform/api/vars/json.rb +13 -1
  45. data/lib/terraspace/terraform/api/workspace.rb +10 -3
  46. data/lib/terraspace/terraform/args/default.rb +23 -13
  47. data/lib/terraspace/terraform/ihooks/after/plan.rb +17 -0
  48. data/lib/terraspace/terraform/ihooks/base.rb +8 -0
  49. data/lib/terraspace/terraform/ihooks/before/plan.rb +14 -0
  50. data/lib/terraspace/terraform/remote_state/fetcher.rb +1 -1
  51. data/lib/terraspace/terraform/runner.rb +12 -0
  52. data/lib/terraspace/terraform/{cloud → tfc}/runs.rb +1 -1
  53. data/lib/terraspace/terraform/{cloud → tfc}/runs/base.rb +1 -1
  54. data/lib/terraspace/terraform/{cloud → tfc}/runs/item_presenter.rb +1 -1
  55. data/lib/terraspace/terraform/{cloud → tfc}/runs/lister.rb +1 -1
  56. data/lib/terraspace/terraform/{cloud → tfc}/runs/pruner.rb +1 -1
  57. data/lib/terraspace/terraform/{cloud → tfc}/sync.rb +2 -2
  58. data/lib/terraspace/terraform/{cloud → tfc}/syncer.rb +1 -1
  59. data/lib/terraspace/terraform/{cloud → tfc}/workspace.rb +2 -3
  60. data/lib/terraspace/util/pretty.rb +2 -1
  61. data/lib/terraspace/version.rb +1 -1
  62. metadata +26 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff60ae09b5f5278378d1d0343e68e19bd697825e3206a981fc3023d914b7710a
4
- data.tar.gz: a036994bf09c8ef78323b64b234dd083d438bb63d552444178a611ac05cc886e
3
+ metadata.gz: 5e6515cd30855a02e17147354db57995da471812f6437611140f715726268bb6
4
+ data.tar.gz: 33a4066b1a30d091fe7881bbafccc0778f47715d6bea7671ba9f011e1f3702a5
5
5
  SHA512:
6
- metadata.gz: 16e8f2ff6676201c697480a8c25f50b32a3a84c6fe7ee18d8517bef1ddf177f86cbbfcf3112e116e7ef93a7cf201e73c924306614a4f8061c9b8c75e13b75be7
7
- data.tar.gz: 1cc236483836d3453216559c2ce378716b5352ddb482ff6ba03f6a4f2a58251b3e6f44f2f6dc56acac0be49ffed7bb683d572a8df5176ca2557165b2b16778eb
6
+ metadata.gz: 6b3b7c108ac28b8cf83c4cde07ed64f4fc84d8109bc77c5b1ddaa3018e70393e9cb57cbc7fc65315e7877e55833bd434695753ed8cb71b31bb249a440c96c910
7
+ data.tar.gz: 3b85a43ae356e6c95def1ab614ef86af19e3c875752d265a5de55ada4f66b12830d514d2655841f973690b449d8fc38f610ac6b146ba943e3d37d72694e86d79
@@ -1,7 +1,7 @@
1
1
  Please fill out one of the templates on https://github.com/boltops-tools/terraspace/issues/new/choose
2
2
 
3
- If you want to ask a question please do so on sites like StackOverflow.
3
+ If you want to ask a question please do so in the Terraspace category in the BoltOps Community forum: https://community.boltops.com
4
4
 
5
- To be sensitive to everyone's time, we may close issues asking questions without comment. Here are some additional options also https://terraspace.cloud/support/ 👌
5
+ To be sensitive to everyone's time, we may close issues asking questions without comment. Posting your questions in the Terraspace community forum is the best place. It also benefits others by making the questions easier to find. Here are some additional options also https://terraspace.cloud/support/ 👌
6
6
 
7
7
  Thank you!
@@ -15,7 +15,8 @@ issue may be closed without comment. If you repeatedly fail to provide enough
15
15
  details, you may be blocked from ever submitting issues to Terraspace again.
16
16
  Please use your best judgment. 👍
17
17
 
18
- If you are unsure this is a bug in Terraspace, please consider asking your question at sites like StackOverflow.
18
+ If you are unsure this is a bug in Terraspace, please consider asking your question at:
19
+ https://community.boltops.com
19
20
 
20
21
  Thanks!
21
22
  -->
@@ -26,8 +27,8 @@ Thanks!
26
27
  Make sure that you've done all of these. To mark a checkbox done, replace [ ] with [x]. Or after you create the issue you can click the checkbox.
27
28
  -->
28
29
 
29
- - [ ] Upgrade Terraspace: Are you using the latest version of Terraspace? This allows Terraspace to fix issues fast.
30
- - [ ] Reproducibility: Are you reporting a bug others will be able to reproduce and not asking a question. If you're unsure or want to ask a question, do so on StackOverflow.
30
+ - [ ] Upgrade Terraspace: Are you using the latest version of Terraspace? This allows Terraspace to fix issues fast. There's an Upgrading Guide: https://terraspace.cloud/docs/misc/upgrading/
31
+ - [ ] Reproducibility: Are you reporting a bug others will be able to reproduce and not asking a question. If you're unsure or want to ask a question, do so on https://community.boltops.com
31
32
  - [ ] Code sample: Have you put together a code sample to reproduce the issue and make it available? Code samples help speed up fixes dramatically. If it's an easily reproducible issue, then code samples are not needed. If you're unsure, please include a code sample.
32
33
 
33
34
  ## My Environment
@@ -7,8 +7,8 @@ assignees: ''
7
7
 
8
8
  ---
9
9
 
10
- The Terraspace issue tracker IS NOT for usage questions! Please post your question at sites like StackOverflow.
10
+ The Terraspace issue tracker IS NOT for usage questions! Please post your question on our dedicated forum at https://community.boltops.com
11
11
 
12
12
  To be sensitive to everyone's time, we may close issues asking questions without comment. If you repeatedly post questions in the issues tracker, you may be blocked from ever submitting issues to Terraspace again. Please use your best judgment. 👍
13
13
 
14
- Here are some additional options also https://terraspace.cloud/support/ 😁
14
+ Posting your questions in the Terraspace community forum benefits others by grouping questions in a dedicated place. Here are some additional options also https://terraspace.cloud/support/ 😁
data/CHANGELOG.md CHANGED
@@ -3,6 +3,31 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
5
5
 
6
+ ## [0.6.0] - 2021-03-03
7
+ - Update README.md
8
+ - [#87](https://github.com/boltops-tools/terraspace/pull/87) rename cloud to tfc command and improvements
9
+ - [#88](https://github.com/boltops-tools/terraspace/pull/88) custom layering support
10
+ - Rename `terraspace cloud` to `terraspace tfc` and tfc improvements
11
+ - Improve stdout handling, so this works: `terraspace show demo --json | jq`
12
+ - `terraspace plan --output plan.save` writes to relative cache path.
13
+ - `terraspace up --plan plan.save` copies plan.save to cache path.
14
+ - Add state command. Initial simple version.
15
+
16
+ ## [0.5.12] - 2021-02-27
17
+ - [#79](https://github.com/boltops-tools/terraspace/pull/79) Fix syntax issue
18
+ - [#85](https://github.com/boltops-tools/terraspace/pull/85) Add all.include_stacks option and fix all.ignore_stacks option when building dependency graph
19
+
20
+ ## [0.5.11] - 2021-02-11
21
+ - [#76](https://github.com/boltops-tools/terraspace/pull/76) dont use auto generated plan when both yes and plan options used
22
+ - fix plan path when 2 stacks of same name run at the same time
23
+
24
+ ## [0.5.10] - 2020-12-11
25
+ - [#69](https://github.com/boltops-tools/terraspace/pull/69) require singleton earlier
26
+
27
+ ## [0.5.9] - 2020-12-11
28
+ - [#68](https://github.com/boltops-tools/terraspace/pull/68) require singleton
29
+ - fix graphviz check for format text, improve graphviz install help message
30
+
6
31
  ## [0.5.8] - 2020-12-04
7
32
  - [#67](https://github.com/boltops-tools/terraspace/pull/67) fix find placeholder stack so config/terraform only builds for stacks
8
33
 
@@ -93,7 +118,7 @@ This project *loosely tries* to adhere to [Semantic Versioning](http://semver.or
93
118
  * fix build for edge case when app/modules exist but app/stacks do not
94
119
  * terraspace new project: do not generate spec folder by default
95
120
  * improve all output summary
96
- * remove redundant `terraspace cloud setup`, instead use: `terraspace cloud sync`
121
+ * remove redundant `terraspace tfc setup`, instead use: `terraspace tfc sync`
97
122
  * improve terraspace info output
98
123
  * fix integration test pipeline
99
124
 
@@ -112,8 +137,8 @@ This project *loosely tries* to adhere to [Semantic Versioning](http://semver.or
112
137
  * Terraspace log: view and tail log files
113
138
  * Terraspace logs management commands: `terraspace logs truncate` and `terraspace logs remove`
114
139
  * TFC/TFE: Improve support. `config.cloud.vars`, `config.cloud.workspace.attrs`
115
- * TFC commands: terraspace cloud runs list, terraspace cloud runs prune
116
- * TFC VCS also sync as part of deploy. Also separate `terraspace cloud sync` command
140
+ * TFC commands: terraspace tfc runs list, terraspace tfc runs prune
141
+ * TFC VCS also sync as part of deploy. Also separate `terraspace tfc sync` command
117
142
  * Logger improvements: configurable formatter, log to stderr by default
118
143
  * Rename: `cloud.relative_root` to `cloud.working_dir_prefix`
119
144
  * Run a plan to capture the diff as part of `-y` option. IE: `terraspace up demo -y`
@@ -146,11 +171,11 @@ This project *loosely tries* to adhere to [Semantic Versioning](http://semver.or
146
171
  * New expander variables: TYPE_INSTANCE, INSTANCE, CACHE_ROOT. Also added strip trailing - and / behavior.
147
172
  * Timeout for terraform init. The default timeout is 10m and will then print out the terraform init log.
148
173
  * Terraspace 0.2.x is compatible with terraspace\_plugin_aws 0.2.x, terraspace\_plugin_google 0.2.x, and terraspace\_plugin_azurerm 0.2.x
149
- * New commands: terraspace list, terraspace cloud list, terraspace cloud setup, terraspace cloud destroy, terraspace new shim, terraspace new git_hook
174
+ * New commands: terraspace list, terraspace tfc list, terraspace tfc setup, terraspace tfc destroy, terraspace new shim, terraspace new git_hook
150
175
  * terraspace list: list of modules and stacks
151
- * terraspace cloud list: shows list of TFC workspaces
152
- * terraspace cloud setup: setups up TFC workspace for VCS-driven workflow. This automatically happens for the TFC CLI-driven workflow.
153
- * terraspace cloud destroy: destroys the TFC workspace associated with the stack. Can also use the `terraspace down demo --destroy-workspace` option.
176
+ * terraspace tfc list: shows list of TFC workspaces
177
+ * terraspace tfc setup: setups up TFC workspace for VCS-driven workflow. This automatically happens for the TFC CLI-driven workflow.
178
+ * terraspace tfc destroy: destroys the TFC workspace associated with the stack. Can also use the `terraspace down demo --destroy-workspace` option.
154
179
  * terraspace new shim: An quick way to generate a terraspace shim.
155
180
  * terraspace new git_hook: An quick way to set up a git pre-push hook for the TFC VCS-driven workflow.
156
181
  * terraspace down: works even if there's no app/stacks folder. A fake stack is built.
data/README.md CHANGED
@@ -10,6 +10,8 @@
10
10
 
11
11
  The Terraform Framework.
12
12
 
13
+ Please **watch/star** this repo to help grow and support the project.
14
+
13
15
  Official Docs Site: [terraspace.cloud](https://terraspace.cloud)
14
16
 
15
17
  Quick Start Demo:
data/lib/terraspace.rb CHANGED
@@ -19,6 +19,7 @@ require "memoist"
19
19
  require "rainbow/ext/string"
20
20
  require "render_me_pretty"
21
21
  require "set"
22
+ require "singleton"
22
23
  require "terraspace/ext"
23
24
  require "terraspace/version"
24
25
 
@@ -109,13 +109,12 @@ module Terraspace::All
109
109
 
110
110
  # Check if Graphiz is installed and prints a user friendly message if it is not installed.
111
111
  def check_graphviz!
112
+ return if @options[:format] == 'text'
113
+
112
114
  installed = system("type dot > /dev/null 2>&1") # dot is a command that is part of the graphviz package
113
115
  return if installed
114
116
  logger.error "ERROR: It appears that the Graphviz is not installed. Please install it to use the graph command.".color(:red)
115
- if RUBY_PLATFORM =~ /darwin/
116
- logger.error "You can install Graphviz with homebrew:"
117
- logger.error " brew install graphviz"
118
- end
117
+ install_instructions
119
118
  logger.info <<~EOL
120
119
  Also consider:
121
120
 
@@ -125,5 +124,23 @@ module Terraspace::All
125
124
  EOL
126
125
  exit 1
127
126
  end
127
+
128
+ def install_instructions
129
+ installer = if RUBY_PLATFORM =~ /darwin/
130
+ "brew"
131
+ elsif system("type yum > /dev/null 2>&1")
132
+ "yum"
133
+ elsif system("type apt-get > /dev/null 2>&1")
134
+ "apt-get"
135
+ end
136
+
137
+ return unless installer
138
+ logger.error <<~EOL
139
+ You can install Graphviz with:
140
+
141
+ #{installer} install graphviz
142
+
143
+ EOL
144
+ end
128
145
  end
129
146
  end
@@ -1,7 +1,9 @@
1
1
  module Terraspace
2
2
  class App
3
- include Singleton
3
+ extend Memoist
4
4
  include DslEvaluator
5
+ include Singleton
6
+ include Terraspace::Util::Logging
5
7
 
6
8
  attr_reader :config
7
9
  def initialize
@@ -9,15 +11,14 @@ module Terraspace
9
11
  end
10
12
 
11
13
  def defaults
12
- ts_logger = Logger.new(ENV['TS_LOG_PATH'] || $stderr)
13
-
14
14
  config = ActiveSupport::OrderedOptions.new
15
15
  config.all = ActiveSupport::OrderedOptions.new
16
16
  config.all.concurrency = 5
17
17
  config.all.exit_on_fail = ActiveSupport::OrderedOptions.new
18
18
  config.all.exit_on_fail.down = true
19
19
  config.all.exit_on_fail.up = true
20
- config.all.ignore_stacks = []
20
+ config.all.ignore_stacks = nil
21
+ config.all.include_stacks = nil
21
22
  config.allow = ActiveSupport::OrderedOptions.new
22
23
  config.allow.envs = nil
23
24
  config.allow.regions = nil
@@ -28,16 +29,6 @@ module Terraspace
28
29
  config.build.clean_cache = nil # defaults to /full/path/to/.terraspace-cache
29
30
  config.bundle = ActiveSupport::OrderedOptions.new
30
31
  config.bundle.logger = ts_logger
31
- config.cloud = ActiveSupport::OrderedOptions.new
32
- config.cloud.auto_sync = true
33
- config.cloud.hostname = nil
34
- config.cloud.vars = ActiveSupport::OrderedOptions.new
35
- config.cloud.vars.overwrite = true
36
- config.cloud.vars.overwrite_sensitive = true
37
- config.cloud.vars.show_message = "create"
38
- config.cloud.working_dir_prefix = nil
39
- config.cloud.workspace = ActiveSupport::OrderedOptions.new
40
- config.cloud.workspace.attrs = ActiveSupport::OrderedOptions.new
41
32
  config.hooks = Hooks.new
42
33
  config.init = ActiveSupport::OrderedOptions.new
43
34
  config.init.mode = "auto" # auto, never, always
@@ -46,22 +37,53 @@ module Terraspace
46
37
  config.logger = ts_logger
47
38
  config.logger.formatter = Logger::Formatter.new
48
39
  config.logger.level = ENV['TS_LOG_LEVEL'] || :info
40
+ config.layering = ActiveSupport::OrderedOptions.new
41
+ config.layering.names = {}
42
+ config.layering.enable_names = ActiveSupport::OrderedOptions.new
43
+ config.layering.enable_names.cache_dir = true
44
+ config.summary = ActiveSupport::OrderedOptions.new
45
+ config.summary.prune = false
49
46
  config.terraform = ActiveSupport::OrderedOptions.new
50
47
  config.terraform.plugin_cache = ActiveSupport::OrderedOptions.new
51
48
  config.terraform.plugin_cache.dir = ENV['TF_PLUGIN_CACHE_DIR'] || "#{Terraspace.tmp_root}/plugin_cache"
52
49
  config.terraform.plugin_cache.enabled = true
53
50
  config.terraform.plugin_cache.purge_on_error = true
54
51
  config.test_framework = "rspec"
52
+ config.tfc = ActiveSupport::OrderedOptions.new
53
+ config.tfc.auto_sync = true
54
+ config.tfc.hostname = nil
55
+ config.tfc.vars = ActiveSupport::OrderedOptions.new
56
+ config.tfc.vars.overwrite = true
57
+ config.tfc.vars.overwrite_sensitive = true
58
+ config.tfc.vars.show_message = "create"
59
+ config.tfc.working_dir_prefix = nil
60
+ config.tfc.workspace = ActiveSupport::OrderedOptions.new
61
+ config.tfc.workspace.attrs = ActiveSupport::OrderedOptions.new
55
62
  config
56
63
  end
57
64
 
65
+ def ts_logger
66
+ Logger.new(ENV['TS_LOG_PATH'] || $stderr)
67
+ end
68
+ memoize :ts_logger
69
+
58
70
  def configure
59
71
  yield(@config)
60
72
  end
61
73
 
62
74
  def load_project_config
63
75
  evaluate_file("#{Terraspace.root}/config/app.rb")
76
+
77
+ # deprecated config/env for config/envs
64
78
  path = "#{Terraspace.root}/config/env/#{Terraspace.env}.rb"
79
+ if File.exist?(path)
80
+ # so early on in the boot process that logger.info is unavailable, use ts_logger which is available and same thing.
81
+ ts_logger.info "DEPRECATED: Please rename config/env to config/envs. IE:".color(:yellow)
82
+ ts_logger.info " mv config/env config/envs"
83
+ evaluate_file(path)
84
+ end
85
+
86
+ path = "#{Terraspace.root}/config/envs/#{Terraspace.env}.rb"
65
87
  evaluate_file(path)
66
88
  end
67
89
  end
@@ -0,0 +1,13 @@
1
+ class Terraspace::App
2
+ class Inits
3
+ class << self
4
+ include DslEvaluator
5
+
6
+ def run_all
7
+ Dir.glob("#{Terraspace.root}/config/inits/*.rb").each do |path|
8
+ evaluate_file(path)
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -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
+ Terraspace::App::Inits.run_all
8
9
  set_plugin_cache!
9
10
  end
10
11
 
@@ -10,7 +10,7 @@ module Terraspace
10
10
  option :format, desc: "output formats: json, text"
11
11
  }
12
12
  out_option = Proc.new {
13
- option :out, aliases: :o, desc: "write the output to path"
13
+ option :out, aliases: :o, desc: "Write the output to path"
14
14
  }
15
15
  input_option = Proc.new {
16
16
  option :input, type: :boolean, desc: "Ask for input for variables if not directly set."
@@ -36,14 +36,14 @@ module Terraspace
36
36
  long_desc Help.text(:clean)
37
37
  subcommand "clean", Clean
38
38
 
39
- desc "cloud SUBCOMMAND", "cloud subcommands"
40
- long_desc Help.text(:cloud)
41
- subcommand "cloud", Cloud
42
-
43
39
  desc "new SUBCOMMAND", "new subcommands"
44
40
  long_desc Help.text(:new)
45
41
  subcommand "new", New
46
42
 
43
+ desc "tfc SUBCOMMAND", "tfc subcommands"
44
+ long_desc Help.text(:tfc)
45
+ subcommand "tfc", Tfc
46
+
47
47
  desc "build [STACK]", "Build project."
48
48
  long_desc Help.text(:build)
49
49
  option :quiet, type: :boolean, desc: "quiet output"
@@ -123,6 +123,7 @@ module Terraspace
123
123
  instance_option.call
124
124
  out_option.call
125
125
  reconfigure_option.call
126
+ option :copy_to_root, type: :boolean, default: true, desc: "Copy plan file generated in the cache folder back to project root"
126
127
  def plan(mod)
127
128
  Commander.new("plan", options.merge(mod: mod)).run
128
129
  end
@@ -144,7 +145,7 @@ module Terraspace
144
145
  desc "seed STACK", "Build starer seed tfvars file."
145
146
  long_desc Help.text(:seed)
146
147
  option :yes, aliases: :y, type: :boolean, desc: "bypass prompts and force overwrite files"
147
- option :where, desc: "where to create file. either under app or seed folder structure. values: app or stack"
148
+ option :where, desc: "where to create file. either under app or seed folder structure. values: seed or stack"
148
149
  init_option.call
149
150
  instance_option.call
150
151
  def seed(mod)
@@ -169,6 +170,12 @@ module Terraspace
169
170
  Commander.new("show", options.merge(mod: mod)).run
170
171
  end
171
172
 
173
+ desc "state SUBCOMMAND STACK", "Run state."
174
+ long_desc Help.text(:state)
175
+ def state(subcommand, mod)
176
+ State.new(options.merge(subcommand: subcommand, mod: mod)).run
177
+ end
178
+
172
179
  desc "test", "Run test."
173
180
  long_desc Help.text(:test)
174
181
  def test
@@ -26,7 +26,12 @@ module Terraspace::CLI::Build
26
26
 
27
27
  # Used by: terraspace build placeholder
28
28
  def find_stack
29
- mod_path = Dir.glob("{app,vendor}/{stacks}/*").last
29
+ stack_paths = Dir.glob("{app,vendor}/stacks/*")
30
+ stack_paths.select! do |path|
31
+ select = Terraspace::Compiler::Select.new(path)
32
+ select.selected?
33
+ end
34
+ mod_path = stack_paths.last
30
35
  unless mod_path
31
36
  logger.info "No stacks found."
32
37
  exit 0
@@ -7,7 +7,7 @@ class Terraspace::CLI
7
7
 
8
8
  def run
9
9
  Terraspace::Builder.new(@options).run unless @options[:build] # Up already ran build
10
- Init.new(@options.merge(calling_command: @name)).run
10
+ Init.new(@options).run
11
11
  Terraspace::Terraform::Runner.new(@name, @options).run
12
12
  end
13
13
  end
@@ -14,7 +14,7 @@ class Terraspace::CLI
14
14
 
15
15
  def destroy
16
16
  Commander.new("destroy", @options.merge(command: "down")).run
17
- Terraspace::Terraform::Cloud::Workspace.new(@options).destroy if @options[:destroy_workspace]
17
+ Terraspace::Terraform::Tfc::Workspace.new(@options).destroy if @options[:destroy_workspace]
18
18
  end
19
19
  end
20
20
  end
@@ -1,6 +1,6 @@
1
1
  ## Example
2
2
 
3
- $ terraspace cloud destroy demo
3
+ $ terraspace tfc destroy demo
4
4
  You are about to delete the workspace: demo-dev-us-west-2
5
5
  All variables, settings, run history, and state history will be removed.
6
6
  This cannot be undone.
@@ -1,6 +1,6 @@
1
1
  ## Example
2
2
 
3
- $ terraspace cloud list
3
+ $ terraspace tfc list
4
4
  Workspaces for boltops:
5
5
  demo-dev-us-west-2
6
6
  demo2-dev-us-west-2
@@ -2,7 +2,7 @@
2
2
 
3
3
  Statuses of pending and planned are shown by default.
4
4
 
5
- $ terraspace cloud runs list demo
5
+ $ terraspace tfc runs list demo
6
6
  +----------------------+---------+---------------------------------+---------------------+
7
7
  | Id | Status | Message | Created At |
8
8
  +----------------------+---------+---------------------------------+---------------------+
@@ -13,7 +13,7 @@ Statuses of pending and planned are shown by default.
13
13
 
14
14
  To see all most recent runs, use `--status all`.
15
15
 
16
- $ terraspace cloud runs list demo --status all
16
+ $ terraspace tfc runs list demo --status all
17
17
  +----------------------+-----------+--------------------------------+---------------------+
18
18
  | Id | Status | Message | Created At |
19
19
  +----------------------+-----------+--------------------------------+---------------------+
@@ -26,7 +26,7 @@ To see all most recent runs, use `--status all`.
26
26
 
27
27
  You can provide a list of statuses to the `--status` filter option.
28
28
 
29
- $ terraspace cloud runs list demo --status canceled discarded
29
+ $ terraspace tfc runs list demo --status canceled discarded
30
30
  +----------------------+-----------+--------------------------------+---------------------+
31
31
  | Id | Status | Message | Created At |
32
32
  +----------------------+-----------+--------------------------------+---------------------+