terraspace 0.4.2 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/.cody/aws/bin/build.sh +2 -2
  3. data/.cody/azurerm/bin/build.sh +2 -2
  4. data/.cody/google/bin/build.sh +2 -2
  5. data/.github/ISSUE_TEMPLATE.md +1 -1
  6. data/CHANGELOG.md +31 -0
  7. data/README.md +4 -3
  8. data/lib/templates/base/arg/terraform.rb.tt +3 -0
  9. data/lib/templates/base/helper/%name%_helper.rb.tt +2 -0
  10. data/lib/templates/base/hook/%kind%.rb.tt +7 -0
  11. data/lib/terraspace.rb +7 -4
  12. data/lib/terraspace/all/base.rb +0 -1
  13. data/lib/terraspace/app.rb +1 -0
  14. data/lib/terraspace/autoloader.rb +16 -1
  15. data/lib/terraspace/bundle.rb +6 -0
  16. data/lib/terraspace/cli.rb +1 -0
  17. data/lib/terraspace/cli/bundle.rb +0 -1
  18. data/lib/terraspace/cli/check_setup.rb +5 -0
  19. data/lib/terraspace/cli/clean/base.rb +0 -1
  20. data/lib/terraspace/cli/clean/cache.rb +0 -1
  21. data/lib/terraspace/cli/cloud.rb +2 -0
  22. data/lib/terraspace/cli/help/new/arg.md +19 -0
  23. data/lib/terraspace/cli/help/new/helper.md +39 -0
  24. data/lib/terraspace/cli/help/new/hook.md +25 -0
  25. data/lib/terraspace/cli/help/new/test.md +34 -0
  26. data/lib/terraspace/cli/info.rb +12 -0
  27. data/lib/terraspace/cli/new.rb +22 -16
  28. data/lib/terraspace/cli/new/arg.rb +62 -0
  29. data/lib/terraspace/cli/new/helper.rb +44 -12
  30. data/lib/terraspace/cli/new/helpers.rb +22 -0
  31. data/lib/terraspace/cli/new/helpers/plugin_gem.rb +25 -0
  32. data/lib/terraspace/cli/new/hook.rb +70 -0
  33. data/lib/terraspace/cli/new/module.rb +0 -11
  34. data/lib/terraspace/cli/new/plugin.rb +4 -4
  35. data/lib/terraspace/cli/new/plugin/helper.rb +1 -1
  36. data/lib/terraspace/cli/new/project.rb +16 -7
  37. data/lib/terraspace/cli/new/sequence.rb +3 -10
  38. data/lib/terraspace/cli/new/source/core.rb +1 -1
  39. data/lib/terraspace/cli/new/stack.rb +1 -12
  40. data/lib/terraspace/cli/new/test.rb +50 -0
  41. data/lib/terraspace/cli/summary.rb +0 -1
  42. data/lib/terraspace/command.rb +50 -0
  43. data/lib/terraspace/compiler/builder.rb +2 -0
  44. data/lib/terraspace/compiler/dsl/mod.rb +2 -0
  45. data/lib/terraspace/compiler/dsl/syntax/mod.rb +2 -0
  46. data/lib/terraspace/compiler/dsl/syntax/mod/backend.rb +1 -1
  47. data/lib/terraspace/compiler/erb/context.rb +2 -0
  48. data/lib/terraspace/compiler/helper_extender.rb +27 -0
  49. data/lib/terraspace/core.rb +0 -6
  50. data/lib/terraspace/ext/core/module.rb +16 -0
  51. data/lib/terraspace/hooks/builder.rb +6 -7
  52. data/lib/terraspace/hooks/concern.rb +2 -2
  53. data/lib/terraspace/logger.rb +6 -0
  54. data/lib/terraspace/mod.rb +0 -1
  55. data/lib/terraspace/plugin.rb +8 -4
  56. data/lib/terraspace/plugin/config/interface.rb +2 -2
  57. data/lib/terraspace/plugin/helper/interface.rb +31 -0
  58. data/lib/terraspace/shell.rb +5 -33
  59. data/lib/terraspace/shell/error.rb +46 -0
  60. data/lib/terraspace/terraform/args/custom.rb +2 -3
  61. data/lib/terraspace/terraform/runner.rb +5 -13
  62. data/lib/terraspace/terraform/runner/retryer.rb +69 -0
  63. data/lib/terraspace/version.rb +1 -1
  64. data/spec/terraspace/terraform/args/custom_spec.rb +6 -4
  65. data/terraspace.gemspec +4 -4
  66. metadata +29 -21
  67. data/lib/terraspace/cli/help/new/bootstrap_test.md +0 -8
  68. data/lib/terraspace/cli/help/new/module_test.md +0 -12
  69. data/lib/terraspace/cli/help/new/project_test.md +0 -8
  70. data/lib/terraspace/cli/new/helper/plugin_gem.rb +0 -12
  71. data/lib/terraspace/cli/new/test/base.rb +0 -17
  72. data/lib/terraspace/cli/new/test/bootstrap.rb +0 -18
  73. data/lib/terraspace/cli/new/test/module.rb +0 -15
  74. 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: 0174dca33a15bfe2c0eb0a1e0f573599ab7de2850d746e6f0be4e34aec573e39
