terraspace 0.3.1 → 0.3.6
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 +24 -0
- data/README.md +2 -2
- data/lib/terraspace.rb +2 -0
- data/lib/terraspace/all/preview.rb +1 -1
- data/lib/terraspace/all/summary.rb +21 -1
- data/lib/terraspace/app.rb +1 -0
- data/lib/terraspace/builder.rb +3 -6
- data/lib/terraspace/cli.rb +25 -25
- data/lib/terraspace/cli/all.rb +9 -9
- 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/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.md +5 -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 +2 -2
- 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/log.md +8 -2
- 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/logs.rb +3 -1
- data/lib/terraspace/cli/logs/tasks.rb +13 -1
- data/lib/terraspace/cli/new.rb +18 -18
- data/lib/terraspace/cli/new/git_hook.rb +4 -1
- 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/backend.rb +10 -0
- data/lib/terraspace/compiler/builder.rb +2 -1
- data/lib/terraspace/compiler/commands_concern.rb +18 -0
- 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/plugin/summary/interface.rb +1 -1
- data/lib/terraspace/shell.rb +44 -16
- 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 +37 -7
- data/lib/terraspace/terraform/remote_state/marker/output.rb +3 -1
- data/lib/terraspace/terraform/remote_state/null_object.rb +40 -0
- data/lib/terraspace/terraform/remote_state/output_proxy.rb +18 -14
- 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/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
- metadata +62 -3
- data/lib/terraspace/cli/help/update.md +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28bdb53824befd6a98263c63612db913c5496546ef751ed408500b4140ac57c4
|
4
|
+
data.tar.gz: fe844bdeb2dacfbecfa954a912bfa4ef3e5b4e6265d2eea697d072d8533b2fd5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e01f4b80088de2c7a3f3f1c8ac81a401b4a999cbb3fbc4af78651ee8e1788246dcb8b889172b94ea5ff7a7932a4874f27e225f66dedac2603a5752a20fb383c
|
7
|
+
data.tar.gz: c0ca89b09e3d8ca3f36f6d2f513fedbaa29aad071af4c4c6e99c38438b8c2002582adaa49b2f7105becde5e2ac21785a7f5617b9c5fd1fd60ea25fbaadda7a54
|
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,30 @@
|
|
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.3.6]
|
7
|
+
* #44 improve logs management commands: `terraspace logs remove` and `terraspace logs truncate`
|
8
|
+
|
9
|
+
## [0.3.5]
|
10
|
+
* #43 rename `terraform_output` helper to `output`. Keep `terraform_output` for backwards compatibility
|
11
|
+
* to_ruby natural interface to access output with full power of Ruby
|
12
|
+
* output formatters removed in favor for `.to_ruby` method.
|
13
|
+
|
14
|
+
## [0.3.4]
|
15
|
+
* #42 update cli docs and bug fixes
|
16
|
+
* fix console by using system instead of popen3
|
17
|
+
* fix build for edge case when app/modules exist but app/stacks do not
|
18
|
+
* terraspace new project: do not generate spec folder by default
|
19
|
+
* improve all output summary
|
20
|
+
* remove redundant `terraspace cloud setup`, instead use: `terraspace cloud sync`
|
21
|
+
* improve terraspace info output
|
22
|
+
* fix integration test pipeline
|
23
|
+
|
24
|
+
## [0.3.3]
|
25
|
+
* #41 fix `terraspace build` and `terraspace seed` when bucket doesnt exist yet and there are dependenices defined.
|
26
|
+
|
27
|
+
## [0.3.2]
|
28
|
+
* #40 fix backend auto creation
|
29
|
+
|
6
30
|
## [0.3.1]
|
7
31
|
* #39 fix backend auto creation
|
8
32
|
|
data/README.md
CHANGED
@@ -81,14 +81,14 @@ 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
|
|
88
88
|
* [Config Structure](https://terraspace.cloud/docs/config/): A common config structure that gets materializes with the deployed module. Configs can be dynamically controlled to keep your code DRY. You can override the settings if needed, like for using existing backends. See: [Existing Backends](https://terraspace.cloud/docs/state/existing/).
|
89
89
|
* [Generators](https://terraspace.cloud/docs/generators/): Built-in generators to quickly create the starter module. Focus on code instead of boilerplate structure.
|
90
90
|
* [Tfvars](https://terraspace.cloud/docs/tfvars/) & [Layering](https://terraspace.cloud/docs/tfvars/layering/): Use the same code with different tfvars to create multiple environments. Terraspace conventionally loads tfvars from the `tfvars` folder. Rich layering support allows you to build different environments like dev and prod with the same code. Examples are in [Full Layering](https://terraspace.cloud/docs/tfvars/full-layering/).
|
91
|
-
* [Deploy Multiple Stacks](https://terraspace.cloud/docs/
|
91
|
+
* [Deploy Multiple Stacks](https://terraspace.cloud/docs/intro/deploy-all/): The ability to deploy multiple stacks with a single command. Terraspace calculates the [dependency graph](https://terraspace.cloud/docs/dependencies/) and deploys stacks in the right order. You can also target specific stacks and deploy [subgraphs](https://terraspace.cloud/docs/dependencies/subgraphs/).
|
92
92
|
* [Configurable CLI](https://terraspace.cloud/docs/cli/): Configurable [CLI Hooks](https://terraspace.cloud/docs/cli/hooks/) and [CLI Args](https://terraspace.cloud/docs/cli/args/) allow you to adjust the underlying terraform command.
|
93
93
|
* [Testing](https://terraspace.cloud/docs/testing/): A testing framework that allows you to create test harnesses, deploy real-resources, and have higher confidence that your code works.
|
94
94
|
* [Terraform Cloud and Terraform Enterprise Support](https://terraspace.cloud/docs/cloud/): TFC and TFE are both supported. Terraspace adds additional conveniences to make working with Terraform Cloud Workspaces easier.
|
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"
|
@@ -26,6 +27,7 @@ module Terraspace
|
|
26
27
|
extend Core # for Terraspace.root
|
27
28
|
class Error < StandardError; end
|
28
29
|
class InitRequiredError < Error; end
|
30
|
+
class BucketNotFoundError < Error; end
|
29
31
|
end
|
30
32
|
|
31
33
|
Terraspace::Booter.boot
|
@@ -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}"
|
@@ -51,7 +51,15 @@ module Terraspace::All
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def output
|
54
|
-
@lines
|
54
|
+
if @lines.grep(/No outputs found/).empty?
|
55
|
+
@lines.select! do |line|
|
56
|
+
line.include?(" = ") # looks like output
|
57
|
+
end
|
58
|
+
else
|
59
|
+
@lines.select! do |line|
|
60
|
+
line.include?("No outputs found")
|
61
|
+
end
|
62
|
+
end
|
55
63
|
end
|
56
64
|
|
57
65
|
def show
|
@@ -65,6 +73,18 @@ module Terraspace::All
|
|
65
73
|
@lines.unshift(summary) # add to top
|
66
74
|
end
|
67
75
|
|
76
|
+
# [2020-09-19T19:36:33 #14387 terraspace providers c1]: => terraform providers
|
77
|
+
# [2020-09-19T19:36:33 #14387 terraspace providers c1]:
|
78
|
+
# [2020-09-19T19:36:33 #14387 terraspace providers c1]: Providers required by configuration:
|
79
|
+
# [2020-09-19T19:36:33 #14387 terraspace providers c1]: .
|
80
|
+
# [2020-09-19T19:36:33 #14387 terraspace providers c1]: └── provider[registry.terraform.io/hashicorp/random]
|
81
|
+
# [2020-09-19T19:36:33 #14387 terraspace providers c1]:
|
82
|
+
def providers
|
83
|
+
@lines.select! do |line|
|
84
|
+
line.include?("provider[")
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
68
88
|
# [2020-09-07T14:53:36 #31106 terraspace show b1]: Outputs:
|
69
89
|
# [2020-09-07T14:53:36 #31106 terraspace show b1]:
|
70
90
|
# [2020-09-07T14:53:36 #31106 terraspace show b1]: length = 1
|
data/lib/terraspace/app.rb
CHANGED
@@ -16,6 +16,7 @@ module Terraspace
|
|
16
16
|
config.all.exit_on_fail.down = true
|
17
17
|
config.all.exit_on_fail.up = true
|
18
18
|
config.all.ignore_stacks = []
|
19
|
+
config.auto_create_backend = true
|
19
20
|
config.build = ActiveSupport::OrderedOptions.new
|
20
21
|
config.build.cache_dir = ":CACHE_ROOT/:REGION/:ENV/:BUILD_DIR"
|
21
22
|
config.build.cache_root = nil # defaults to /full/path/to/.terraspace-cache
|
data/lib/terraspace/builder.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
module Terraspace
|
2
2
|
class Builder < Terraspace::CLI::Base
|
3
3
|
include Compiler::DirsConcern
|
4
|
+
include Compiler::CommandsConcern
|
4
5
|
|
5
6
|
attr_reader :graph
|
6
7
|
|
@@ -57,15 +58,11 @@ module Terraspace
|
|
57
58
|
|
58
59
|
# Auto create after build_unresolved since will need to run state pull for dependencies
|
59
60
|
def auto_create_backend
|
60
|
-
return
|
61
|
+
return if Terraspace.config.auto_create_backend == false
|
62
|
+
return unless requires_backend?
|
61
63
|
Terraspace::Compiler::Backend.new(@mod).create
|
62
64
|
end
|
63
65
|
|
64
|
-
def create_backend?
|
65
|
-
ARGV[0] == "up" || # terraspace up
|
66
|
-
ARGV[0] == "all" && ARGV[1] == "up" # terraspace up
|
67
|
-
end
|
68
|
-
|
69
66
|
def clean
|
70
67
|
Compiler::Cleaner.new(@mod, @options).clean if clean?
|
71
68
|
end
|
data/lib/terraspace/cli.rb
CHANGED
@@ -44,7 +44,7 @@ module Terraspace
|
|
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,32 @@ 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 "clean", "
|
68
|
+
desc "clean", "Removes .terraspace-cache dir."
|
69
69
|
long_desc Help.text(:clean)
|
70
70
|
def clean
|
71
71
|
Clean.new(options).run
|
72
72
|
end
|
73
73
|
|
74
|
-
desc "console STACK", "console .
|
74
|
+
desc "console STACK", "Run console in built terraform project."
|
75
75
|
long_desc Help.text(:console)
|
76
76
|
instance_option.call
|
77
77
|
def console(mod)
|
78
|
-
Commander.new("console", options.merge(mod: mod)).run
|
78
|
+
Commander.new("console", options.merge(mod: mod, shell: "system")).run
|
79
79
|
end
|
80
80
|
|
81
|
-
desc "down STACK", "
|
81
|
+
desc "down STACK", "Destroy infrastructure stack."
|
82
82
|
long_desc Help.text(:down)
|
83
83
|
instance_option.call
|
84
84
|
yes_option.call
|
@@ -88,29 +88,29 @@ module Terraspace
|
|
88
88
|
Down.new(options.merge(mod: mod)).run
|
89
89
|
end
|
90
90
|
|
91
|
-
desc "info STACK", "info"
|
91
|
+
desc "info STACK", "Get info about stack."
|
92
92
|
long_desc Help.text(:info)
|
93
|
-
format_option.call
|
94
93
|
instance_option.call
|
94
|
+
option :format, desc: "Output formats: #{CliFormat.formats.join(', ')}"
|
95
95
|
def info(mod)
|
96
96
|
Info.new(options.merge(mod: mod)).run
|
97
97
|
end
|
98
98
|
|
99
|
-
desc "init STACK", "init"
|
99
|
+
desc "init STACK", "Run init in built terraform project."
|
100
100
|
long_desc Help.text(:init)
|
101
101
|
instance_option.call
|
102
102
|
def init(mod)
|
103
103
|
Commander.new("init", options.merge(mod: mod, quiet: false)).run
|
104
104
|
end
|
105
105
|
|
106
|
-
desc "list", "
|
106
|
+
desc "list", "List stacks and modules."
|
107
107
|
long_desc Help.text(:list)
|
108
108
|
option :type, aliases: %w[t], desc: "Type: stack or module. Default all"
|
109
109
|
def list
|
110
110
|
List.new(options).run
|
111
111
|
end
|
112
112
|
|
113
|
-
desc "log [ACTION] [STACK]", "
|
113
|
+
desc "log [ACTION] [STACK]", "View and tail logs."
|
114
114
|
long_desc Help.text("log")
|
115
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
116
|
option :follow, aliases: %w[f], type: :boolean, desc: "Follow the log in live tail fashion. Must specify a stack if using this option."
|
@@ -120,7 +120,7 @@ module Terraspace
|
|
120
120
|
Log.new(@options.merge(action: action, stack: stack)).run
|
121
121
|
end
|
122
122
|
|
123
|
-
desc "plan STACK", "
|
123
|
+
desc "plan STACK", "Plan stack."
|
124
124
|
long_desc Help.text(:plan)
|
125
125
|
auto_option.call
|
126
126
|
input_option.call
|
@@ -131,21 +131,21 @@ module Terraspace
|
|
131
131
|
Commander.new("plan", options.merge(mod: mod)).run
|
132
132
|
end
|
133
133
|
|
134
|
-
desc "providers STACK", "providers"
|
134
|
+
desc "providers STACK", "Show providers."
|
135
135
|
long_desc Help.text(:providers)
|
136
136
|
instance_option.call
|
137
137
|
def providers(mod)
|
138
138
|
Commander.new("providers", options.merge(mod: mod)).run
|
139
139
|
end
|
140
140
|
|
141
|
-
desc "refresh STACK", "refresh"
|
141
|
+
desc "refresh STACK", "Run refresh."
|
142
142
|
long_desc Help.text(:refresh)
|
143
143
|
instance_option.call
|
144
144
|
def refresh(mod)
|
145
145
|
Commander.new("refresh", options.merge(mod: mod)).run
|
146
146
|
end
|
147
147
|
|
148
|
-
desc "seed STACK", "seed"
|
148
|
+
desc "seed STACK", "Build starer seed tfvars file."
|
149
149
|
long_desc Help.text(:seed)
|
150
150
|
option :yes, aliases: :y, type: :boolean, desc: "bypass prompts and force overwrite files"
|
151
151
|
option :where, desc: "where to create file. either under app or seed folder structure. values: app or stack"
|
@@ -155,8 +155,8 @@ module Terraspace
|
|
155
155
|
Seed.new(options.merge(mod: mod)).run
|
156
156
|
end
|
157
157
|
|
158
|
-
desc "summary", "
|
159
|
-
long_desc Help.text(:
|
158
|
+
desc "summary", "Summarize resources."
|
159
|
+
long_desc Help.text(:summary)
|
160
160
|
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
161
|
init_option.call
|
162
162
|
option :short, aliases: %w[s], type: :boolean, desc: "Only show statefiles"
|
@@ -164,7 +164,7 @@ module Terraspace
|
|
164
164
|
Summary.new(options).run
|
165
165
|
end
|
166
166
|
|
167
|
-
desc "show STACK", "show"
|
167
|
+
desc "show STACK", "Run show."
|
168
168
|
long_desc Help.text(:show)
|
169
169
|
instance_option.call
|
170
170
|
option :plan, desc: "path to created.plan"
|
@@ -173,13 +173,13 @@ module Terraspace
|
|
173
173
|
Commander.new("show", options.merge(mod: mod)).run
|
174
174
|
end
|
175
175
|
|
176
|
-
desc "test", "test"
|
176
|
+
desc "test", "Run test."
|
177
177
|
long_desc Help.text(:test)
|
178
178
|
def test
|
179
179
|
Test.new(options).run
|
180
180
|
end
|
181
181
|
|
182
|
-
desc "output STACK", "output"
|
182
|
+
desc "output STACK", "Run output."
|
183
183
|
long_desc Help.text(:output)
|
184
184
|
format_option.call
|
185
185
|
instance_option.call
|
@@ -188,8 +188,8 @@ module Terraspace
|
|
188
188
|
Commander.new("output", options.merge(mod: mod)).run
|
189
189
|
end
|
190
190
|
|
191
|
-
desc "up STACK", "Deploy infrastructure.
|
192
|
-
long_desc Help.text(:
|
191
|
+
desc "up STACK", "Deploy infrastructure stack."
|
192
|
+
long_desc Help.text(:up)
|
193
193
|
auto_option.call
|
194
194
|
init_option.call
|
195
195
|
input_option.call
|
@@ -202,7 +202,7 @@ module Terraspace
|
|
202
202
|
Up.new(options.merge(mod: mod)).run
|
203
203
|
end
|
204
204
|
|
205
|
-
desc "validate STACK", "
|
205
|
+
desc "validate STACK", "Validate stack."
|
206
206
|
long_desc Help.text(:validate)
|
207
207
|
instance_option.call
|
208
208
|
def validate(mod)
|
@@ -221,7 +221,7 @@ module Terraspace
|
|
221
221
|
Completer::Script.generate
|
222
222
|
end
|
223
223
|
|
224
|
-
desc "version", "
|
224
|
+
desc "version", "Prints version."
|
225
225
|
def version
|
226
226
|
puts VERSION
|
227
227
|
end
|
data/lib/terraspace/cli/all.rb
CHANGED
@@ -3,14 +3,14 @@ class Terraspace::CLI
|
|
3
3
|
class_option :yes, aliases: :y, type: :boolean, desc: "auto approve all batch commands"
|
4
4
|
class_option :exit_on_fail, type: :boolean, desc: "whether or not to exit when one of the batch commands fails"
|
5
5
|
|
6
|
-
desc "down", "
|
6
|
+
desc "down", "Destroy all or multiple stacks."
|
7
7
|
long_desc Help.text("all/down")
|
8
8
|
option :destroy_workspace, type: :boolean, desc: "Also destroy the Cloud workspace. Only applies when using Terraform Cloud remote backend."
|
9
9
|
def down(*stacks)
|
10
10
|
Terraspace::All::Runner.new("down", @options.merge(stacks: stacks)).run
|
11
11
|
end
|
12
12
|
|
13
|
-
desc "graph", "graph
|
13
|
+
desc "graph", "Draw a dependency graph."
|
14
14
|
long_desc Help.text("all/graph")
|
15
15
|
option :format, default: "png", desc: "format: text or diagram"
|
16
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"
|
@@ -18,43 +18,43 @@ class Terraspace::CLI
|
|
18
18
|
Terraspace::All::Grapher.new(@options.merge(stacks: stacks)).run
|
19
19
|
end
|
20
20
|
|
21
|
-
desc "refresh", "
|
21
|
+
desc "refresh", "Refresh all or multiple stacks."
|
22
22
|
long_desc Help.text("all/refresh")
|
23
23
|
def refresh(*stacks)
|
24
24
|
Terraspace::All::Runner.new("refresh", @options.merge(stacks: stacks)).run
|
25
25
|
end
|
26
26
|
|
27
|
-
desc "output", "output all"
|
27
|
+
desc "output", "Show output for all or multiple stacks."
|
28
28
|
long_desc Help.text("all/output")
|
29
29
|
def output(*stacks)
|
30
30
|
Terraspace::All::Runner.new("output", @options.merge(stacks: stacks)).run
|
31
31
|
end
|
32
32
|
|
33
|
-
desc "plan", "plan all"
|
33
|
+
desc "plan", "Run plan for all or multiple stacks."
|
34
34
|
long_desc Help.text("all/plan")
|
35
35
|
def plan(*stacks)
|
36
36
|
Terraspace::All::Runner.new("plan", @options.merge(stacks: stacks)).run
|
37
37
|
end
|
38
38
|
|
39
|
-
desc "providers", "providers all"
|
39
|
+
desc "providers", "Show providers for all or multiple stacks."
|
40
40
|
long_desc Help.text("all/providers")
|
41
41
|
def providers(*stacks)
|
42
42
|
Terraspace::All::Runner.new("providers", @options.merge(stacks: stacks)).run
|
43
43
|
end
|
44
44
|
|
45
|
-
desc "show", "show all"
|
45
|
+
desc "show", "Run show for all or multiple stacks."
|
46
46
|
long_desc Help.text("all/show")
|
47
47
|
def show(*stacks)
|
48
48
|
Terraspace::All::Runner.new("show", @options.merge(stacks: stacks)).run
|
49
49
|
end
|
50
50
|
|
51
|
-
desc "up", "
|
51
|
+
desc "up", "Deploy all or multiple stacks."
|
52
52
|
long_desc Help.text("all/up")
|
53
53
|
def up(*stacks)
|
54
54
|
Terraspace::All::Runner.new("up", @options.merge(stacks: stacks)).run
|
55
55
|
end
|
56
56
|
|
57
|
-
desc "validate", "
|
57
|
+
desc "validate", "Validate all or multiple stacks."
|
58
58
|
long_desc Help.text("all/validate")
|
59
59
|
def validate(*stacks)
|
60
60
|
Terraspace::All::Runner.new("validate", @options.merge(stacks: stacks)).run
|
data/lib/terraspace/cli/cloud.rb
CHANGED
@@ -20,17 +20,11 @@ class Terraspace::CLI
|
|
20
20
|
Workspace.new(options.merge(mod: mod)).destroy
|
21
21
|
end
|
22
22
|
|
23
|
-
desc "
|
24
|
-
long_desc Help.text("cloud:setup")
|
25
|
-
def setup(mod)
|
26
|
-
Workspace.new(options.merge(mod: mod)).setup
|
27
|
-
end
|
28
|
-
|
29
|
-
desc "sync [STACK]", "sync workspace"
|
23
|
+
desc "sync [STACK]", "Sync all or multiple workspaces."
|
30
24
|
long_desc Help.text("cloud:sync")
|
31
25
|
yes_option.call
|
32
|
-
def sync(
|
33
|
-
Syncer.new(options.merge(
|
26
|
+
def sync(*stacks)
|
27
|
+
Syncer.new(options.merge(stacks: stacks, override_auto_sync: true)).run
|
34
28
|
end
|
35
29
|
|
36
30
|
desc "runs SUBCOMMAND", "runs subcommands"
|