terraspace 0.3.3 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.cody/aws/bin/build.sh +2 -0
- data/.cody/azurerm/bin/build.sh +2 -0
- data/.cody/google/bin/build.sh +2 -0
- data/CHANGELOG.md +39 -0
- data/README.md +1 -1
- data/lib/templates/base/project/README.md +1 -1
- data/lib/terraspace.rb +1 -0
- data/lib/terraspace/all/preview.rb +1 -1
- data/lib/terraspace/all/runner.rb +1 -0
- data/lib/terraspace/all/summary.rb +29 -2
- data/lib/terraspace/app.rb +9 -5
- data/lib/terraspace/builder.rb +10 -6
- data/lib/terraspace/cli.rb +33 -39
- data/lib/terraspace/cli/all.rb +15 -9
- data/lib/terraspace/cli/bundle.rb +2 -1
- data/lib/terraspace/cli/clean.rb +18 -6
- data/lib/terraspace/cli/clean/all.rb +18 -0
- data/lib/terraspace/cli/clean/base.rb +15 -0
- data/lib/terraspace/cli/clean/cache.rb +25 -0
- data/lib/terraspace/cli/{logs/tasks.rb → clean/logs.rb} +16 -5
- data/lib/terraspace/cli/cloud.rb +3 -9
- data/lib/terraspace/cli/cloud/runs.rb +0 -2
- data/lib/terraspace/cli/help/all/down.md +32 -0
- data/lib/terraspace/cli/help/all/graph.md +21 -0
- data/lib/terraspace/cli/help/all/init.md +33 -0
- data/lib/terraspace/cli/help/all/output.md +22 -0
- data/lib/terraspace/cli/help/all/plan.md +25 -0
- data/lib/terraspace/cli/help/all/providers.md +21 -0
- data/lib/terraspace/cli/help/all/refresh.md +17 -0
- data/lib/terraspace/cli/help/all/show.md +21 -0
- data/lib/terraspace/cli/help/all/up.md +27 -0
- data/lib/terraspace/cli/help/all/validate.md +21 -0
- data/lib/terraspace/cli/help/build.md +6 -0
- data/lib/terraspace/cli/help/bundle.md +9 -5
- data/lib/terraspace/cli/help/check_setup.md +9 -0
- data/lib/terraspace/cli/help/clean/all.md +10 -0
- data/lib/terraspace/cli/help/clean/cache.md +12 -0
- data/lib/terraspace/cli/help/clean/logs.md +17 -0
- data/lib/terraspace/cli/help/cloud/destroy.md +16 -0
- data/lib/terraspace/cli/help/cloud/list.md +7 -0
- data/lib/terraspace/cli/help/cloud/runs/list.md +3 -3
- data/lib/terraspace/cli/help/cloud/runs/prune.md +1 -1
- data/lib/terraspace/cli/help/cloud/sync.md +26 -2
- data/lib/terraspace/cli/help/console.md +8 -0
- data/lib/terraspace/cli/help/down.md +26 -0
- data/lib/terraspace/cli/help/info.md +43 -0
- data/lib/terraspace/cli/help/init.md +37 -0
- data/lib/terraspace/cli/help/list.md +20 -0
- data/lib/terraspace/cli/help/logs.md +48 -0
- data/lib/terraspace/cli/help/logs/remove.md +5 -0
- data/lib/terraspace/cli/help/logs/truncate.md +5 -0
- data/lib/terraspace/cli/help/new/bootstrap_test.md +8 -0
- data/lib/terraspace/cli/help/new/example.md +8 -0
- data/lib/terraspace/cli/help/new/git_hook.md +6 -0
- data/lib/terraspace/cli/help/new/module.md +9 -0
- data/lib/terraspace/cli/help/new/module_test.md +12 -0
- data/lib/terraspace/cli/help/new/plugin.md +49 -0
- data/lib/terraspace/cli/help/new/project.md +40 -0
- data/lib/terraspace/cli/help/new/project_test.md +8 -0
- data/lib/terraspace/cli/help/new/shim.md +21 -0
- data/lib/terraspace/cli/help/new/stack.md +9 -0
- data/lib/terraspace/cli/help/output.md +6 -0
- data/lib/terraspace/cli/help/plan.md +29 -0
- data/lib/terraspace/cli/help/providers.md +18 -0
- data/lib/terraspace/cli/help/refresh.md +11 -0
- data/lib/terraspace/cli/help/seed.md +7 -0
- data/lib/terraspace/cli/help/show.md +36 -0
- data/lib/terraspace/cli/help/summary.md +11 -0
- data/lib/terraspace/cli/help/test.md +35 -0
- data/lib/terraspace/cli/help/up.md +30 -0
- data/lib/terraspace/cli/help/validate.md +9 -0
- data/lib/terraspace/cli/info.rb +4 -16
- data/lib/terraspace/cli/init.rb +3 -7
- data/lib/terraspace/cli/list.rb +2 -1
- data/lib/terraspace/cli/logs.rb +106 -9
- data/lib/terraspace/cli/{log → logs}/concern.rb +1 -1
- data/lib/terraspace/cli/new.rb +18 -18
- data/lib/terraspace/cli/new/git_hook.rb +4 -1
- data/lib/terraspace/cli/new/helper.rb +9 -2
- data/lib/terraspace/cli/new/project.rb +1 -1
- data/lib/terraspace/cli/summary.rb +2 -2
- data/lib/terraspace/command.rb +1 -1
- data/lib/terraspace/compiler/dependencies/helpers.rb +34 -0
- data/lib/terraspace/compiler/dsl/syntax/helpers/common.rb +0 -26
- data/lib/terraspace/compiler/dsl/syntax/tfvar.rb +1 -0
- data/lib/terraspace/compiler/erb/context.rb +1 -1
- data/lib/terraspace/compiler/erb/helpers.rb +6 -0
- data/lib/terraspace/dependency/graph.rb +2 -1
- data/lib/terraspace/dependency/helper/base.rb +7 -0
- data/lib/terraspace/dependency/helper/depends_on.rb +12 -0
- data/lib/terraspace/dependency/helper/output.rb +11 -0
- data/lib/terraspace/hooks/builder.rb +52 -0
- data/lib/terraspace/hooks/concern.rb +9 -0
- data/lib/terraspace/{terraform/hooks → hooks}/dsl.rb +3 -2
- data/lib/terraspace/hooks/runner.rb +23 -0
- data/lib/terraspace/mod.rb +11 -2
- data/lib/terraspace/plugin/summary/interface.rb +4 -2
- data/lib/terraspace/shell.rb +29 -14
- data/lib/terraspace/terraform/args/custom.rb +1 -1
- data/lib/terraspace/terraform/cloud/runs/lister.rb +0 -2
- data/lib/terraspace/terraform/cloud/syncer.rb +2 -2
- data/lib/terraspace/terraform/cloud/workspace.rb +0 -9
- data/lib/terraspace/terraform/remote_state/fetcher.rb +13 -4
- data/lib/terraspace/terraform/remote_state/marker/output.rb +3 -1
- data/lib/terraspace/terraform/remote_state/output_proxy.rb +18 -14
- data/lib/terraspace/terraform/remote_state/unresolved.rb +40 -0
- data/lib/terraspace/terraform/runner.rb +2 -7
- data/lib/terraspace/version.rb +1 -1
- data/spec/fixtures/dependencies/app/stacks/a1/tfvars/dev.tfvars +1 -0
- data/spec/fixtures/fetcher/c1.json +4 -0
- data/spec/terraspace/all/summary_spec.rb +1 -1
- data/spec/terraspace/compiler/erb/render_spec.rb +15 -0
- data/spec/terraspace/dependency/helper/depends_on_spec.rb +27 -0
- data/spec/terraspace/dependency/helper/output_spec.rb +29 -0
- data/spec/terraspace/{terraform/hooks → hooks}/builder_spec.rb +4 -5
- data/spec/terraspace/terraform/remote_state/fetcher_spec.rb +108 -27
- data/spec/terraspace/terraform/remote_state/marker/output_spec.rb +36 -0
- data/spec/terraspace/terraform/remote_state/output_proxy_spec.rb +69 -0
- data/terraspace.gemspec +1 -1
- metadata +78 -13
- data/lib/terraspace/cli/help/log.md +0 -46
- data/lib/terraspace/cli/help/update.md +0 -5
- data/lib/terraspace/cli/log.rb +0 -112
- data/lib/terraspace/terraform/hooks/builder.rb +0 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ec0e35f7878a3c4b0b7b1f2b12707f76bfbf6e81b47e04c50822cedd9e9baf1
|
4
|
+
data.tar.gz: 055d46279e41f268502ed3d0035ef0d3c28d5a03027810a628e5a5c51b4aec77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cea499e91524e6b151bd3e9773fd9c41fa9c586b49d6c084e6b286b81e34b1f76838d9eb8a1adb6fc4aea8095ab047269f27e53ca30b6cc7ba0f6bb69204f44
|
7
|
+
data.tar.gz: ce9291d9769eca58a5e9debb70a8721d9bb2e2897096fd089898f56ae7f793f5300e830b4ee2306a9f74e25f7248c8748e954f8dc33c2de42884e31e615fb61d
|
data/.cody/aws/bin/build.sh
CHANGED
data/.cody/azurerm/bin/build.sh
CHANGED
@@ -17,4 +17,6 @@ export ARM_TENANT_ID=$(cat ~/.azure/app-client.json | jq -r '.tenant_id')
|
|
17
17
|
set -x
|
18
18
|
terraspace new project infra --examples --plugin azurerm
|
19
19
|
cd infra
|
20
|
+
terraspace new bootstrap_test
|
21
|
+
terraspace new project_test demo --examples --plugin azurerm
|
20
22
|
terraspace test
|
data/.cody/google/bin/build.sh
CHANGED
@@ -14,4 +14,6 @@ export GOOGLE_PROJECT=$(cat $GOOGLE_APPLICATION_CREDENTIALS | jq -r '.project_id
|
|
14
14
|
set -x
|
15
15
|
terraspace new project infra --examples --plugin google
|
16
16
|
cd infra
|
17
|
+
terraspace new bootstrap_test
|
18
|
+
terraspace new project_test demo --examples --plugin google
|
17
19
|
terraspace test
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,45 @@
|
|
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.4.1]
|
7
|
+
* #47 `terraspace list` fix and `terraspace all init` help updates
|
8
|
+
|
9
|
+
## [0.4.0]
|
10
|
+
* #46 improve hooks, bundle, auto init and bug fixes
|
11
|
+
* improve hooks: allow multiple hooks of same type, change path hooks/terraform.rb
|
12
|
+
* improve hooks: introduce terraspace-level as well as terraform-level hooks
|
13
|
+
* improve hooks: can take Ruby block or shell script
|
14
|
+
* improve auto init: reinit when module source changed, improve auto init: generalize retry check
|
15
|
+
* fix already_init? detection for case when stack does use module
|
16
|
+
* terraspace bundler options: can set any option now
|
17
|
+
* add `terraspace all init` command
|
18
|
+
* improve terraspace clean, prompt user and add `-y` option
|
19
|
+
* bundle: check if in terraspace project
|
20
|
+
* Rename NullObject to Unresolved
|
21
|
+
* improve error message when stacks not found. give `terraspace list` hint
|
22
|
+
* terraspace list. change default to `--type stack`
|
23
|
+
* change summary option to --details
|
24
|
+
* include terraspace version in generated Gemfile
|
25
|
+
* logs command to handle viewing, and clean logs to clean
|
26
|
+
|
27
|
+
## [0.3.6]
|
28
|
+
* #44 improve logs management commands: `terraspace logs remove` and `terraspace logs truncate`
|
29
|
+
|
30
|
+
## [0.3.5]
|
31
|
+
* #43 rename `terraform_output` helper to `output`. Keep `terraform_output` for backwards compatibility
|
32
|
+
* to_ruby natural interface to access output with full power of Ruby
|
33
|
+
* output formatters removed in favor for `.to_ruby` method.
|
34
|
+
|
35
|
+
## [0.3.4]
|
36
|
+
* #42 update cli docs and bug fixes
|
37
|
+
* fix console by using system instead of popen3
|
38
|
+
* fix build for edge case when app/modules exist but app/stacks do not
|
39
|
+
* terraspace new project: do not generate spec folder by default
|
40
|
+
* improve all output summary
|
41
|
+
* remove redundant `terraspace cloud setup`, instead use: `terraspace cloud sync`
|
42
|
+
* improve terraspace info output
|
43
|
+
* fix integration test pipeline
|
44
|
+
|
6
45
|
## [0.3.3]
|
7
46
|
* #41 fix `terraspace build` and `terraspace seed` when bucket doesnt exist yet and there are dependenices defined.
|
8
47
|
|
data/README.md
CHANGED
@@ -81,7 +81,7 @@ To choose multiple stacks to deploy
|
|
81
81
|
|
82
82
|
terraspace all up instance vpc
|
83
83
|
|
84
|
-
When you use the all command, the dependency graph is calculated and the stacks are deployed in the right order. To learn more: [Deploy Multiple Stacks](https://terraspace.cloud/docs/
|
84
|
+
When you use the all command, the dependency graph is calculated and the stacks are deployed in the right order. To learn more: [Deploy Multiple Stacks](https://terraspace.cloud/docs/intro/deploy-all/).
|
85
85
|
|
86
86
|
## Features
|
87
87
|
|
data/lib/terraspace.rb
CHANGED
@@ -6,6 +6,7 @@ require "active_support/core_ext/class"
|
|
6
6
|
require "active_support/core_ext/hash"
|
7
7
|
require "active_support/core_ext/string"
|
8
8
|
require "active_support/ordered_options"
|
9
|
+
require "cli-format"
|
9
10
|
require "deep_merge/rails_compat"
|
10
11
|
require "dsl_evaluator"
|
11
12
|
require "fileutils"
|
@@ -22,7 +22,7 @@ module Terraspace::All
|
|
22
22
|
@batches.map do |batch|
|
23
23
|
i += 1
|
24
24
|
batch.map do |stack|
|
25
|
-
command = "
|
25
|
+
command = " terraspace #{@command}"
|
26
26
|
ljust = command.size + max_name_size + 1
|
27
27
|
command = "#{command} #{stack.name}"
|
28
28
|
command.ljust(ljust, ' ') + " # batch #{i}"
|
@@ -105,6 +105,7 @@ module Terraspace::All
|
|
105
105
|
set_log_path!(mod_name)
|
106
106
|
name = command_map(@command)
|
107
107
|
o = @options.merge(mod: mod_name, yes: true, build: false, input: false)
|
108
|
+
o.merge!(quiet: false) if @command == "init" # noisy so can filter and summarize output
|
108
109
|
case @command
|
109
110
|
when "up"
|
110
111
|
Terraspace::CLI::Up.new(o).run
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Terraspace::All
|
2
2
|
class Summary
|
3
|
-
include Terraspace::CLI::
|
3
|
+
include Terraspace::CLI::Logs::Concern
|
4
4
|
include Terraspace::Util::Logging
|
5
5
|
|
6
6
|
def initialize(data={})
|
@@ -35,6 +35,13 @@ module Terraspace::All
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
+
def init
|
39
|
+
@lines.select! do |line|
|
40
|
+
line.include?("successfully initialized") || # success
|
41
|
+
line.include?("Error: ") # error
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
38
45
|
# Example 1:
|
39
46
|
# [2020-09-07T14:45:14 #23340 terraspace plan b1]: No changes. Infrastructure is up-to-date.
|
40
47
|
# Example 2:
|
@@ -51,7 +58,15 @@ module Terraspace::All
|
|
51
58
|
end
|
52
59
|
|
53
60
|
def output
|
54
|
-
@lines
|
61
|
+
if @lines.grep(/No outputs found/).empty?
|
62
|
+
@lines.select! do |line|
|
63
|
+
line.include?(" = ") # looks like output
|
64
|
+
end
|
65
|
+
else
|
66
|
+
@lines.select! do |line|
|
67
|
+
line.include?("No outputs found")
|
68
|
+
end
|
69
|
+
end
|
55
70
|
end
|
56
71
|
|
57
72
|
def show
|
@@ -65,6 +80,18 @@ module Terraspace::All
|
|
65
80
|
@lines.unshift(summary) # add to top
|
66
81
|
end
|
67
82
|
|
83
|
+
# [2020-09-19T19:36:33 #14387 terraspace providers c1]: => terraform providers
|
84
|
+
# [2020-09-19T19:36:33 #14387 terraspace providers c1]:
|
85
|
+
# [2020-09-19T19:36:33 #14387 terraspace providers c1]: Providers required by configuration:
|
86
|
+
# [2020-09-19T19:36:33 #14387 terraspace providers c1]: .
|
87
|
+
# [2020-09-19T19:36:33 #14387 terraspace providers c1]: └── provider[registry.terraform.io/hashicorp/random]
|
88
|
+
# [2020-09-19T19:36:33 #14387 terraspace providers c1]:
|
89
|
+
def providers
|
90
|
+
@lines.select! do |line|
|
91
|
+
line.include?("provider[")
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
68
95
|
# [2020-09-07T14:53:36 #31106 terraspace show b1]: Outputs:
|
69
96
|
# [2020-09-07T14:53:36 #31106 terraspace show b1]:
|
70
97
|
# [2020-09-07T14:53:36 #31106 terraspace show b1]: length = 1
|
data/lib/terraspace/app.rb
CHANGED
@@ -9,6 +9,8 @@ module Terraspace
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def defaults
|
12
|
+
ts_logger = Logger.new(ENV['TS_LOG_PATH'] || $stderr)
|
13
|
+
|
12
14
|
config = ActiveSupport::OrderedOptions.new
|
13
15
|
config.all = ActiveSupport::OrderedOptions.new
|
14
16
|
config.all.concurrency = 5
|
@@ -21,14 +23,16 @@ module Terraspace
|
|
21
23
|
config.build.cache_dir = ":CACHE_ROOT/:REGION/:ENV/:BUILD_DIR"
|
22
24
|
config.build.cache_root = nil # defaults to /full/path/to/.terraspace-cache
|
23
25
|
config.build.clean_cache = nil # defaults to /full/path/to/.terraspace-cache
|
26
|
+
config.bundle = ActiveSupport::OrderedOptions.new
|
27
|
+
config.bundle.logger = ts_logger
|
24
28
|
config.cloud = ActiveSupport::OrderedOptions.new
|
25
29
|
config.cloud.auto_sync = true
|
26
|
-
config.cloud.working_dir_prefix = nil
|
27
30
|
config.cloud.hostname = nil
|
28
31
|
config.cloud.vars = ActiveSupport::OrderedOptions.new
|
29
32
|
config.cloud.vars.overwrite = true
|
30
33
|
config.cloud.vars.overwrite_sensitive = true
|
31
34
|
config.cloud.vars.show_message = "create"
|
35
|
+
config.cloud.working_dir_prefix = nil
|
32
36
|
config.cloud.workspace = ActiveSupport::OrderedOptions.new
|
33
37
|
config.cloud.workspace.attrs = ActiveSupport::OrderedOptions.new
|
34
38
|
config.hooks = Hooks.new
|
@@ -36,14 +40,14 @@ module Terraspace
|
|
36
40
|
config.init.mode = "auto" # auto, never, always
|
37
41
|
config.log = ActiveSupport::OrderedOptions.new
|
38
42
|
config.log.root = Terraspace.log_root
|
39
|
-
config.logger =
|
40
|
-
config.logger.level = ENV['TS_LOG_LEVEL'] || :info
|
43
|
+
config.logger = ts_logger
|
41
44
|
config.logger.formatter = Logger::Formatter.new
|
42
|
-
config.
|
45
|
+
config.logger.level = ENV['TS_LOG_LEVEL'] || :info
|
43
46
|
config.terraform = ActiveSupport::OrderedOptions.new
|
44
47
|
config.terraform.plugin_cache = ActiveSupport::OrderedOptions.new
|
45
|
-
config.terraform.plugin_cache.enabled = true
|
46
48
|
config.terraform.plugin_cache.dir = ENV['TF_PLUGIN_CACHE_DIR'] || "#{Terraspace.tmp_root}/plugin_cache"
|
49
|
+
config.terraform.plugin_cache.enabled = true
|
50
|
+
config.test_framework = "rspec"
|
47
51
|
config
|
48
52
|
end
|
49
53
|
|
data/lib/terraspace/builder.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
module Terraspace
|
2
2
|
class Builder < Terraspace::CLI::Base
|
3
|
-
include Compiler::DirsConcern
|
4
3
|
include Compiler::CommandsConcern
|
4
|
+
include Compiler::DirsConcern
|
5
|
+
include Hooks::Concern
|
5
6
|
|
6
7
|
attr_reader :graph
|
7
8
|
|
@@ -14,11 +15,14 @@ module Terraspace
|
|
14
15
|
placeholder_stack_message
|
15
16
|
logger.info "Building #{build_dir}" unless @options[:quiet] # from terraspace all
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
batches = nil
|
19
|
+
run_hooks("terraspace.rb", "build") do
|
20
|
+
build_unresolved
|
21
|
+
auto_create_backend
|
22
|
+
batches = build_batches
|
23
|
+
build_all
|
24
|
+
logger.info "Built in #{build_dir}" unless @options[:quiet] # from terraspace all
|
25
|
+
end
|
22
26
|
batches
|
23
27
|
end
|
24
28
|
|
data/lib/terraspace/cli.rb
CHANGED
@@ -32,19 +32,19 @@ module Terraspace
|
|
32
32
|
long_desc Help.text(:all)
|
33
33
|
subcommand "all", All
|
34
34
|
|
35
|
+
desc "clean SUBCOMMAND", "clean subcommands"
|
36
|
+
long_desc Help.text(:clean)
|
37
|
+
subcommand "clean", Clean
|
38
|
+
|
35
39
|
desc "cloud SUBCOMMAND", "cloud subcommands"
|
36
40
|
long_desc Help.text(:cloud)
|
37
41
|
subcommand "cloud", Cloud
|
38
42
|
|
39
|
-
desc "logs SUBCOMMAND", "logs management subcommands"
|
40
|
-
long_desc Help.text(:logs)
|
41
|
-
subcommand "logs", Logs
|
42
|
-
|
43
43
|
desc "new SUBCOMMAND", "new subcommands"
|
44
44
|
long_desc Help.text(:new)
|
45
45
|
subcommand "new", New
|
46
46
|
|
47
|
-
desc "build [STACK]", "
|
47
|
+
desc "build [STACK]", "Build project."
|
48
48
|
long_desc Help.text(:build)
|
49
49
|
option :quiet, type: :boolean, desc: "quiet output"
|
50
50
|
instance_option.call
|
@@ -53,32 +53,26 @@ module Terraspace
|
|
53
53
|
Terraspace::Builder.new(options.merge(mod: mod)).run # building any stack builds them all
|
54
54
|
end
|
55
55
|
|
56
|
-
desc "bundle", "
|
56
|
+
desc "bundle", "Bundle with Terrafile."
|
57
57
|
long_desc Help.text(:bundle)
|
58
58
|
def bundle(*args)
|
59
59
|
Bundle.new(options.merge(args: args)).run
|
60
60
|
end
|
61
61
|
|
62
|
-
desc "check_setup", "
|
62
|
+
desc "check_setup", "Check setup."
|
63
63
|
long_desc Help.text(:check_setup)
|
64
64
|
def check_setup
|
65
65
|
CheckSetup.new(options).run
|
66
66
|
end
|
67
67
|
|
68
|
-
desc "
|
69
|
-
long_desc Help.text(:clean)
|
70
|
-
def clean
|
71
|
-
Clean.new(options).run
|
72
|
-
end
|
73
|
-
|
74
|
-
desc "console STACK", "console .terraspace-cache dir"
|
68
|
+
desc "console STACK", "Run console in built terraform project."
|
75
69
|
long_desc Help.text(:console)
|
76
70
|
instance_option.call
|
77
71
|
def console(mod)
|
78
|
-
Commander.new("console", options.merge(mod: mod)).run
|
72
|
+
Commander.new("console", options.merge(mod: mod, shell: "system")).run
|
79
73
|
end
|
80
74
|
|
81
|
-
desc "down STACK", "
|
75
|
+
desc "down STACK", "Destroy infrastructure stack."
|
82
76
|
long_desc Help.text(:down)
|
83
77
|
instance_option.call
|
84
78
|
yes_option.call
|
@@ -88,39 +82,39 @@ module Terraspace
|
|
88
82
|
Down.new(options.merge(mod: mod)).run
|
89
83
|
end
|
90
84
|
|
91
|
-
desc "info STACK", "info"
|
85
|
+
desc "info STACK", "Get info about stack."
|
92
86
|
long_desc Help.text(:info)
|
93
|
-
format_option.call
|
94
87
|
instance_option.call
|
88
|
+
option :format, desc: "Output formats: #{CliFormat.formats.join(', ')}"
|
95
89
|
def info(mod)
|
96
90
|
Info.new(options.merge(mod: mod)).run
|
97
91
|
end
|
98
92
|
|
99
|
-
desc "init STACK", "init"
|
93
|
+
desc "init STACK", "Run init in built terraform project."
|
100
94
|
long_desc Help.text(:init)
|
101
95
|
instance_option.call
|
102
96
|
def init(mod)
|
103
97
|
Commander.new("init", options.merge(mod: mod, quiet: false)).run
|
104
98
|
end
|
105
99
|
|
106
|
-
desc "list", "
|
100
|
+
desc "list", "List stacks and modules."
|
107
101
|
long_desc Help.text(:list)
|
108
|
-
option :type, aliases: %w[t], desc: "Type: stack
|
102
|
+
option :type, default: "stack", aliases: %w[t], desc: "Type: stack, module, or all"
|
109
103
|
def list
|
110
104
|
List.new(options).run
|
111
105
|
end
|
112
106
|
|
113
|
-
desc "
|
114
|
-
long_desc Help.text("
|
107
|
+
desc "logs [ACTION] [STACK]", "View and tail logs."
|
108
|
+
long_desc Help.text("logs")
|
115
109
|
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
110
|
option :follow, aliases: %w[f], type: :boolean, desc: "Follow the log in live tail fashion. Must specify a stack if using this option."
|
117
111
|
option :limit, aliases: %w[n], default: 10, type: :numeric, desc: "Number of lines to limit showing. Only applies in no-follow mode."
|
118
112
|
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
|
120
|
-
|
113
|
+
def logs(action=nil, stack=nil)
|
114
|
+
Logs.new(@options.merge(action: action, stack: stack)).run
|
121
115
|
end
|
122
116
|
|
123
|
-
desc "plan STACK", "
|
117
|
+
desc "plan STACK", "Plan stack."
|
124
118
|
long_desc Help.text(:plan)
|
125
119
|
auto_option.call
|
126
120
|
input_option.call
|
@@ -131,21 +125,21 @@ module Terraspace
|
|
131
125
|
Commander.new("plan", options.merge(mod: mod)).run
|
132
126
|
end
|
133
127
|
|
134
|
-
desc "providers STACK", "providers"
|
128
|
+
desc "providers STACK", "Show providers."
|
135
129
|
long_desc Help.text(:providers)
|
136
130
|
instance_option.call
|
137
131
|
def providers(mod)
|
138
132
|
Commander.new("providers", options.merge(mod: mod)).run
|
139
133
|
end
|
140
134
|
|
141
|
-
desc "refresh STACK", "refresh"
|
135
|
+
desc "refresh STACK", "Run refresh."
|
142
136
|
long_desc Help.text(:refresh)
|
143
137
|
instance_option.call
|
144
138
|
def refresh(mod)
|
145
139
|
Commander.new("refresh", options.merge(mod: mod)).run
|
146
140
|
end
|
147
141
|
|
148
|
-
desc "seed STACK", "seed"
|
142
|
+
desc "seed STACK", "Build starer seed tfvars file."
|
149
143
|
long_desc Help.text(:seed)
|
150
144
|
option :yes, aliases: :y, type: :boolean, desc: "bypass prompts and force overwrite files"
|
151
145
|
option :where, desc: "where to create file. either under app or seed folder structure. values: app or stack"
|
@@ -155,16 +149,16 @@ module Terraspace
|
|
155
149
|
Seed.new(options.merge(mod: mod)).run
|
156
150
|
end
|
157
151
|
|
158
|
-
desc "summary", "
|
159
|
-
long_desc Help.text(:
|
152
|
+
desc "summary", "Summarize resources."
|
153
|
+
long_desc Help.text(:summary)
|
160
154
|
option :mod, desc: "Module to build to generate a backend file for discovery. By default the last module is used. Usually, it wont matter."
|
161
155
|
init_option.call
|
162
|
-
option :
|
156
|
+
option :details, type: :boolean, desc: "Show details of the listed resources"
|
163
157
|
def summary
|
164
158
|
Summary.new(options).run
|
165
159
|
end
|
166
160
|
|
167
|
-
desc "show STACK", "show"
|
161
|
+
desc "show STACK", "Run show."
|
168
162
|
long_desc Help.text(:show)
|
169
163
|
instance_option.call
|
170
164
|
option :plan, desc: "path to created.plan"
|
@@ -173,13 +167,13 @@ module Terraspace
|
|
173
167
|
Commander.new("show", options.merge(mod: mod)).run
|
174
168
|
end
|
175
169
|
|
176
|
-
desc "test", "test"
|
170
|
+
desc "test", "Run test."
|
177
171
|
long_desc Help.text(:test)
|
178
172
|
def test
|
179
173
|
Test.new(options).run
|
180
174
|
end
|
181
175
|
|
182
|
-
desc "output STACK", "output"
|
176
|
+
desc "output STACK", "Run output."
|
183
177
|
long_desc Help.text(:output)
|
184
178
|
format_option.call
|
185
179
|
instance_option.call
|
@@ -188,8 +182,8 @@ module Terraspace
|
|
188
182
|
Commander.new("output", options.merge(mod: mod)).run
|
189
183
|
end
|
190
184
|
|
191
|
-
desc "up STACK", "Deploy infrastructure.
|
192
|
-
long_desc Help.text(:
|
185
|
+
desc "up STACK", "Deploy infrastructure stack."
|
186
|
+
long_desc Help.text(:up)
|
193
187
|
auto_option.call
|
194
188
|
init_option.call
|
195
189
|
input_option.call
|
@@ -202,7 +196,7 @@ module Terraspace
|
|
202
196
|
Up.new(options.merge(mod: mod)).run
|
203
197
|
end
|
204
198
|
|
205
|
-
desc "validate STACK", "
|
199
|
+
desc "validate STACK", "Validate stack."
|
206
200
|
long_desc Help.text(:validate)
|
207
201
|
instance_option.call
|
208
202
|
def validate(mod)
|
@@ -221,7 +215,7 @@ module Terraspace
|
|
221
215
|
Completer::Script.generate
|
222
216
|
end
|
223
217
|
|
224
|
-
desc "version", "
|
218
|
+
desc "version", "Prints version."
|
225
219
|
def version
|
226
220
|
puts VERSION
|
227
221
|
end
|