4
- data.tar.gz: 4d2b91fb5631d3fa1c32379845cc1f3d677238edc7133015cf99050e874339f4
3
+ metadata.gz: f6a2a88fa818f4181306424fffdba0416c2df409e464b632ea941e761b8ed275
4
+ data.tar.gz: eaf2ce61be5ff4b72f01e6f4ca9da7eb4ee573f42e5865319a90630659544c2e
5
5
  SHA512:
6
- metadata.gz: b624c36518fd03e4b03c8ddba62dc196ea656f26921086ddb3dec4859f613b3da2534f0320f0c6197a53fd31d9f5a44ad98f5c5c4b3914164185707a42eb007e
7
- data.tar.gz: 87b7625d52efd046193ec7ed9abfb7e311b7b143d70e492db84e60cccb4b90fea872d1f6333901d95a6c9af7d07bf2d5027980aa482794d5f60b27ed9a8e3e41
6
+ metadata.gz: b6b38903334e7855e19517ec79059dd9887d85aa44819ed811af0deedaae8fbed5d8502546e675302c786604a7c110313a27b312a5489cff26071a9c784e8bd0
7
+ data.tar.gz: f117135d46f25c238e89a459666ade7fe4ef944726abae05fe9af4e6101e42198d5f91d39e06f42bfbb20f987f172ac4b677d08e3bf66c84272c0746751fdcfe
@@ -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 bootstrap_test
14
- terraspace new project_test demo --examples
13
+ terraspace new test demo --type stack
14
+ cd app/stacks/demo
15
15
  terraspace test
@@ -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 bootstrap_test
21
- terraspace new project_test demo --examples --plugin azurerm
20
+ terraspace new test demo --type stack
21
+ cd app/stacks/demo
22
22
  terraspace test
@@ -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 bootstrap_test
18
- terraspace new project_test demo --examples --plugin google
17
+ terraspace new test demo --type stack
18
+ cd app/stacks/demo
19
19
  terraspace test
