terraspace 0.4.1 → 0.5.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 -2
- data/.cody/azurerm/bin/build.sh +2 -2
- data/.cody/google/bin/build.sh +2 -2
- data/.github/ISSUE_TEMPLATE.md +1 -1
- data/CHANGELOG.md +30 -0
- data/README.md +59 -31
- data/lib/templates/base/arg/terraform.rb.tt +3 -0
- data/lib/templates/base/helper/%name%_helper.rb.tt +2 -0
- data/lib/templates/base/hook/%kind%.rb.tt +7 -0
- data/lib/terraspace.rb +7 -4
- data/lib/terraspace/all/base.rb +0 -1
- data/lib/terraspace/app.rb +1 -0
- data/lib/terraspace/autoloader.rb +20 -3
- data/lib/terraspace/cli.rb +2 -0
- data/lib/terraspace/cli/bundle.rb +0 -1
- data/lib/terraspace/cli/clean/base.rb +0 -1
- data/lib/terraspace/cli/clean/cache.rb +0 -1
- data/lib/terraspace/cli/cloud.rb +2 -0
- data/lib/terraspace/cli/help/logs.md +4 -4
- data/lib/terraspace/cli/help/new/arg.md +19 -0
- data/lib/terraspace/cli/help/new/helper.md +39 -0
- data/lib/terraspace/cli/help/new/hook.md +25 -0
- data/lib/terraspace/cli/help/new/test.md +34 -0
- data/lib/terraspace/cli/info.rb +12 -0
- data/lib/terraspace/cli/logs/concern.rb +1 -0
- data/lib/terraspace/cli/new.rb +22 -16
- data/lib/terraspace/cli/new/arg.rb +62 -0
- data/lib/terraspace/cli/new/helper.rb +44 -12
- data/lib/terraspace/cli/new/helpers.rb +22 -0
- data/lib/terraspace/cli/new/helpers/plugin_gem.rb +25 -0
- data/lib/terraspace/cli/new/hook.rb +70 -0
- data/lib/terraspace/cli/new/module.rb +0 -11
- data/lib/terraspace/cli/new/plugin.rb +4 -4
- data/lib/terraspace/cli/new/plugin/helper.rb +1 -1
- data/lib/terraspace/cli/new/project.rb +16 -7
- data/lib/terraspace/cli/new/sequence.rb +3 -10
- data/lib/terraspace/cli/new/source/core.rb +1 -1
- data/lib/terraspace/cli/new/stack.rb +1 -12
- data/lib/terraspace/cli/new/test.rb +50 -0
- data/lib/terraspace/cli/summary.rb +0 -1
- data/lib/terraspace/command.rb +16 -0
- data/lib/terraspace/compiler/builder.rb +2 -0
- data/lib/terraspace/compiler/dsl/mod.rb +2 -0
- data/lib/terraspace/compiler/dsl/syntax/mod.rb +2 -0
- data/lib/terraspace/compiler/dsl/syntax/mod/backend.rb +1 -1
- data/lib/terraspace/compiler/erb/context.rb +2 -0
- data/lib/terraspace/compiler/helper_extender.rb +27 -0
- data/lib/terraspace/core.rb +0 -6
- data/lib/terraspace/ext/core/module.rb +16 -0
- data/lib/terraspace/hooks/builder.rb +6 -7
- data/lib/terraspace/hooks/concern.rb +2 -2
- data/lib/terraspace/logger.rb +6 -0
- data/lib/terraspace/mod.rb +0 -1
- data/lib/terraspace/plugin.rb +8 -4
- data/lib/terraspace/plugin/config/interface.rb +2 -2
- data/lib/terraspace/plugin/helper/interface.rb +31 -0
- data/lib/terraspace/shell.rb +5 -33
- data/lib/terraspace/shell/error.rb +46 -0
- data/lib/terraspace/terraform/args/custom.rb +2 -3
- data/lib/terraspace/terraform/args/default.rb +9 -19
- data/lib/terraspace/terraform/runner.rb +6 -14
- data/lib/terraspace/terraform/runner/retryer.rb +69 -0
- data/lib/terraspace/version.rb +1 -1
- data/spec/terraspace/terraform/args/custom_spec.rb +6 -4
- data/terraspace.gemspec +4 -4
- metadata +29 -21
- data/lib/terraspace/cli/help/new/bootstrap_test.md +0 -8
- data/lib/terraspace/cli/help/new/module_test.md +0 -12
- data/lib/terraspace/cli/help/new/project_test.md +0 -8
- data/lib/terraspace/cli/new/helper/plugin_gem.rb +0 -12
- data/lib/terraspace/cli/new/test/base.rb +0 -17
- data/lib/terraspace/cli/new/test/bootstrap.rb +0 -18
- data/lib/terraspace/cli/new/test/module.rb +0 -15
- data/lib/terraspace/cli/new/test/project.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f43880b8fc93060a328decf3fa5ac770253341995ec800e6d38b86f7696d5912
|
4
|
+
data.tar.gz: 9337cb32f020b54e5693aa2dde06960c22a8fd8755ff55bf1ebb0ebf4cd2fccf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09047e18b86cf30f2a013c7c20f864ef3540120f7f70c12bae854f80f60f952a84e109811ab59aa078e331c0fc34134c9f84dd85f73d7dab5c08ee2208454c17'
|
7
|
+
data.tar.gz: 69eb21940249f6566de22d88dd33165d4265aed490deafc81659ac59d04f7c9b1436ae4b2cbdc09e74f6279e82fdbaa620001610fd2022584dcc599e23bda10e
|
data/.cody/aws/bin/build.sh
CHANGED
@@ -10,6 +10,6 @@ export PATH=~/bin:$PATH # ~/bin/terraspace wrapper
|
|
10
10
|
set -x
|
11
11
|
terraspace new project infra --examples
|
12
12
|
cd infra
|
13
|
-
terraspace new
|
14
|
-
|
13
|
+
terraspace new test demo --type stack
|
14
|
+
cd app/stacks/demo
|
15
15
|
terraspace test
|
data/.cody/azurerm/bin/build.sh
CHANGED
@@ -17,6 +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
|
21
|
-
|
20
|
+
terraspace new test demo --type stack
|
21
|
+
cd app/stacks/demo
|
22
22
|
terraspace test
|
data/.cody/google/bin/build.sh
CHANGED
@@ -14,6 +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
|
18
|
-
|
17
|
+
terraspace new test demo --type stack
|
18
|
+
cd app/stacks/demo
|
19
19
|
terraspace test
|
data/.github/ISSUE_TEMPLATE.md
CHANGED
@@ -2,6 +2,6 @@ Please fill out one of the templates on https://github.com/boltops-tools/terrasp
|
|
2
2
|
|
3
3
|
If you want to ask a question please do so on sites like StackOverflow.
|
4
4
|
|
5
|
-
To be sensitive to everyone's time, we may close issues asking questions without comment. Here are some additional options also https://terraspace.cloud/
|
5
|
+
To be sensitive to everyone's time, we may close issues asking questions without comment. Here are some additional options also https://terraspace.cloud/support/ 👌
|
6
6
|
|
7
7
|
Thank you!
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,36 @@
|
|
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.5.1] - 2020-11-17
|
7
|
+
- [#56](https://github.com/boltops-tools/terraspace/pull/56) fix arg and hook generators
|
8
|
+
- fix ci build
|
9
|
+
|
10
|
+
## [0.5.0] - 2020-11-15
|
11
|
+
- [#55](https://github.com/boltops-tools/terraspace/pull/55) custom helpers support
|
12
|
+
- plugin helpers support: aws_secret, aws_ssm, google_secret, etc
|
13
|
+
- introduce stack-level test concept and change project-level test concept
|
14
|
+
- generators: standardize and unifiy new test
|
15
|
+
- new generators: arg, hook, helper
|
16
|
+
- clean up Terraspace check project
|
17
|
+
- setup up autoloader and bundler/setup earlier. removes need for shim
|
18
|
+
- test generator plugin autodetection
|
19
|
+
- remove internal run_generator_hook_script
|
20
|
+
- stack-level args customization support
|
21
|
+
- improve test output noise-level
|
22
|
+
- new setting: config.terraform.plugin_cache.purge_on_error
|
23
|
+
- quiet option for project generator
|
24
|
+
|
25
|
+
## [0.4.4]
|
26
|
+
- #50 retry logic for shared cache error
|
27
|
+
- #51 fix cloud sync: call build first
|
28
|
+
|
29
|
+
## [0.4.3]
|
30
|
+
* #49 add info --path option
|
31
|
+
|
32
|
+
## [0.4.2]
|
33
|
+
* #48 add logs pid option
|
34
|
+
* default to input false, encourage set tfvars
|
35
|
+
|
6
36
|
## [0.4.1]
|
7
37
|
* #47 `terraspace list` fix and `terraspace all init` help updates
|
8
38
|
|
data/README.md
CHANGED
@@ -29,68 +29,96 @@ 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
|
|
88
106
|
* [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
107
|
* [Generators](https://terraspace.cloud/docs/generators/): Built-in generators to quickly create the starter module. Focus on code instead of boilerplate structure.
|
90
|
-
* [Tfvars](https://terraspace.cloud/docs/tfvars/) & [Layering](https://terraspace.cloud/docs/tfvars/layering/)
|
108
|
+
* [Multiple Environments](https://terraspace.cloud/docs/patterns/multiple-envs/): [Tfvars](https://terraspace.cloud/docs/tfvars/) & [Layering](https://terraspace.cloud/docs/tfvars/layering/) allow you to 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/).
|
92
|
-
* [
|
110
|
+
* [Secrets Support](https://terraspace.cloud/docs/helpers/aws/secrets/): Terraspace has built-in secrets support for [AWS Secrets Manager](https://terraspace.cloud/docs/helpers/aws/secrets/), [AWS SSM Parameter Store](https://terraspace.cloud/docs/helpers/aws/ssm/), [Azure Key Vault](https://terraspace.cloud/docs/helpers/azure/secrets/), [Google Secrets Manager](https://terraspace.cloud/docs/helpers/google/secrets/). Easily set variables from Cloud secrets providers.
|
111
|
+
* [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.
|
112
|
+
* [Configurable CLI](https://terraspace.cloud/docs/config/args/): Configurable [CLI Hooks](https://terraspace.cloud/docs/config/hooks/) and [CLI Args](https://terraspace.cloud/docs/config/args/) allow you to adjust the underlying terraform command.
|
93
113
|
* [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
114
|
* [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
115
|
|
96
|
-
|
116
|
+
## Comparison
|
117
|
+
|
118
|
+
Here are some useful comparisons to help you compare Terraspace vs other tools in the ecosystem:
|
119
|
+
|
120
|
+
* [Terraspace vs Custom Solution](https://terraspace.cloud/docs/vs/custom/)
|
121
|
+
* [Terraspace vs Terraform](https://terraspace.cloud/docs/vs/terraform/)
|
122
|
+
* [Terraform vs Terragrunt vs Terraspace](https://blog.boltops.com/2020/09/28/terraform-vs-terragrunt-vs-terraspace)
|
123
|
+
|
124
|
+
More info: [terraspace.cloud](https://terraspace.cloud)
|
data/lib/terraspace.rb
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
$stdout.sync = true unless ENV["TS_STDOUT_SYNC"] == "0"
|
2
2
|
|
3
3
|
$:.unshift(File.expand_path("../", __FILE__))
|
4
|
+
|
5
|
+
require "terraspace/autoloader"
|
6
|
+
Terraspace::Autoloader.setup
|
7
|
+
|
4
8
|
require "active_support/concern"
|
5
9
|
require "active_support/core_ext/class"
|
6
10
|
require "active_support/core_ext/hash"
|
@@ -18,16 +22,15 @@ require "set"
|
|
18
22
|
require "terraspace/ext"
|
19
23
|
require "terraspace/version"
|
20
24
|
|
21
|
-
require "terraspace/autoloader"
|
22
|
-
Terraspace::Autoloader.setup
|
23
|
-
|
24
25
|
DslEvaluator.backtrace_reject = "lib/terraspace"
|
25
26
|
|
26
27
|
module Terraspace
|
27
28
|
extend Core # for Terraspace.root
|
28
29
|
class Error < StandardError; end
|
29
|
-
|
30
|
+
|
30
31
|
class BucketNotFoundError < Error; end
|
32
|
+
class InitRequiredError < Error; end
|
33
|
+
class SharedCacheError < Error; end
|
31
34
|
end
|
32
35
|
|
33
36
|
Terraspace::Booter.boot
|
data/lib/terraspace/all/base.rb
CHANGED
data/lib/terraspace/app.rb
CHANGED
@@ -47,6 +47,7 @@ module Terraspace
|
|
47
47
|
config.terraform.plugin_cache = ActiveSupport::OrderedOptions.new
|
48
48
|
config.terraform.plugin_cache.dir = ENV['TF_PLUGIN_CACHE_DIR'] || "#{Terraspace.tmp_root}/plugin_cache"
|
49
49
|
config.terraform.plugin_cache.enabled = true
|
50
|
+
config.terraform.plugin_cache.purge_on_error = true
|
50
51
|
config.test_framework = "rspec"
|
51
52
|
config
|
52
53
|
end
|
@@ -1,8 +1,15 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
if File.exist?("config/app.rb")
|
2
|
+
require "terraspace/bundle"
|
3
|
+
Terraspace::Bundle.setup
|
4
|
+
end
|
3
5
|
require "zeitwerk"
|
4
6
|
|
5
7
|
module Terraspace
|
8
|
+
# These modules are namespaces for user-defined custom helpers
|
9
|
+
module Module; end
|
10
|
+
module Project; end
|
11
|
+
module Stack; end
|
12
|
+
|
6
13
|
class Autoloader
|
7
14
|
class Inflector < Zeitwerk::Inflector
|
8
15
|
def camelize(basename, _abspath)
|
@@ -16,10 +23,20 @@ module Terraspace
|
|
16
23
|
loader = Zeitwerk::Loader.new
|
17
24
|
loader.inflector = Inflector.new
|
18
25
|
loader.push_dir(File.dirname(__dir__)) # lib
|
26
|
+
loader.push_dir(project_helpers, namespace: Terraspace::Project) if File.exist?(project_helpers)
|
19
27
|
loader.log! if ENV["TS_AUTOLOAD_LOG"]
|
20
|
-
loader.ignore("#{__dir__}/
|
28
|
+
loader.ignore("#{__dir__}/ext.rb")
|
21
29
|
loader.setup
|
22
30
|
end
|
31
|
+
|
32
|
+
def project_helpers
|
33
|
+
"#{ts_root}/config/helpers"
|
34
|
+
end
|
35
|
+
|
36
|
+
# Duplicate definition because autoloader logic runs very early and doesnt have access to core methods yet
|
37
|
+
def ts_root
|
38
|
+
ENV['TS_ROOT'] || Dir.pwd
|
39
|
+
end
|
23
40
|
end
|
24
41
|
end
|
25
42
|
end
|
data/lib/terraspace/cli.rb
CHANGED
@@ -86,6 +86,7 @@ module Terraspace
|
|
86
86
|
long_desc Help.text(:info)
|
87
87
|
instance_option.call
|
88
88
|
option :format, desc: "Output formats: #{CliFormat.formats.join(', ')}"
|
89
|
+
option :path, desc: "Print path to built path"
|
89
90
|
def info(mod)
|
90
91
|
Info.new(options.merge(mod: mod)).run
|
91
92
|
end
|
@@ -110,6 +111,7 @@ module Terraspace
|
|
110
111
|
option :follow, aliases: %w[f], type: :boolean, desc: "Follow the log in live tail fashion. Must specify a stack if using this option."
|
111
112
|
option :limit, aliases: %w[n], default: 10, type: :numeric, desc: "Number of lines to limit showing. Only applies in no-follow mode."
|
112
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."
|
114
|
+
option :pid, aliases: %w[p], desc: "Filter by pid. Defaults to the last pid at the bottom of the log file."
|
113
115
|
def logs(action=nil, stack=nil)
|
114
116
|
Logs.new(@options.merge(action: action, stack: stack)).run
|
115
117
|
end
|
data/lib/terraspace/cli/cloud.rb
CHANGED
@@ -16,6 +16,7 @@ class Terraspace::CLI
|
|
16
16
|
|
17
17
|
desc "destroy STACK", "Destroy workspace by specifying the stack"
|
18
18
|
long_desc Help.text("cloud:destroy")
|
19
|
+
yes_option.call
|
19
20
|
def destroy(mod)
|
20
21
|
Workspace.new(options.merge(mod: mod)).destroy
|
21
22
|
end
|
@@ -24,6 +25,7 @@ class Terraspace::CLI
|
|
24
25
|
long_desc Help.text("cloud:sync")
|
25
26
|
yes_option.call
|
26
27
|
def sync(*stacks)
|
28
|
+
Terraspace::CLI::Build::Placeholder.new(options).build
|
27
29
|
Syncer.new(options.merge(stacks: stacks, override_auto_sync: true)).run
|
28
30
|
end
|
29
31
|
|
@@ -12,12 +12,12 @@ Note, Terraspace automatically checks every second for new logs and adds them to
|
|
12
12
|
|
13
13
|
View last 10 lines of each log file.
|
14
14
|
|
15
|
-
terraspace logs up network # view up log on specific stack
|
15
|
+
terraspace logs up network # view up log on a specific stack
|
16
16
|
terraspace logs up # view all up logs
|
17
17
|
terraspace logs down # view all down logs
|
18
18
|
terraspace logs # view all logs: up, down, etc
|
19
19
|
|
20
|
-
By default, the
|
20
|
+
By default, the logs command shows the last 10 lines for each log file. You can use the `-n` option to adjust this.
|
21
21
|
|
22
22
|
terraspace logs -n 2 # view last 2 lines of all logs: up, down, etc
|
23
23
|
|
@@ -31,14 +31,14 @@ Note, if both an action and stack is specified, then it defaults to showing all
|
|
31
31
|
|
32
32
|
To tail logs, use the `-f` option.
|
33
33
|
|
34
|
-
terraspace logs up network -f # view up log on specific stack
|
34
|
+
terraspace logs up network -f # view up log on a specific stack
|
35
35
|
terraspace logs up -f # view all up logs
|
36
36
|
terraspace logs down -f # view all down logs
|
37
37
|
terraspace logs -f # view all logs: up, down, etc
|
38
38
|
|
39
39
|
## Timestamps
|
40
40
|
|
41
|
-
The timestamps are shown by default when you are looking for multiple files. When you specify both the action and stack for a single log file,
|
41
|
+
The timestamps are shown by default when you are looking for multiple files. When you specify both the action and stack for a single log file, the timestamps are not shown.
|
42
42
|
|
43
43
|
terraspace logs up # timestamps will be shown in this case
|
44
44
|
terraspace logs up network # timestamps not be shown in this case
|
@@ -0,0 +1,19 @@
|
|
1
|
+
## Examples
|
2
|
+
|
3
|
+
Project-level arg:
|
4
|
+
|
5
|
+
$ terraspace new arg --type project
|
6
|
+
create config/args
|
7
|
+
create config/args/terraform.rb
|
8
|
+
|
9
|
+
Stack-level arg:
|
10
|
+
|
11
|
+
$ terraspace new arg demo --type stack
|
12
|
+
create app/stacks/demo/config/args
|
13
|
+
create app/stacks/demo/config/args/terraform.rb
|
14
|
+
|
15
|
+
Module-level arg:
|
16
|
+
|
17
|
+
$ terraspace new arg example --type module
|
18
|
+
create app/modules/example/config/args
|
19
|
+
create app/modules/example/config/args/terraform.rb
|
@@ -0,0 +1,39 @@
|
|
1
|
+
## Project Examples
|
2
|
+
|
3
|
+
Conventionally name the helper custom.
|
4
|
+
|
5
|
+
$ terraspace new helper custom --type project
|
6
|
+
create config/helpers
|
7
|
+
create config/helpers/custom_helper.rb
|
8
|
+
|
9
|
+
## Stack Examples
|
10
|
+
|
11
|
+
Conventionally name the helper to be the same as the stack name.
|
12
|
+
|
13
|
+
$ terraspace new helper demo --type stack
|
14
|
+
create app/stacks/demo/config/helpers
|
15
|
+
create app/stacks/demo/config/helpers/demo_helper.rb
|
16
|
+
$
|
17
|
+
|
18
|
+
Explictly name helper method. IE: custom here.
|
19
|
+
|
20
|
+
$ terraspace new helper demo --type stack --name custom
|
21
|
+
create app/stacks/demo/config/helpers
|
22
|
+
create app/stacks/demo/config/helpers/custom_helper.rb
|
23
|
+
$
|
24
|
+
|
25
|
+
## Module Examples
|
26
|
+
|
27
|
+
Conventionally name the helper to be the same as the module name.
|
28
|
+
|
29
|
+
$ terraspace new helper example --type module
|
30
|
+
create app/module/example/config/helpers
|
31
|
+
create app/module/example/config/helpers/example_helper.rb
|
32
|
+
$
|
33
|
+
|
34
|
+
Explictly name helper method. IE: custom here.
|
35
|
+
|
36
|
+
$ terraspace new helper example --type module --name custom
|
37
|
+
create app/module/example/config/helpers
|
38
|
+
create app/module/example/config/helpers/custom_helper.rb
|
39
|
+
$
|