terraspace 0.3.5 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +31 -0
- data/README.md +56 -29
- data/lib/templates/base/project/README.md +1 -1
- data/lib/terraspace/all/runner.rb +1 -0
- data/lib/terraspace/all/summary.rb +8 -1
- data/lib/terraspace/app.rb +9 -5
- data/lib/terraspace/builder.rb +10 -6
- data/lib/terraspace/cli.rb +12 -16
- data/lib/terraspace/cli/all.rb +6 -0
- 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/help/all/init.md +33 -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/logs.md +48 -0
- data/lib/terraspace/cli/info.rb +12 -0
- 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 +2 -1
- data/lib/terraspace/cli/new/helper.rb +9 -2
- data/lib/terraspace/dependency/helper/output.rb +1 -1
- 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 +3 -1
- data/lib/terraspace/shell.rb +15 -10
- data/lib/terraspace/terraform/args/custom.rb +1 -1
- data/lib/terraspace/terraform/args/default.rb +9 -19
- data/lib/terraspace/terraform/remote_state/output_proxy.rb +3 -3
- data/lib/terraspace/terraform/remote_state/{null_object.rb → unresolved.rb} +1 -1
- data/lib/terraspace/terraform/runner.rb +3 -8
- data/lib/terraspace/version.rb +1 -1
- data/spec/terraspace/{terraform/hooks → hooks}/builder_spec.rb +4 -5
- data/spec/terraspace/terraform/remote_state/output_proxy_spec.rb +3 -3
- data/terraspace.gemspec +1 -1
- metadata +21 -14
- data/lib/terraspace/cli/help/clean.md +0 -5
- data/lib/terraspace/cli/help/log.md +0 -48
- 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: '09ac4834cd477fb90ceb545d7dc08fdbacbb42231d51c6e0b27698c37ddc2946'
|
4
|
+
data.tar.gz: 29a223281b24965c0f33096b180f7a49e5f62e7bd74718e71f16e5fdd072ba1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4436cab7ed69ab13e3bda23349c49b3f9e6d3a2fba04b160aba229593aa764f8a7f411c617c1f8892581f4a453a2dcc7c9eb427a976722f40489f518642c0c4a
|
7
|
+
data.tar.gz: b2f7aded9d6ba98b290d35e02629cb0119eb30a31a22baaa25f44aef94d11fa7a724b534dd9df9d4e918f142d0990743f67e1f49a3412d1df2caf5f08a6819a6
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,37 @@
|
|
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.3]
|
7
|
+
* #49 add info --path option
|
8
|
+
|
9
|
+
## [0.4.2]
|
10
|
+
* #48 add logs pid option
|
11
|
+
* default to input false, encourage set tfvars
|
12
|
+
|
13
|
+
## [0.4.1]
|
14
|
+
* #47 `terraspace list` fix and `terraspace all init` help updates
|
15
|
+
|
16
|
+
## [0.4.0]
|
17
|
+
* #46 improve hooks, bundle, auto init and bug fixes
|
18
|
+
* improve hooks: allow multiple hooks of same type, change path hooks/terraform.rb
|
19
|
+
* improve hooks: introduce terraspace-level as well as terraform-level hooks
|
20
|
+
* improve hooks: can take Ruby block or shell script
|
21
|
+
* improve auto init: reinit when module source changed, improve auto init: generalize retry check
|
22
|
+
* fix already_init? detection for case when stack does use module
|
23
|
+
* terraspace bundler options: can set any option now
|
24
|
+
* add `terraspace all init` command
|
25
|
+
* improve terraspace clean, prompt user and add `-y` option
|
26
|
+
* bundle: check if in terraspace project
|
27
|
+
* Rename NullObject to Unresolved
|
28
|
+
* improve error message when stacks not found. give `terraspace list` hint
|
29
|
+
* terraspace list. change default to `--type stack`
|
30
|
+
* change summary option to --details
|
31
|
+
* include terraspace version in generated Gemfile
|
32
|
+
* logs command to handle viewing, and clean logs to clean
|
33
|
+
|
34
|
+
## [0.3.6]
|
35
|
+
* #44 improve logs management commands: `terraspace logs remove` and `terraspace logs truncate`
|
36
|
+
|
6
37
|
## [0.3.5]
|
7
38
|
* #43 rename `terraform_output` helper to `output`. Keep `terraform_output` for backwards compatibility
|
8
39
|
* to_ruby natural interface to access output with full power of Ruby
|
data/README.md
CHANGED
@@ -29,59 +29,77 @@ Here are commands to get started:
|
|
29
29
|
* The `up` command creates an s3 bucket.
|
30
30
|
* The `down` command cleans up and deletes the bucket.
|
31
31
|
|
32
|
-
The default plugin is aws.
|
32
|
+
The default plugin is aws. Major cloud providers are supported: [aws](https://terraspace.cloud/docs/learn/aws/), [azurerm](https://terraspace.cloud/docs/learn/azure/), [google](https://terraspace.cloud/docs/learn/gcp/).
|
33
33
|
|
34
34
|
## Usage
|
35
35
|
|
36
36
|
Create infrastructure:
|
37
37
|
|
38
|
-
$ terraspace up demo
|
38
|
+
$ terraspace up demo
|
39
39
|
Building .terraspace-cache/us-west-2/dev/stacks/demo
|
40
40
|
Current directory: .terraspace-cache/us-west-2/dev/stacks/demo
|
41
|
-
=> terraform init -get
|
42
|
-
|
43
|
-
=> terraform apply -auto-approve
|
44
|
-
random_pet.bucket: Creating...
|
45
|
-
random_pet.bucket: Creation complete after 0s [id=amusing-mouse]
|
46
|
-
module.bucket.aws_s3_bucket.this: Creating...
|
47
|
-
module.bucket.aws_s3_bucket.this: Creation complete after 1s [id=bucket-amusing-mouse]
|
48
|
-
|
41
|
+
=> terraform init -get >> /tmp/terraspace/log/init/demo.log
|
42
|
+
=> terraform apply
|
49
43
|
Apply complete! Resources: 2 added, 0 changed, 0 destroyed.
|
50
|
-
|
51
|
-
Outputs:
|
52
|
-
|
53
|
-
bucket_name = bucket-amusing-mouse
|
54
44
|
$
|
55
45
|
|
56
46
|
Destroy infrastructure:
|
57
47
|
|
58
|
-
$ terraspace down demo
|
48
|
+
$ terraspace down demo
|
59
49
|
Building .terraspace-cache/us-west-2/dev/stacks/demo
|
60
50
|
Current directory: .terraspace-cache/us-west-2/dev/stacks/demo
|
61
|
-
=> terraform
|
62
|
-
Built in .terraspace-cache/us-west-2/dev/stacks/demo
|
63
|
-
=> terraform destroy -auto-approve
|
64
|
-
random_pet.bucket: Refreshing state... [id=amusing-mouse]
|
65
|
-
module.bucket.aws_s3_bucket.this: Refreshing state... [id=bucket-amusing-mouse]
|
66
|
-
module.bucket.aws_s3_bucket.this: Destroying... [id=bucket-amusing-mouse]
|
67
|
-
module.bucket.aws_s3_bucket.this: Destruction complete after 1s
|
68
|
-
random_pet.bucket: Destroying... [id=amusing-mouse]
|
69
|
-
random_pet.bucket: Destruction complete after 0s
|
70
|
-
|
51
|
+
=> terraform destroy
|
71
52
|
Destroy complete! Resources: 2 destroyed.
|
72
53
|
$
|
73
54
|
|
55
|
+
* Blog: [Introducing Terraspace: The Terraform Framework](https://blog.boltops.com/2020/08/22/introducing-terraspace-the-terraform-framework)
|
56
|
+
* Docs: [Terraspace Intro](https://terraspace.cloud/docs/intro/)
|
57
|
+
|
74
58
|
## Deploy Multiple Stacks
|
75
59
|
|
76
60
|
To deploy all the infrastructure stacks:
|
77
61
|
|
78
|
-
terraspace all up
|
62
|
+
$ terraspace all up
|
63
|
+
Will run:
|
64
|
+
terraspace up vpc # batch 1
|
65
|
+
terraspace up mysql # batch 2
|
66
|
+
terraspace up redis # batch 2
|
67
|
+
terraspace up instance # batch 3
|
68
|
+
Are you sure? (y/N)
|
79
69
|
|
80
70
|
To choose multiple stacks to deploy
|
81
71
|
|
82
|
-
terraspace all up
|
72
|
+
$ terraspace all up mysql redis
|
73
|
+
Will run:
|
74
|
+
terraspace up vpc # batch 1
|
75
|
+
terraspace up mysql # batch 2
|
76
|
+
terraspace up redis # batch 2
|
77
|
+
Are you sure? (y/N)
|
78
|
+
|
79
|
+
When you use the all command, the dependency graph is calculated and the stacks are deployed in the right order.
|
80
|
+
|
81
|
+
* Blog: [Terraspace All: Deploy Multiple Stacks or Terraform Modules At Once](https://blog.boltops.com/2020/09/19/terraspace-all-deploy-multiple-stacks-at-once)
|
82
|
+
* Docs: [Deploy Multiple Stacks](https://terraspace.cloud/docs/intro/deploy-all/).
|
83
|
+
|
84
|
+
## Terrafile
|
83
85
|
|
84
|
-
|
86
|
+
Terraspace makes it easy to use Terraform modules sourced from your own git repositories, other git repositories, or the Terraform Registry. Use any module you want:
|
87
|
+
|
88
|
+
Terrafile:
|
89
|
+
|
90
|
+
```ruby
|
91
|
+
# GitHub repo
|
92
|
+
mod "s3", source: "boltops-tools/terraform-aws-s3", tag: "v0.1.0"
|
93
|
+
# Terraform registry
|
94
|
+
mod "sg", source: "terraform-aws-modules/security-group/aws", version: "3.10.0"
|
95
|
+
```
|
96
|
+
|
97
|
+
To install modules:
|
98
|
+
|
99
|
+
terraspace bundle
|
100
|
+
|
101
|
+
* Blog: [Terraspace Terrafile: Using Git and Terraform Registry Modules](https://blog.boltops.com/2020/10/18/terraspace-terrafile-using-git-repos-and-terraform-registry-modules)
|
102
|
+
* Docs: [Terrafile](https://terraspace.cloud/docs/terrafile/)
|
85
103
|
|
86
104
|
## Features
|
87
105
|
|
@@ -89,8 +107,17 @@ When you use the all command, the dependency graph is calculated and the stacks
|
|
89
107
|
* [Generators](https://terraspace.cloud/docs/generators/): Built-in generators to quickly create the starter module. Focus on code instead of boilerplate structure.
|
90
108
|
* [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
109
|
* [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/).
|
110
|
+
* [Terrafile](https://terraspace.cloud/docs/terrafile/}): Terraspace makes it easy to use Terraform modules sourced from your own git repositories, other git repositories, or the Terraform Registry. The git repos can be private or public. This is an incredibly powerful feature of Terraspace because it opens up a world of modules for you to use. Use any module you want.
|
92
111
|
* [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
112
|
* [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
113
|
* [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.
|
95
114
|
|
96
|
-
|
115
|
+
## Comparison
|
116
|
+
|
117
|
+
Here are some useful comparisons to help you compare Terraspace vs other tools in the ecosystem:
|
118
|
+
|
119
|
+
* [Terraspace vs Custom Solution](https://terraspace.cloud/docs/vs/custom/)
|
120
|
+
* [Terraspace vs Terraform](https://terraspace.cloud/docs/vs/terraform/)
|
121
|
+
* [Terraform vs Terragrunt vs Terraspace](https://blog.boltops.com/2020/09/28/terraform-vs-terragrunt-vs-terraspace)
|
122
|
+
|
123
|
+
More info: [terraspace.cloud](https://terraspace.cloud)
|
@@ -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:
|
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,14 +32,14 @@ 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
|
@@ -65,12 +65,6 @@ module Terraspace
|
|
65
65
|
CheckSetup.new(options).run
|
66
66
|
end
|
67
67
|
|
68
|
-
desc "clean", "Removes .terraspace-cache dir."
|
69
|
-
long_desc Help.text(:clean)
|
70
|
-
def clean
|
71
|
-
Clean.new(options).run
|
72
|
-
end
|
73
|
-
|
74
68
|
desc "console STACK", "Run console in built terraform project."
|
75
69
|
long_desc Help.text(:console)
|
76
70
|
instance_option.call
|
@@ -92,6 +86,7 @@ module Terraspace
|
|
92
86
|
long_desc Help.text(:info)
|
93
87
|
instance_option.call
|
94
88
|
option :format, desc: "Output formats: #{CliFormat.formats.join(', ')}"
|
89
|
+
option :path, desc: "Print path to built path"
|
95
90
|
def info(mod)
|
96
91
|
Info.new(options.merge(mod: mod)).run
|
97
92
|
end
|
@@ -105,19 +100,20 @@ module Terraspace
|
|
105
100
|
|
106
101
|
desc "list", "List stacks and modules."
|
107
102
|
long_desc Help.text(:list)
|
108
|
-
option :type, aliases: %w[t], desc: "Type: stack
|
103
|
+
option :type, default: "stack", aliases: %w[t], desc: "Type: stack, module, or all"
|
109
104
|
def list
|
110
105
|
List.new(options).run
|
111
106
|
end
|
112
107
|
|
113
|
-
desc "
|
114
|
-
long_desc Help.text("
|
108
|
+
desc "logs [ACTION] [STACK]", "View and tail logs."
|
109
|
+
long_desc Help.text("logs")
|
115
110
|
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
111
|
option :follow, aliases: %w[f], type: :boolean, desc: "Follow the log in live tail fashion. Must specify a stack if using this option."
|
117
112
|
option :limit, aliases: %w[n], default: 10, type: :numeric, desc: "Number of lines to limit showing. Only applies in no-follow mode."
|
118
113
|
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
|
-
|
120
|
-
|
114
|
+
option :pid, aliases: %w[p], desc: "Filter by pid. Defaults to the last pid at the bottom of the log file."
|
115
|
+
def logs(action=nil, stack=nil)
|
116
|
+
Logs.new(@options.merge(action: action, stack: stack)).run
|
121
117
|
end
|
122
118
|
|
123
119
|
desc "plan STACK", "Plan stack."
|
@@ -159,7 +155,7 @@ module Terraspace
|
|
159
155
|
long_desc Help.text(:summary)
|
160
156
|
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
157
|
init_option.call
|
162
|
-
option :
|
158
|
+
option :details, type: :boolean, desc: "Show details of the listed resources"
|
163
159
|
def summary
|
164
160
|
Summary.new(options).run
|
165
161
|
end
|
data/lib/terraspace/cli/all.rb
CHANGED
@@ -18,6 +18,12 @@ class Terraspace::CLI
|
|
18
18
|
Terraspace::All::Grapher.new(@options.merge(stacks: stacks)).run
|
19
19
|
end
|
20
20
|
|
21
|
+
desc "init", "Init all or multiple stacks."
|
22
|
+
long_desc Help.text("all/init")
|
23
|
+
def init(*stacks)
|
24
|
+
Terraspace::All::Runner.new("init", @options.merge(stacks: stacks)).run
|
25
|
+
end
|
26
|
+
|
21
27
|
desc "refresh", "Refresh all or multiple stacks."
|
22
28
|
long_desc Help.text("all/refresh")
|
23
29
|
def refresh(*stacks)
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require "terraspace-bundler"
|
2
|
-
TerraspaceBundler.config.logger = Terraspace.logger
|
3
2
|
|
4
3
|
class Terraspace::CLI
|
5
4
|
class Bundle
|
@@ -8,6 +7,8 @@ class Terraspace::CLI
|
|
8
7
|
end
|
9
8
|
|
10
9
|
def run
|
10
|
+
Terraspace.check_project!
|
11
|
+
TerraspaceBundler.config.deep_merge!(Terraspace.config.bundle)
|
11
12
|
TerraspaceBundler::CLI.start(args)
|
12
13
|
end
|
13
14
|
|
data/lib/terraspace/cli/clean.rb
CHANGED
@@ -1,12 +1,24 @@
|
|
1
1
|
class Terraspace::CLI
|
2
|
-
class Clean
|
3
|
-
|
4
|
-
|
2
|
+
class Clean < Terraspace::Command
|
3
|
+
class_option :yes, aliases: :y, type: :boolean, desc: "bypass are you sure prompt"
|
4
|
+
|
5
|
+
desc "all", "Runs all clean operations."
|
6
|
+
long_desc Help.text("clean/all")
|
7
|
+
def all
|
8
|
+
All.new(options).run
|
9
|
+
end
|
10
|
+
|
11
|
+
desc "cache", "Removes cache dirs."
|
12
|
+
long_desc Help.text("clean/cache")
|
13
|
+
def cache
|
14
|
+
Cache.new(options).run
|
5
15
|
end
|
6
16
|
|
7
|
-
|
8
|
-
|
9
|
-
|
17
|
+
desc "logs", "Removes or truncate logs."
|
18
|
+
long_desc Help.text("clean/logs")
|
19
|
+
option :truncate, aliases: :t, type: :boolean, desc: "Truncate instead of remove logs"
|
20
|
+
def logs
|
21
|
+
Logs.new(options).run
|
10
22
|
end
|
11
23
|
end
|
12
24
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class Terraspace::CLI::Clean
|
2
|
+
class All < Base
|
3
|
+
def run
|
4
|
+
are_you_sure?
|
5
|
+
o = @options.merge(yes: true) # override to avoid double prompt
|
6
|
+
Cache.new(o).run
|
7
|
+
Logs.new(o).run
|
8
|
+
end
|
9
|
+
|
10
|
+
def are_you_sure?
|
11
|
+
message = <<~EOL.chomp
|
12
|
+
Will remove Terraspace cache and logs.
|
13
|
+
Are you sure?
|
14
|
+
EOL
|
15
|
+
sure?(message) # from Util::Sure
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class Terraspace::CLI::Clean
|
2
|
+
class Base
|
3
|
+
include Terraspace::Util::Logging
|
4
|
+
include Terraspace::Util::Sure
|
5
|
+
|
6
|
+
def initialize(options={})
|
7
|
+
@options = options
|
8
|
+
Terraspace.check_project!
|
9
|
+
end
|
10
|
+
|
11
|
+
def pretty(path)
|
12
|
+
Terraspace::Util.pretty_path(path)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|