@@ -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/docs/support/ 👌
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!
@@ -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.5.2] - 2020-11-27
7
+ - [#59](https://github.com/boltops-tools/terraspace/pull/59) only run bundler/setup within terraspace project and check standalone install
8
+ - fix terraspace help
9
+ - fix terraspace setup check when terraform is not installed
10
+
11
+ ## [0.5.1] - 2020-11-17
12
+ - [#56](https://github.com/boltops-tools/terraspace/pull/56) fix arg and hook generators
13
+ - fix ci build
14
+
15
+ ## [0.5.0] - 2020-11-15
16
+ - [#55](https://github.com/boltops-tools/terraspace/pull/55) custom helpers support
17
+ - plugin helpers support: aws_secret, aws_ssm, google_secret, etc
18
+ - introduce stack-level test concept and change project-level test concept
19
+ - generators: standardize and unifiy new test
20
+ - new generators: arg, hook, helper
21
+ - clean up Terraspace check project
22
+ - setup up autoloader and bundler/setup earlier. removes need for shim
23
+ - test generator plugin autodetection
24
+ - remove internal run_generator_hook_script
25
+ - stack-level args customization support
26
+ - improve test output noise-level
27
+ - new setting: config.terraform.plugin_cache.purge_on_error
28
+ - quiet option for project generator
29
+
30
+ ## [0.4.4]
31
+ - #50 retry logic for shared cache error
32
+ - #51 fix cloud sync: call build first
33
+
34
+ ## [0.4.3]
35
+ * #49 add info --path option
36
+
6
37
  ## [0.4.2]
7
38
  * #48 add logs pid option
8
39
  * default to input false, encourage set tfvars
data/README.md CHANGED
@@ -105,10 +105,11 @@ To install modules:
105
105
 
106
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/).
107
107
  * [Generators](https://terraspace.cloud/docs/generators/): Built-in generators to quickly create the starter module. Focus on code instead of boilerplate structure.
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/).
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/).
109
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.
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.
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.
112
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.
113
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.
114
115
 
@@ -0,0 +1,3 @@
1
+ command("<%= name %>",
2
+ args: ["-lock-timeout=22m"],
3
+ )
@@ -0,0 +1,2 @@
1
+ module <%= helper_class %>
2
+ end
@@ -0,0 +1,7 @@
1
+ before("<%= name %>",
2
+ execute: "echo '<%= hook_path %>: test <%= type %> before hook for <%= kind %> <%= name %>'",
3
+ )
4
+
5
+ after("<%= name %>",
6
+ execute: "echo '<%= hook_path %>: test <%= type %> after hook for <%= kind %> <%= name %>'"
7
+ )
@@ -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
- class InitRequiredError < Error; end
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
@@ -2,7 +2,6 @@ module Terraspace::All
2
2
  class Base
3
3
  def initialize(options={})
4
4
  @options = options
5
- Terraspace.check_project! unless ENV['TS_TEST']
6
5
  end
7
6
  end
8
7
  end
@@ -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
@@ -3,6 +3,11 @@ Terraspace::Bundle.setup
3
3
  require "zeitwerk"
4
4
 
5
5
  module Terraspace
6
+ # These modules are namespaces for user-defined custom helpers
7
+ module Module; end
8
+ module Project; end
9
+ module Stack; end
10
+
6
11
  class Autoloader
7
12
  class Inflector < Zeitwerk::Inflector
8
13
  def camelize(basename, _abspath)
@@ -16,10 +21,20 @@ module Terraspace
16
21
  loader = Zeitwerk::Loader.new
17
22
  loader.inflector = Inflector.new
18
23
  loader.push_dir(File.dirname(__dir__)) # lib
24
+ loader.push_dir(project_helpers, namespace: Terraspace::Project) if File.exist?(project_helpers)
19
25
  loader.log! if ENV["TS_AUTOLOAD_LOG"]
20
- loader.ignore("#{__dir__}/core_ext.rb")
26
+ loader.ignore("#{__dir__}/ext.rb")
21
27
  loader.setup
22
28
  end
29
+
30
+ def project_helpers
31
+ "#{ts_root}/config/helpers"
32
+ end
33
+
34
+ # Duplicate definition because autoloader logic runs very early and doesnt have access to core methods yet
35
+ def ts_root
36
+ ENV['TS_ROOT'] || Dir.pwd
37
+ end
23
38
  end
24
39
  end
25
40
  end
@@ -8,6 +8,7 @@ module Terraspace
8
8
  #
9
9
  def setup
10
10
  return unless gemfile?
11
+ return unless terraspace_project?
11
12
  Kernel.require "bundler/setup"
12
13
  Bundler.setup # Same as Bundler.setup(:default)
13
14
  rescue LoadError => e
@@ -16,12 +17,17 @@ module Terraspace
16
17
 
17
18
  def require
18
19
  return unless gemfile?
20
+ return unless terraspace_project?
19
21
  Kernel.require "bundler/setup"
20
22
  Bundler.require(*bundler_groups)
21
23
  rescue LoadError => e
22
24
  handle_error(e)
23
25
  end
24
26
 
27
+ def terraspace_project?
28
+ File.exist?("config/app.rb")
29
+ end
30
+
25
31
  def handle_error(e)
26
32
  puts e.message
27
33
  return if e.message.include?("already activated")
@@ -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
@@ -7,7 +7,6 @@ class Terraspace::CLI
7
7
  end
8
8
 
9
9
  def run
10
- Terraspace.check_project!
11
10
  TerraspaceBundler.config.deep_merge!(Terraspace.config.bundle)
12
11
  TerraspaceBundler::CLI.start(args)
13
12
  end
@@ -39,6 +39,11 @@ class Terraspace::CLI
39
39
  end
40
40
 
41
41
  def ok?
42
+ unless terraform_bin
43
+ puts "Terraform not installed. Unable to detect a terraform command. Please double check that terraform is installed."
44
+ exit 1
45
+ end
46
+
42
47
  version = terraform_version_message.sub(/.*v/,'') # => 0.12.24
43
48
  unless version.match(/\d+\.\d+\.\d+/) # just parse did not find the version number
44
49
  puts "WARN: Unable to get the terraform version".color(:yellow)
@@ -5,7 +5,6 @@ class Terraspace::CLI::Clean
5
5
 
6
6
  def initialize(options={})
7
7
  @options = options
8
- Terraspace.check_project!
9
8
  end
10
9
 
11
10
  def pretty(path)
@@ -1,7 +1,6 @@
1
1
  class Terraspace::CLI::Clean
2
2
  class Cache < Base
3
3
  def run
4
- Terraspace.check_project!
5
4
  paths = [Terraspace.cache_root, Terraspace.tmp_root]
6
5
  are_you_sure?(paths)
7
6
  paths.each do |path|
@@ -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
 
@@ -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
+ $
@@ -0,0 +1,25 @@
1
+ ## Examples
2
+
3
+ Project-level hook:
4
+
5
+ $ terraspace new hook --type project
6
+ create config/hooks
7
+ create config/hooks/terraform.rb
8
+
9
+ Stack-level hook:
10
+
11
+ $ terraspace new hook demo --type stack
12
+ create app/stacks/demo/config/hooks
13
+ create app/stacks/demo/config/hooks/terraform.rb
14
+
15
+ Stack-level hook with kind option:
16
+
17
+ $ terraspace new hook demo --type stack --kind terraspace
18
+ exist app/stacks/demo/config/hooks
19
+ create app/stacks/demo/config/hooks/terraspace.rb
20
+
21
+ Module-level hook:
22
+
23
+ $ terraspace new hook example --type module
24
+ create app/modules/example/config/hooks
25
+ create app/modules/example/config/hooks/terraform.rb
@@ -0,0 +1,34 @@
1
+ ## Stack Examples
2
+
3
+ $ terraspace new test demo --type stack
4
+ => Creating stack test: example
5
+ exist app/stacks/example
6
+ create app/stacks/example/test/.rspec
7
+ create app/stacks/example/test/Gemfile
8
+ create app/stacks/example/test/spec/fixtures/stack/main.tf
9
+ create app/stacks/example/test/spec/fixtures/stack/outputs.tf
10
+ create app/stacks/example/test/spec/main_spec.rb
11
+ create app/stacks/example/test/spec/spec_helper.rb
12
+ $
13
+
14
+ ## Module Examples
15
+
16
+ $ terraspace new test example --type module
17
+ => Creating module test: example
18
+ exist app/modules/example
19
+ create app/modules/example/test/.rspec
20
+ create app/modules/example/test/Gemfile
21
+ create app/modules/example/test/spec/fixtures/stack/main.tf
22
+ create app/modules/example/test/spec/fixtures/stack/outputs.tf
23
+ create app/modules/example/test/spec/main_spec.rb
24
+ create app/modules/example/test/spec/spec_helper.rb
25
+ $
26
+
27
+ ## Project Examples
28
+
29
+ $ terraspace new test my --type project
30
+ => Creating test bootstrap structure
31
+ exist
32
+ create .rspec
33
+ create spec/spec_helper.rb
34
+ $
@@ -3,6 +3,14 @@ class Terraspace::CLI
3
3
  extend Memoist
4
4
 
5
5
  def run
6
+ if @options[:path]
7
+ show_path
8
+ else
9
+ show_all
10
+ end
11
+ end
12
+
13
+ def show_all
6
14
  presenter = CliFormat::Presenter.new(@options)
7
15
  presenter.header = %w[Name Value]
8
16
  info.each do |k,v|
@@ -11,6 +19,10 @@ class Terraspace::CLI
11
19
  presenter.show
12
20
  end
13
21
 
22
+ def show_path
23
+ puts info[:cache_dir]
24
+ end
25
+
14
26
  def info
15
27
  @mod.to_info
16
28
  end