terraspace 0.4.0 → 0.5.0

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/CHANGELOG.md +30 -0
  3. data/README.md +57 -30
  4. data/lib/templates/base/arg/terraform.rb.tt +3 -0
  5. data/lib/templates/base/helper/%name%_helper.rb.tt +2 -0
  6. data/lib/templates/base/hook/%kind%.rb.tt +7 -0
  7. data/lib/terraspace.rb +7 -4
  8. data/lib/terraspace/all/base.rb +0 -1
  9. data/lib/terraspace/app.rb +1 -0
  10. data/lib/terraspace/autoloader.rb +20 -3
  11. data/lib/terraspace/cli.rb +2 -0
  12. data/lib/terraspace/cli/all.rb +1 -1
  13. data/lib/terraspace/cli/bundle.rb +0 -1
  14. data/lib/terraspace/cli/clean/base.rb +0 -1
  15. data/lib/terraspace/cli/clean/cache.rb +0 -1
  16. data/lib/terraspace/cli/cloud.rb +2 -0
  17. data/lib/terraspace/cli/help/all/init.md +33 -0
  18. data/lib/terraspace/cli/help/logs.md +4 -4
  19. data/lib/terraspace/cli/help/new/arg.md +19 -0
  20. data/lib/terraspace/cli/help/new/helper.md +39 -0
  21. data/lib/terraspace/cli/help/new/hook.md +25 -0
  22. data/lib/terraspace/cli/help/new/test.md +34 -0
  23. data/lib/terraspace/cli/info.rb +12 -0
  24. data/lib/terraspace/cli/list.rb +2 -1
  25. data/lib/terraspace/cli/logs/concern.rb +1 -0
  26. data/lib/terraspace/cli/new.rb +22 -16
  27. data/lib/terraspace/cli/new/arg.rb +62 -0
  28. data/lib/terraspace/cli/new/helper.rb +44 -12
  29. data/lib/terraspace/cli/new/helpers.rb +22 -0
  30. data/lib/terraspace/cli/new/helpers/plugin_gem.rb +25 -0
  31. data/lib/terraspace/cli/new/hook.rb +70 -0
  32. data/lib/terraspace/cli/new/module.rb +0 -11
  33. data/lib/terraspace/cli/new/plugin.rb +4 -4
  34. data/lib/terraspace/cli/new/plugin/helper.rb +1 -1
  35. data/lib/terraspace/cli/new/project.rb +16 -7
  36. data/lib/terraspace/cli/new/sequence.rb +3 -10
  37. data/lib/terraspace/cli/new/source/core.rb +1 -1
  38. data/lib/terraspace/cli/new/stack.rb +1 -12
  39. data/lib/terraspace/cli/new/test.rb +50 -0
  40. data/lib/terraspace/cli/summary.rb +0 -1
  41. data/lib/terraspace/command.rb +16 -0
  42. data/lib/terraspace/compiler/builder.rb +2 -0
  43. data/lib/terraspace/compiler/dsl/mod.rb +2 -0
  44. data/lib/terraspace/compiler/dsl/syntax/mod.rb +2 -0
  45. data/lib/terraspace/compiler/dsl/syntax/mod/backend.rb +1 -1
  46. data/lib/terraspace/compiler/erb/context.rb +2 -0
  47. data/lib/terraspace/compiler/helper_extender.rb +27 -0
  48. data/lib/terraspace/core.rb +0 -6
  49. data/lib/terraspace/ext/core/module.rb +16 -0
  50. data/lib/terraspace/hooks/builder.rb +6 -7
  51. data/lib/terraspace/hooks/concern.rb +2 -2
  52. data/lib/terraspace/logger.rb +6 -0
  53. data/lib/terraspace/mod.rb +0 -1
  54. data/lib/terraspace/plugin.rb +8 -4
  55. data/lib/terraspace/plugin/config/interface.rb +2 -2
  56. data/lib/terraspace/plugin/helper/interface.rb +31 -0
  57. data/lib/terraspace/shell.rb +5 -33
  58. data/lib/terraspace/shell/error.rb +46 -0
  59. data/lib/terraspace/terraform/args/custom.rb +2 -3
  60. data/lib/terraspace/terraform/args/default.rb +9 -19
  61. data/lib/terraspace/terraform/runner.rb +6 -14
  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 +30 -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: 6b99a86e9b9b829fa0ac1b04a6774b02a43e67642219ea3f22aeb663869bfec6
4
- data.tar.gz: f2b265d5e13a86949ddb753e991fc8784c77361909162123dfd7d06d0c1c3555
3
+ metadata.gz: bbf29f1226e7dc336c0eaf99892e158aff3b804bd56bbd1dc744fd17a65c6ff0
4
+ data.tar.gz: 6c32f1fe94e9dc53f6ddbfca3cef7c1178a11d788b32ad6ad3fdc88d64e268fa
5
5
  SHA512:
