terraspace 0.4.3 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) 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 +32 -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/bundle.rb +0 -1
  17. data/lib/terraspace/cli/check_setup.rb +15 -2
  18. data/lib/terraspace/cli/clean/base.rb +0 -1
  19. data/lib/terraspace/cli/clean/cache.rb +0 -1
  20. data/lib/terraspace/cli/cloud.rb +2 -0
  21. data/lib/terraspace/cli/help/new/arg.md +19 -0
  22. data/lib/terraspace/cli/help/new/helper.md +39 -0
  23. data/lib/terraspace/cli/help/new/hook.md +25 -0
  24. data/lib/terraspace/cli/help/new/test.md +34 -0
  25. data/lib/terraspace/cli/new.rb +22 -16
  26. data/lib/terraspace/cli/new/arg.rb +62 -0
  27. data/lib/terraspace/cli/new/helper.rb +44 -12
  28. data/lib/terraspace/cli/new/helpers.rb +22 -0
  29. data/lib/terraspace/cli/new/helpers/plugin_gem.rb +25 -0
  30. data/lib/terraspace/cli/new/hook.rb +70 -0
  31. data/lib/terraspace/cli/new/module.rb +0 -11
  32. data/lib/terraspace/cli/new/plugin.rb +4 -4
  33. data/lib/terraspace/cli/new/plugin/helper.rb +1 -1
  34. data/lib/terraspace/cli/new/project.rb +16 -7
  35. data/lib/terraspace/cli/new/sequence.rb +3 -10
  36. data/lib/terraspace/cli/new/source/core.rb +1 -1
  37. data/lib/terraspace/cli/new/stack.rb +1 -12
  38. data/lib/terraspace/cli/new/test.rb +50 -0
  39. data/lib/terraspace/cli/summary.rb +0 -1
  40. data/lib/terraspace/command.rb +50 -0
  41. data/lib/terraspace/compiler/builder.rb +2 -0
  42. data/lib/terraspace/compiler/dsl/mod.rb +2 -0
  43. data/lib/terraspace/compiler/dsl/syntax/mod.rb +2 -0
  44. data/lib/terraspace/compiler/dsl/syntax/mod/backend.rb +1 -1
  45. data/lib/terraspace/compiler/erb/context.rb +2 -0
  46. data/lib/terraspace/compiler/helper_extender.rb +27 -0
  47. data/lib/terraspace/core.rb +0 -6
  48. data/lib/terraspace/ext/core/module.rb +16 -0
  49. data/lib/terraspace/hooks/builder.rb +6 -7
  50. data/lib/terraspace/hooks/concern.rb +2 -2
  51. data/lib/terraspace/logger.rb +6 -0
  52. data/lib/terraspace/mod.rb +0 -1
  53. data/lib/terraspace/plugin.rb +8 -4
  54. data/lib/terraspace/plugin/config/interface.rb +2 -2
  55. data/lib/terraspace/plugin/helper/interface.rb +31 -0
  56. data/lib/terraspace/shell.rb +5 -33
  57. data/lib/terraspace/shell/error.rb +46 -0
  58. data/lib/terraspace/terraform/args/custom.rb +2 -3
  59. data/lib/terraspace/terraform/runner.rb +5 -13
  60. data/lib/terraspace/terraform/runner/retryer.rb +69 -0
  61. data/lib/terraspace/version.rb +1 -1
  62. data/spec/terraspace/terraform/args/custom_spec.rb +6 -4
  63. data/terraspace.gemspec +4 -4
  64. metadata +29 -21
  65. data/lib/terraspace/cli/help/new/bootstrap_test.md +0 -8
  66. data/lib/terraspace/cli/help/new/module_test.md +0 -12
  67. data/lib/terraspace/cli/help/new/project_test.md +0 -8
  68. data/lib/terraspace/cli/new/helper/plugin_gem.rb +0 -12
  69. data/lib/terraspace/cli/new/test/base.rb +0 -17
  70. data/lib/terraspace/cli/new/test/bootstrap.rb +0 -18
  71. data/lib/terraspace/cli/new/test/module.rb +0 -15
  72. 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: '09ac4834cd477fb90ceb545d7dc08fdbacbb42231d51c6e0b27698c37ddc2946'
