terraspace 0.5.12 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -7
- data/README.md +2 -0
- data/lib/terraspace/app.rb +34 -13
- data/lib/terraspace/app/inits.rb +13 -0
- data/lib/terraspace/booter.rb +1 -0
- data/lib/terraspace/cli.rb +12 -5
- data/lib/terraspace/cli/commander.rb +1 -1
- data/lib/terraspace/cli/down.rb +1 -1
- data/lib/terraspace/cli/help/{cloud → tfc}/destroy.md +1 -1
- data/lib/terraspace/cli/help/{cloud → tfc}/list.md +1 -1
- data/lib/terraspace/cli/help/{cloud → tfc}/runs/list.md +3 -3
- data/lib/terraspace/cli/help/{cloud → tfc}/runs/prune.md +3 -3
- data/lib/terraspace/cli/help/{cloud → tfc}/sync.md +3 -3
- data/lib/terraspace/cli/init.rb +21 -8
- data/lib/terraspace/cli/state.rb +10 -0
- data/lib/terraspace/cli/{cloud.rb → tfc.rb} +3 -3
- data/lib/terraspace/cli/{cloud → tfc}/runs.rb +4 -4
- data/lib/terraspace/compiler/builder.rb +2 -0
- data/lib/terraspace/compiler/strategy/tfvar.rb +16 -4
- data/lib/terraspace/compiler/strategy/tfvar/layer.rb +75 -52
- data/lib/terraspace/layering.rb +24 -0
- data/lib/terraspace/logger.rb +8 -1
- data/lib/terraspace/mod.rb +18 -3
- data/lib/terraspace/plugin/expander/friendly.rb +10 -0
- data/lib/terraspace/plugin/expander/interface.rb +6 -1
- data/lib/terraspace/plugin/summary/interface.rb +1 -1
- data/lib/terraspace/shell.rb +16 -1
- data/lib/terraspace/terraform/api/runs.rb +13 -2
- data/lib/terraspace/terraform/api/token.rb +2 -2
- data/lib/terraspace/terraform/api/var.rb +1 -1
- data/lib/terraspace/terraform/api/vars.rb +1 -1
- data/lib/terraspace/terraform/api/vars/base.rb +2 -0
- data/lib/terraspace/terraform/api/vars/json.rb +13 -1
- data/lib/terraspace/terraform/api/workspace.rb +10 -3
- data/lib/terraspace/terraform/args/default.rb +23 -13
- data/lib/terraspace/terraform/ihooks/after/plan.rb +17 -0
- data/lib/terraspace/terraform/ihooks/base.rb +8 -0
- data/lib/terraspace/terraform/ihooks/before/plan.rb +14 -0
- data/lib/terraspace/terraform/remote_state/fetcher.rb +1 -1
- data/lib/terraspace/terraform/runner.rb +12 -0
- data/lib/terraspace/terraform/{cloud → tfc}/runs.rb +1 -1
- data/lib/terraspace/terraform/{cloud → tfc}/runs/base.rb +1 -1
- data/lib/terraspace/terraform/{cloud → tfc}/runs/item_presenter.rb +1 -1
- data/lib/terraspace/terraform/{cloud → tfc}/runs/lister.rb +1 -1
- data/lib/terraspace/terraform/{cloud → tfc}/runs/pruner.rb +1 -1
- data/lib/terraspace/terraform/{cloud → tfc}/sync.rb +2 -2
- data/lib/terraspace/terraform/{cloud → tfc}/syncer.rb +1 -1
- data/lib/terraspace/terraform/{cloud → tfc}/workspace.rb +2 -3
- data/lib/terraspace/util/pretty.rb +2 -1
- data/lib/terraspace/version.rb +1 -1
- metadata +24 -17
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5e6515cd30855a02e17147354db57995da471812f6437611140f715726268bb6
|
|
4
|
+
data.tar.gz: 33a4066b1a30d091fe7881bbafccc0778f47715d6bea7671ba9f011e1f3702a5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6b3b7c108ac28b8cf83c4cde07ed64f4fc84d8109bc77c5b1ddaa3018e70393e9cb57cbc7fc65315e7877e55833bd434695753ed8cb71b31bb249a440c96c910
|
|
7
|
+
data.tar.gz: 3b85a43ae356e6c95def1ab614ef86af19e3c875752d265a5de55ada4f66b12830d514d2655841f973690b449d8fc38f610ac6b146ba943e3d37d72694e86d79
|
data/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
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
|
+
|
|
6
16
|
## [0.5.12] - 2021-02-27
|
|
7
17
|
- [#79](https://github.com/boltops-tools/terraspace/pull/79) Fix syntax issue
|
|
8
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
|
|
@@ -108,7 +118,7 @@ This project *loosely tries* to adhere to [Semantic Versioning](http://semver.or
|
|
|
108
118
|
* fix build for edge case when app/modules exist but app/stacks do not
|
|
109
119
|
* terraspace new project: do not generate spec folder by default
|
|
110
120
|
* improve all output summary
|
|
111
|
-
* remove redundant `terraspace
|
|
121
|
+
* remove redundant `terraspace tfc setup`, instead use: `terraspace tfc sync`
|
|
112
122
|
* improve terraspace info output
|
|
113
123
|
* fix integration test pipeline
|
|
114
124
|
|
|
@@ -127,8 +137,8 @@ This project *loosely tries* to adhere to [Semantic Versioning](http://semver.or
|
|
|
127
137
|
* Terraspace log: view and tail log files
|
|
128
138
|
* Terraspace logs management commands: `terraspace logs truncate` and `terraspace logs remove`
|
|
129
139
|
* TFC/TFE: Improve support. `config.cloud.vars`, `config.cloud.workspace.attrs`
|
|
130
|
-
* TFC commands: terraspace
|
|
131
|
-
* TFC VCS also sync as part of deploy. Also separate `terraspace
|
|
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
|
|
132
142
|
* Logger improvements: configurable formatter, log to stderr by default
|
|
133
143
|
* Rename: `cloud.relative_root` to `cloud.working_dir_prefix`
|
|
134
144
|
* Run a plan to capture the diff as part of `-y` option. IE: `terraspace up demo -y`
|
|
@@ -161,11 +171,11 @@ This project *loosely tries* to adhere to [Semantic Versioning](http://semver.or
|
|
|
161
171
|
* New expander variables: TYPE_INSTANCE, INSTANCE, CACHE_ROOT. Also added strip trailing - and / behavior.
|
|
162
172
|
* Timeout for terraform init. The default timeout is 10m and will then print out the terraform init log.
|
|
163
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
|
|
164
|
-
* New commands: terraspace list, terraspace
|
|
174
|
+
* New commands: terraspace list, terraspace tfc list, terraspace tfc setup, terraspace tfc destroy, terraspace new shim, terraspace new git_hook
|
|
165
175
|
* terraspace list: list of modules and stacks
|
|
166
|
-
* terraspace
|
|
167
|
-
* terraspace
|
|
168
|
-
* terraspace
|
|
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.
|
|
169
179
|
* terraspace new shim: An quick way to generate a terraspace shim.
|
|
170
180
|
* terraspace new git_hook: An quick way to set up a git pre-push hook for the TFC VCS-driven workflow.
|
|
171
181
|
* terraspace down: works even if there's no app/stacks folder. A fake stack is built.
|
data/README.md
CHANGED
data/lib/terraspace/app.rb
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
module Terraspace
|
|
2
2
|
class App
|
|
3
|
-
|
|
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,8 +11,6 @@ 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
|
|
@@ -29,16 +29,6 @@ module Terraspace
|
|
|
29
29
|
config.build.clean_cache = nil # defaults to /full/path/to/.terraspace-cache
|
|
30
30
|
config.bundle = ActiveSupport::OrderedOptions.new
|
|
31
31
|
config.bundle.logger = ts_logger
|
|
32
|
-
config.cloud = ActiveSupport::OrderedOptions.new
|
|
33
|
-
config.cloud.auto_sync = true
|
|
34
|
-
config.cloud.hostname = nil
|
|
35
|
-
config.cloud.vars = ActiveSupport::OrderedOptions.new
|
|
36
|
-
config.cloud.vars.overwrite = true
|
|
37
|
-
config.cloud.vars.overwrite_sensitive = true
|
|
38
|
-
config.cloud.vars.show_message = "create"
|
|
39
|
-
config.cloud.working_dir_prefix = nil
|
|
40
|
-
config.cloud.workspace = ActiveSupport::OrderedOptions.new
|
|
41
|
-
config.cloud.workspace.attrs = ActiveSupport::OrderedOptions.new
|
|
42
32
|
config.hooks = Hooks.new
|
|
43
33
|
config.init = ActiveSupport::OrderedOptions.new
|
|
44
34
|
config.init.mode = "auto" # auto, never, always
|
|
@@ -47,22 +37,53 @@ module Terraspace
|
|
|
47
37
|
config.logger = ts_logger
|
|
48
38
|
config.logger.formatter = Logger::Formatter.new
|
|
49
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
|
|
50
46
|
config.terraform = ActiveSupport::OrderedOptions.new
|
|
51
47
|
config.terraform.plugin_cache = ActiveSupport::OrderedOptions.new
|
|
52
48
|
config.terraform.plugin_cache.dir = ENV['TF_PLUGIN_CACHE_DIR'] || "#{Terraspace.tmp_root}/plugin_cache"
|
|
53
49
|
config.terraform.plugin_cache.enabled = true
|
|
54
50
|
config.terraform.plugin_cache.purge_on_error = true
|
|
55
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
|
|
56
62
|
config
|
|
57
63
|
end
|
|
58
64
|
|
|
65
|
+
def ts_logger
|
|
66
|
+
Logger.new(ENV['TS_LOG_PATH'] || $stderr)
|
|
67
|
+
end
|
|
68
|
+
memoize :ts_logger
|
|
69
|
+
|
|
59
70
|
def configure
|
|
60
71
|
yield(@config)
|
|
61
72
|
end
|
|
62
73
|
|
|
63
74
|
def load_project_config
|
|
64
75
|
evaluate_file("#{Terraspace.root}/config/app.rb")
|
|
76
|
+
|
|
77
|
+
# deprecated config/env for config/envs
|
|
65
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"
|
|
66
87
|
evaluate_file(path)
|
|
67
88
|
end
|
|
68
89
|
end
|
data/lib/terraspace/booter.rb
CHANGED
data/lib/terraspace/cli.rb
CHANGED
|
@@ -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: "
|
|
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
|
|
@@ -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
|
|
@@ -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
|
|
10
|
+
Init.new(@options).run
|
|
11
11
|
Terraspace::Terraform::Runner.new(@name, @options).run
|
|
12
12
|
end
|
|
13
13
|
end
|
data/lib/terraspace/cli/down.rb
CHANGED
|
@@ -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::
|
|
17
|
+
Terraspace::Terraform::Tfc::Workspace.new(@options).destroy if @options[:destroy_workspace]
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
20
|
end
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Statuses of pending and planned are shown by default.
|
|
4
4
|
|
|
5
|
-
$ terraspace
|
|
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
|
|
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
|
|
29
|
+
$ terraspace tfc runs list demo --status canceled discarded
|
|
30
30
|
+----------------------+-----------+--------------------------------+---------------------+
|
|
31
31
|
| Id | Status | Message | Created At |
|
|
32
32
|
+----------------------+-----------+--------------------------------+---------------------+
|
|
@@ -2,12 +2,12 @@ This leaves the top run alone. The top run usually starts immediately planning o
|
|
|
2
2
|
|
|
3
3
|
## Examples
|
|
4
4
|
|
|
5
|
-
terraspace
|
|
6
|
-
terraspace
|
|
5
|
+
terraspace tfc runs prune demo --noop
|
|
6
|
+
terraspace tfc runs prune demo # live run
|
|
7
7
|
|
|
8
8
|
## Example with Output
|
|
9
9
|
|
|
10
|
-
$ terraspace
|
|
10
|
+
$ terraspace tfc runs prune demo
|
|
11
11
|
Will keep:
|
|
12
12
|
|
|
13
13
|
run-9muMrjrd22vhsP4u pending test 2020-09-18T12:47:11
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Sync all stacks:
|
|
4
4
|
|
|
5
|
-
$ terraspace
|
|
5
|
+
$ terraspace tfc sync
|
|
6
6
|
About to sync these project stacks with Terraform Cloud workspaces:
|
|
7
7
|
|
|
8
8
|
Stack => Workspace
|
|
@@ -22,7 +22,7 @@ Sync all stacks:
|
|
|
22
22
|
|
|
23
23
|
Sync specific stacks:
|
|
24
24
|
|
|
25
|
-
$ terraspace
|
|
25
|
+
$ terraspace tfc sync demo
|
|
26
26
|
About to sync these project stacks with Terraform Cloud workspaces:
|
|
27
27
|
|
|
28
28
|
Stack => Workspace
|
|
@@ -40,4 +40,4 @@ Sync specific stacks:
|
|
|
40
40
|
|
|
41
41
|
Can also specify multiple stacks:
|
|
42
42
|
|
|
43
|
-
terraspace
|
|
43
|
+
terraspace tfc sync demo demo2
|
data/lib/terraspace/cli/init.rb
CHANGED
|
@@ -3,10 +3,9 @@ require 'timeout'
|
|
|
3
3
|
class Terraspace::CLI
|
|
4
4
|
class Init < Base
|
|
5
5
|
def initialize(options={})
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
|
|
9
|
-
super(options)
|
|
6
|
+
# terraform init output goes to default Terraspace.logger.info which is stderr
|
|
7
|
+
# Unless the logger has been overridden.
|
|
8
|
+
super(options.merge(log_to_stderr: true))
|
|
10
9
|
end
|
|
11
10
|
|
|
12
11
|
def run
|
|
@@ -29,7 +28,11 @@ class Terraspace::CLI
|
|
|
29
28
|
end
|
|
30
29
|
|
|
31
30
|
def sync_cloud
|
|
32
|
-
Terraspace::Terraform::
|
|
31
|
+
Terraspace::Terraform::Tfc::Sync.new(@options).run if sync_cloud?
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def sync_cloud?
|
|
35
|
+
%w[apply down plan up].include?(calling_command)
|
|
33
36
|
end
|
|
34
37
|
|
|
35
38
|
# Currently only handles remote modules only one-level deep.
|
|
@@ -54,16 +57,21 @@ class Terraspace::CLI
|
|
|
54
57
|
|
|
55
58
|
def auto?
|
|
56
59
|
# command is only passed from CLI in the update specifically for this check
|
|
57
|
-
@options[:auto] &&
|
|
60
|
+
@options[:auto] && calling_command == "up"
|
|
58
61
|
end
|
|
59
62
|
private
|
|
60
63
|
def local_source?(s)
|
|
61
64
|
s =~ %r{^\.} || s =~ %r{^/}
|
|
62
65
|
end
|
|
63
66
|
|
|
67
|
+
def auto_init?
|
|
68
|
+
# terraspace commands not terraform commands. included some extra terraform commands here in case terrapace adds those later
|
|
69
|
+
commands = %w[all apply console down output plan providers refresh show state up validate]
|
|
70
|
+
commands.include?(calling_command)
|
|
71
|
+
end
|
|
72
|
+
|
|
64
73
|
def run_init?
|
|
65
|
-
|
|
66
|
-
return false unless commands.include?(@calling_command)
|
|
74
|
+
return false unless auto_init?
|
|
67
75
|
mode = ENV['TS_INIT_MODE'] || Terraspace.config.init.mode
|
|
68
76
|
case mode.to_sym
|
|
69
77
|
when :auto
|
|
@@ -87,5 +95,10 @@ class Terraspace::CLI
|
|
|
87
95
|
end
|
|
88
96
|
!!provider
|
|
89
97
|
end
|
|
98
|
+
|
|
99
|
+
# only top level command considered
|
|
100
|
+
def calling_command
|
|
101
|
+
ARGV[0]
|
|
102
|
+
end
|
|
90
103
|
end
|
|
91
104
|
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
class Terraspace::CLI
|
|
2
|
+
class State < Base
|
|
3
|
+
def run
|
|
4
|
+
@name = "state #{@options[:subcommand]}" # command name. IE: state list
|
|
5
|
+
Terraspace::Builder.new(@options).run
|
|
6
|
+
Init.new(@options).run
|
|
7
|
+
Terraspace::Terraform::Runner.new(@name, @options).run
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
class Terraspace::CLI
|
|
2
|
-
class
|
|
3
|
-
Syncer = Terraspace::Terraform::
|
|
4
|
-
Workspace = Terraspace::Terraform::
|
|
2
|
+
class Tfc < Terraspace::Command
|
|
3
|
+
Syncer = Terraspace::Terraform::Tfc::Syncer
|
|
4
|
+
Workspace = Terraspace::Terraform::Tfc::Workspace
|
|
5
5
|
|
|
6
6
|
yes_option = Proc.new {
|
|
7
7
|
option :yes, aliases: :y, type: :boolean, desc: "bypass are you sure prompt"
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
class Terraspace::CLI::
|
|
1
|
+
class Terraspace::CLI::Tfc
|
|
2
2
|
class Runs < Terraspace::Command
|
|
3
3
|
Help = Terraspace::CLI::Help
|
|
4
|
-
Runs = Terraspace::Terraform::
|
|
4
|
+
Runs = Terraspace::Terraform::Tfc::Runs
|
|
5
5
|
|
|
6
6
|
desc "list STACK", "List runs."
|
|
7
|
-
long_desc Help.text("
|
|
7
|
+
long_desc Help.text("tfc:runs:list")
|
|
8
8
|
option :format, desc: "Output formats: #{CliFormat.formats.join(', ')}"
|
|
9
9
|
option :status, default: %w[pending planned], type: :array, desc: "Filter by statuses: pending, planned, all"
|
|
10
10
|
def list(mod)
|
|
@@ -12,7 +12,7 @@ class Terraspace::CLI::Cloud
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
desc "prune STACK", "Prune runs that are possible to cancel or discard."
|
|
15
|
-
long_desc Help.text("
|
|
15
|
+
long_desc Help.text("tfc:runs:prune")
|
|
16
16
|
option :noop, type: :boolean, desc: "Shows what would be cancelled/discarded."
|
|
17
17
|
option :yes, aliases: :y, type: :boolean, desc: "bypass are you sure prompt"
|
|
18
18
|
def prune(mod)
|