6
- metadata.gz: 7fd4d65aac675d439e5e23089db75f937e3f50c72158099d1088112db67ed97c93afef6c47e0555cdde5a6dfe3e175ede017fc9e509c5419128c53ee114de91d
7
- data.tar.gz: 4ef8b0354c0e8dd14ccd074bc6ecd2cda96f80c846bfd3dc790dce4cf20f36efbe236020eff587555032ec1dd869ec405cde649a348e232e747ba7900ad79393
6
+ metadata.gz: b5e45213f23aaed8b4348d4a68179b2706577d6cdf7cf2588f979feb6433e742851392331a8d2909be4a745b6ef9089c419d22d4dd6140ec981c536e809c29df
7
+ data.tar.gz: f9e436d5ee96f410c66d673819a789ffdca814f8d53c8f7c97b2b005c9d2bd5cd48fc9a6619407ec7da42e0d3ca503666a5e3d2f2124f30b211a22ba87ec7075
@@ -3,7 +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.0] - 2020-11-15
7
+ - [#55](https://github.com/boltops-tools/terraspace/pull/55) custom helpers support
8
+ - plugin helpers support: aws_secret, aws_ssm, google_secret, etc
9
+ - introduce stack-level test concept and change project-level test concept
10
+ - generators: standardize and unifiy new test
11
+ - new generators: arg, hook, helper
12
+ - clean up Terraspace check project
13
+ - setup up autoloader and bundler/setup earlier. removes need for shim
14
+ - test generator plugin autodetection
15
+ - remove internal run_generator_hook_script
16
+ - stack-level args customization support
17
+ - improve test output noise-level
18
+ - new setting: config.terraform.plugin_cache.purge_on_error
19
+ - quiet option for project generator
20
+
21
+ ## [0.4.4]
22
+ - #50 retry logic for shared cache error
23
+ - #51 fix cloud sync: call build first
24
+
25
+ ## [0.4.3]
26
+ * #49 add info --path option
27
+
28
+ ## [0.4.2]
29
+ * #48 add logs pid option
30
+ * default to input false, encourage set tfvars
31
+
32
+ ## [0.4.1]
33
+ * #47 `terraspace list` fix and `terraspace all init` help updates
34
+
6
35
  ## [0.4.0]
36
+ * #46 improve hooks, bundle, auto init and bug fixes
7
37
  * improve hooks: allow multiple hooks of same type, change path hooks/terraform.rb
8
38
  * improve hooks: introduce terraspace-level as well as terraform-level hooks
9
39
  * improve hooks: can take Ruby block or shell script
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. Other plugins also supported are: google and azurerm.
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 -y
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 > /tmp/terraspace/out/terraform-init20200824-21379-bkfvnh.out
42
- Built in .terraspace-cache/us-west-2/dev/stacks/demo
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 -y
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 init -get > /tmp/terraspace/out/terraform-init20200824-21379-bkfvnh.out
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 instance vpc
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
- When you use the all command, the dependency graph is calculated and the stacks are deployed in the right order. To learn more: [Deploy Multiple Stacks](https://terraspace.cloud/docs/intro/deploy-all/).
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/).
92
- * [Configurable CLI](https://terraspace.cloud/docs/cli/): Configurable [CLI Hooks](https://terraspace.cloud/docs/cli/hooks/) and [CLI Args](https://terraspace.cloud/docs/cli/args/) allow you to adjust the underlying terraform command.
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/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
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
- For more info: [terraspace.cloud](https://terraspace.cloud)
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)
@@ -0,0 +1,3 @@
1
+ command("<%= arg_name %>",
2
+ args: ["-lock-timeout=22m"],
3
+ )
@@ -0,0 +1,2 @@
1
+ module <%= helper_class %>
2
+ end
@@ -0,0 +1,7 @@
1
+ before("<%= hook_name %>",
2
+ execute: "echo '<%= hook_path %>: test <%= type %> before hook for <%= kind %> <%= hook_name %>'",
3
+ )
4
+
5
+ after("<%= hook_name %>",
6
+ execute: "echo '<%= hook_path %>: test <%= type %> after hook for <%= kind %> <%= hook_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
@@ -1,8 +1,15 @@
1
- require "terraspace/bundle"
2
- Terraspace::Bundle.setup
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__}/core_ext.rb")
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
@@ -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
@@ -18,7 +18,7 @@ class Terraspace::CLI
18
18
  Terraspace::All::Grapher.new(@options.merge(stacks: stacks)).run
19
19
  end
20
20
 
21
- desc "init", "Init."
21
+ desc "init", "Init all or multiple stacks."
22
22
  long_desc Help.text("all/init")
23
23
  def init(*stacks)
24
24
  Terraspace::All::Runner.new("init", @options.merge(stacks: stacks)).run
@@ -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
@@ -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,33 @@
1
+ ## Example
2
+
3
+ $ terraspace all init
4
+ Building one stack to build all stacks
5
+ Building .terraspace-cache/us-west-2/dev/stacks/c1
6
+ Downloading tfstate files for dependencies defined in tfvars...
7
+ Built in .terraspace-cache/us-west-2/dev/stacks/c1
8
+ Running:
9
+ terraspace init c1 # batch 1
10
+ terraspace init b1 # batch 2
11
+ terraspace init b2 # batch 2
12
+ terraspace init a1 # batch 3
13
+ Batch Run 1:
14
+ Running: terraspace init c1 Logs: log/init/c1.log
15
+ terraspace init c1: Terraform has been successfully initialized!
16
+ Batch Run 2:
17
+ Running: terraspace init b1 Logs: log/init/b1.log
18
+ Running: terraspace init b2 Logs: log/init/b2.log
19
+ terraspace init b1: Terraform has been successfully initialized!
20
+ terraspace init b2: Terraform has been successfully initialized!
21
+ Batch Run 3:
22
+ Running: terraspace init a1 Logs: log/init/a1.log
23
+ terraspace init a1: Terraform has been successfully initialized!
24
+ Time took: 6s
25
+ $
26
+
27
+ If Terraform is having trouble initializing, clearing the cache may help:
28
+
29
+ $ terraspace clean cache -y
30
+ Removed .terraspace-cache
31
+ Removed /tmp/terraspace
32
+
33
+ Also consider disabling the [terraform.plugin_cache.enabled](https://terraspace.cloud/docs/config/reference/).
@@ -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 log command shows the last 10 lines of the logs for each log file. You can use the `-n` option to adjust this.
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, then timestamps are not shown.
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
+ $