4
- data.tar.gz: 29a223281b24965c0f33096b180f7a49e5f62e7bd74718e71f16e5fdd072ba1c
3
+ metadata.gz: 3046cd50c2a592878bc84dce2fdf21f00fbcf93e4a4fd47a57fe59fbab87adf5
4
+ data.tar.gz: 154ec374284a4758b3e45111653e67d7540ad0ed02661cabd2b5dfa1f79ad35c
5
5
  SHA512:
6
- metadata.gz: 4436cab7ed69ab13e3bda23349c49b3f9e6d3a2fba04b160aba229593aa764f8a7f411c617c1f8892581f4a453a2dcc7c9eb427a976722f40489f518642c0c4a
7
- data.tar.gz: b2f7aded9d6ba98b290d35e02629cb0119eb30a31a22baaa25f44aef94d11fa7a724b534dd9df9d4e918f142d0990743f67e1f49a3412d1df2caf5f08a6819a6
6
+ metadata.gz: ab3def1c9c10a952aef42cbea27de2c645627c69af0ae452baceef36c15ed6f87abd43ab2cda16b0d1f76bc0080a50eb75d802ef6f540e77c13a7796a46ba78f
7
+ data.tar.gz: 2b6e9314e91cd27ef3e19e3a827006dbc081ae8a7ad0d38da445482bc503f978d38575470836f91b1a9a10799fb707d8dacb895818b94a513e46a64f14cbf1da
@@ -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,38 @@
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.3] - 2020-11-27
7
+ - [#60](https://github.com/boltops-tools/terraspace/pull/60) fix terraspace check_setup, use type and allow to run outside project
8
+ - improve terraform is not installed message
9
+
10
+ ## [0.5.2] - 2020-11-27
11
+ - [#59](https://github.com/boltops-tools/terraspace/pull/59) only run bundler/setup within terraspace project and check standalone install
12
+ - fix terraspace help
13
+ - fix terraspace setup check when terraform is not installed
14
+
15
+ ## [0.5.1] - 2020-11-17
16
+ - [#56](https://github.com/boltops-tools/terraspace/pull/56) fix arg and hook generators
17
+ - fix ci build
18
+
19
+ ## [0.5.0] - 2020-11-15
20
+ - [#55](https://github.com/boltops-tools/terraspace/pull/55) custom helpers support
21
+ - plugin helpers support: aws_secret, aws_ssm, google_secret, etc
22
+ - introduce stack-level test concept and change project-level test concept
23
+ - generators: standardize and unifiy new test
24
+ - new generators: arg, hook, helper
25
+ - clean up Terraspace check project
26
+ - setup up autoloader and bundler/setup earlier. removes need for shim
27
+ - test generator plugin autodetection
28
+ - remove internal run_generator_hook_script
29
+ - stack-level args customization support
30
+ - improve test output noise-level
31
+ - new setting: config.terraform.plugin_cache.purge_on_error
32
+ - quiet option for project generator
33
+
34
+ ## [0.4.4]
35
+ - #50 retry logic for shared cache error
36
+ - #51 fix cloud sync: call build first
37
+
6
38
  ## [0.4.3]
7
39
  * #49 add info --path option
8
40
 
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")
@@ -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
@@ -17,7 +17,7 @@ class Terraspace::CLI
17
17
  puts "Detected #{terraform_version_message}"
18
18
  check_required_version!
19
19
  else
20
- puts "Terraform not installed. Unable to detect a terraform command. Please double check that terraform is installed."
20
+ puts terraform_is_not_installed
21
21
  exit 1
22
22
  end
23
23
  end
@@ -38,7 +38,19 @@ class Terraspace::CLI
38
38
  ARGV[0] == "check_setup"
39
39
  end
40
40
 
41
+ def terraform_is_not_installed
42
+ <<~EOL
43
+ Terraform not installed. Unable to detect a terraform command. Please double check that terraform is installed.
44
+ See: https://terraform.cloud/docs/install/terraform/
45
+ EOL
46
+ end
47
+
41
48
  def ok?
49
+ unless terraform_bin
50
+ puts terraform_is_not_installed
51
+ exit 1
52
+ end
53
+
42
54
  version = terraform_version_message.sub(/.*v/,'') # => 0.12.24
43
55
  unless version.match(/\d+\.\d+\.\d+/) # just parse did not find the version number
44
56
  puts "WARN: Unable to get the terraform version".color(:yellow)
@@ -52,7 +64,8 @@ class Terraspace::CLI
52
64
  end
53
65
 
54
66
  def terraform_bin
55
- bin_path = `which terraform 2>&1`.strip
67
+ out = `type terraform 2>&1`.strip
68
+ bin_path = out.match(/is (.*)/)[1]
56
69
  bin_path if $?.success?
57
70
  end
58
71
  memoize :terraform_bin
@@ -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
+ $
@@ -1,5 +1,9 @@
1
1
  class Terraspace::CLI
2
2
  class New < Terraspace::Command
3
+ long_desc Help.text("new/arg")
4
+ Arg.options.each { |args| option(*args) }
5
+ register(Arg, "arg", "arg NAME", "Generates new arg.")
6
+
3
7
  long_desc Help.text("new/git_hook")
4
8
  GitHook.cli_options.each { |args| option(*args) }
5
9
  register(GitHook, "git_hook", "git_hook", "Generates new git hook.")
@@ -8,33 +12,35 @@ class Terraspace::CLI
8
12
  Shim.cli_options.each { |args| option(*args) }
9
13
  register(Shim, "shim", "shim", "Generates terraspace shim.")
10
14
 
15
+ long_desc Help.text("new/helper")
16
+ Helper.options.each { |args| option(*args) }
17
+ register(Helper, "helper", "helper NAME", "Generates new helper.")
18
+
19
+ long_desc Help.text("new/hook")
20
+ Hook.options.each { |args| option(*args) }
21
+ register(Hook, "hook", "hook NAME", "Generates new hook.")
22
+
11
23
  long_desc Help.text("new/module")
12
24
  Module.base_options.each { |args| option(*args) }
13
25
  Module.component_options.each { |args| option(*args) }
14
26
  register(Module, "module", "module NAME", "Generates new module.")
15
27
 
16
- long_desc Help.text("new/stack")
17
- Stack.base_options.each { |args| option(*args) }
18
- Stack.component_options.each { |args| option(*args) }
19
- register(Stack, "stack", "stack NAME", "Generates new stack.")
20
-
21
28
  long_desc Help.text("new/project")
22
29
  Project.base_options.each { |args| option(*args) }
23
30
  Project.project_options.each { |args| option(*args) }
24
31
  register(Project, "project", "project NAME", "Generates new project.")
25
32
 
26
- long_desc Help.text("new/project_test")
27
- register(Test::Project, "project_test", "project_test NAME", "Generates new project test.")
28
-
29
- long_desc Help.text("new/module_test")
30
- register(Test::Module, "module_test", "module_test NAME", "Generates new module test.")
31
-
32
- long_desc Help.text("new/bootstrap_test")
33
- Test::Bootstrap.options.each { |args| option(*args) }
34
- register(Test::Bootstrap, "bootstrap_test", "bootstrap_test", "Generates bootstrap test setup.")
35
-
36
33
  long_desc Help.text("new/plugin")
37
34
  Plugin.options.each { |args| option(*args) }
38
- register(Plugin, "plugin", "plugin", "Generates plugin.")
35
+ register(Plugin, "plugin", "plugin NAME", "Generates plugin.")
36
+
37
+ long_desc Help.text("new/stack")
38
+ Stack.base_options.each { |args| option(*args) }
39
+ Stack.component_options.each { |args| option(*args) }
40
+ register(Stack, "stack", "stack NAME", "Generates new stack.")
41
+
42
+ long_desc Help.text("new/test")
43
+ Test.options.each { |args| option(*args) }
44
+ register(Test, "test", "test NAME", "Generates new test.")
39
45
  end
40
46
  end