terraspace 0.5.12 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +30 -7
  3. data/README.md +2 -0
  4. data/lib/terraspace/app.rb +35 -15
  5. data/lib/terraspace/app/inits.rb +13 -0
  6. data/lib/terraspace/booter.rb +19 -2
  7. data/lib/terraspace/cli.rb +18 -5
  8. data/lib/terraspace/cli/commander.rb +1 -1
  9. data/lib/terraspace/cli/concerns/source_dirs.rb +13 -0
  10. data/lib/terraspace/cli/down.rb +1 -1
  11. data/lib/terraspace/cli/fmt.rb +21 -0
  12. data/lib/terraspace/cli/fmt/runner.rb +64 -0
  13. data/lib/terraspace/cli/help/fmt.md +10 -0
  14. data/lib/terraspace/cli/help/{cloud → tfc}/destroy.md +1 -1
  15. data/lib/terraspace/cli/help/{cloud → tfc}/list.md +1 -1
  16. data/lib/terraspace/cli/help/{cloud → tfc}/runs/list.md +3 -3
  17. data/lib/terraspace/cli/help/{cloud → tfc}/runs/prune.md +3 -3
  18. data/lib/terraspace/cli/help/{cloud → tfc}/sync.md +3 -3
  19. data/lib/terraspace/cli/init.rb +21 -8
  20. data/lib/terraspace/cli/list.rb +3 -2
  21. data/lib/terraspace/cli/new/helper.rb +2 -2
  22. data/lib/terraspace/cli/state.rb +10 -0
  23. data/lib/terraspace/cli/{cloud.rb → tfc.rb} +3 -3
  24. data/lib/terraspace/cli/{cloud → tfc}/runs.rb +4 -4
  25. data/lib/terraspace/compiler/builder.rb +4 -1
  26. data/lib/terraspace/compiler/helper_extender.rb +3 -3
  27. data/lib/terraspace/compiler/strategy/tfvar.rb +16 -4
  28. data/lib/terraspace/compiler/strategy/tfvar/layer.rb +75 -52
  29. data/lib/terraspace/ext.rb +1 -0
  30. data/lib/terraspace/ext/core/string.rb +5 -0
  31. data/lib/terraspace/layering.rb +24 -0
  32. data/lib/terraspace/logger.rb +8 -1
  33. data/lib/terraspace/mod.rb +18 -3
  34. data/lib/terraspace/plugin/expander/friendly.rb +10 -0
  35. data/lib/terraspace/plugin/expander/interface.rb +6 -1
  36. data/lib/terraspace/plugin/summary/interface.rb +1 -1
  37. data/lib/terraspace/shell.rb +16 -1
  38. data/lib/terraspace/terraform/api/runs.rb +13 -2
  39. data/lib/terraspace/terraform/api/token.rb +2 -2
  40. data/lib/terraspace/terraform/api/var.rb +1 -1
  41. data/lib/terraspace/terraform/api/vars.rb +1 -1
  42. data/lib/terraspace/terraform/api/vars/base.rb +2 -0
  43. data/lib/terraspace/terraform/api/vars/json.rb +13 -1
  44. data/lib/terraspace/terraform/api/workspace.rb +10 -3
  45. data/lib/terraspace/terraform/args/default.rb +23 -13
  46. data/lib/terraspace/terraform/ihooks/after/plan.rb +17 -0
  47. data/lib/terraspace/terraform/ihooks/base.rb +8 -0
  48. data/lib/terraspace/terraform/ihooks/before/plan.rb +14 -0
  49. data/lib/terraspace/terraform/remote_state/fetcher.rb +1 -1
  50. data/lib/terraspace/terraform/runner.rb +12 -0
  51. data/lib/terraspace/terraform/{cloud → tfc}/runs.rb +1 -1
  52. data/lib/terraspace/terraform/{cloud → tfc}/runs/base.rb +1 -1
  53. data/lib/terraspace/terraform/{cloud → tfc}/runs/item_presenter.rb +1 -1
  54. data/lib/terraspace/terraform/{cloud → tfc}/runs/lister.rb +1 -1
  55. data/lib/terraspace/terraform/{cloud → tfc}/runs/pruner.rb +1 -1
  56. data/lib/terraspace/terraform/{cloud → tfc}/sync.rb +2 -2
  57. data/lib/terraspace/terraform/{cloud → tfc}/syncer.rb +1 -1
  58. data/lib/terraspace/terraform/{cloud → tfc}/workspace.rb +2 -3
  59. data/lib/terraspace/util/pretty.rb +2 -1
  60. data/lib/terraspace/version.rb +1 -1
  61. metadata +29 -18
  62. data/lib/terraspace/app/hooks.rb +0 -18
@@ -1,4 +1,4 @@
1
- module Terraspace::Terraform::Cloud
1
+ module Terraspace::Terraform::Tfc
2
2
  class Runs < Terraspace::CLI::Base
3
3
  def list
4
4
  lister = Lister.new(@mod, @options)
@@ -1,4 +1,4 @@
1
- class Terraspace::Terraform::Cloud::Runs
1
+ class Terraspace::Terraform::Tfc::Runs
2
2
  class Base
3
3
  extend Memoist
4
4
  include Terraspace::Util::Logging
@@ -1,4 +1,4 @@
1
- class Terraspace::Terraform::Cloud::Runs
1
+ class Terraspace::Terraform::Tfc::Runs
2
2
  class ItemPresenter
3
3
  attr_reader :id
4
4
  def initialize(raw)
@@ -1,4 +1,4 @@
1
- class Terraspace::Terraform::Cloud::Runs
1
+ class Terraspace::Terraform::Tfc::Runs
2
2
  class Lister < Base
3
3
  def run
4
4
  build_project
@@ -1,4 +1,4 @@
1
- class Terraspace::Terraform::Cloud::Runs
1
+ class Terraspace::Terraform::Tfc::Runs
2
2
  class Pruner < Base
3
3
  include Terraspace::Terraform::Api::Client
4
4
 
@@ -1,4 +1,4 @@
1
- module Terraspace::Terraform::Cloud
1
+ module Terraspace::Terraform::Tfc
2
2
  class Sync < Terraspace::CLI::Base
3
3
  extend Memoist
4
4
  include Terraspace::Terraform::Api::Client
@@ -16,7 +16,7 @@ module Terraspace::Terraform::Cloud
16
16
  # So we check and create the workspace if necessary.
17
17
  def run
18
18
  # Note: workspace still gets created by `terraform init` However, variables wont be sync if returns early
19
- return unless Terraspace.config.cloud.auto_sync || @options[:override_auto_sync]
19
+ return unless Terraspace.config.tfc.auto_sync || @options[:override_auto_sync]
20
20
  return unless workspaces_backend?
21
21
  logger.info "Syncing to Terraform Cloud: #{@mod.name} => #{workspace_name}"
22
22
  @api = Terraspace::Terraform::Api.new(@mod, remote)
@@ -1,4 +1,4 @@
1
- module Terraspace::Terraform::Cloud
1
+ module Terraspace::Terraform::Tfc
2
2
  class Syncer < Terraspace::CLI::Base
3
3
  extend Memoist
4
4
  include Terraspace::Compiler::DirsConcern
@@ -1,4 +1,4 @@
1
- module Terraspace::Terraform::Cloud
1
+ module Terraspace::Terraform::Tfc
2
2
  class Workspace < Terraspace::CLI::Base
3
3
  extend Memoist
4
4
  include Terraspace::Util::Logging
@@ -21,7 +21,7 @@ module Terraspace::Terraform::Cloud
21
21
  end
22
22
 
23
23
  def init
24
- Terraspace::CLI::Init.new(@options.merge(calling_command: "cloud-setup")).run
24
+ Terraspace::CLI::Init.new(@options).run
25
25
  end
26
26
 
27
27
  def create
@@ -72,4 +72,3 @@ module Terraspace::Terraform::Cloud
72
72
  end
73
73
  end
74
74
  end
75
-
@@ -12,7 +12,8 @@ module Terraspace::Util
12
12
  end
13
13
 
14
14
  def pretty_path(path)
15
- ENV['TS_TEST'] ? path : path.sub("#{Terraspace.root}/",'')
15
+ return path if ENV['TS_TEST']
16
+ path.sub("#{Terraspace.root}/",'').sub(ENV['HOME'], '~')
16
17
  end
17
18
  end
18
19
  end
@@ -1,3 +1,3 @@
1
1
  module Terraspace
2
- VERSION = "0.5.12"
2
+ VERSION = "0.6.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terraspace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.12
4
+ version: 0.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-27 00:00:00.000000000 Z
11
+ date: 2021-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -461,7 +461,7 @@ files:
461
461
  - lib/terraspace/all/runner.rb
462
462
  - lib/terraspace/all/summary.rb
463
463
  - lib/terraspace/app.rb
464
- - lib/terraspace/app/hooks.rb
464
+ - lib/terraspace/app/inits.rb
465
465
  - lib/terraspace/autoloader.rb
466
466
  - lib/terraspace/booter.rb
467
467
  - lib/terraspace/builder.rb
@@ -478,13 +478,14 @@ files:
478
478
  - lib/terraspace/cli/clean/base.rb
479
479
  - lib/terraspace/cli/clean/cache.rb
480
480
  - lib/terraspace/cli/clean/logs.rb
481
- - lib/terraspace/cli/cloud.rb
482
- - lib/terraspace/cli/cloud/runs.rb
483
481
  - lib/terraspace/cli/commander.rb
484
482
  - lib/terraspace/cli/completer.rb
485
483
  - lib/terraspace/cli/completer/script.rb
486
484
  - lib/terraspace/cli/completer/script.sh
485
+ - lib/terraspace/cli/concerns/source_dirs.rb
487
486
  - lib/terraspace/cli/down.rb
487
+ - lib/terraspace/cli/fmt.rb
488
+ - lib/terraspace/cli/fmt/runner.rb
488
489
  - lib/terraspace/cli/help.rb
489
490
  - lib/terraspace/cli/help/all/down.md
490
491
  - lib/terraspace/cli/help/all/graph.md
@@ -502,15 +503,11 @@ files:
502
503
  - lib/terraspace/cli/help/clean/all.md
503
504
  - lib/terraspace/cli/help/clean/cache.md
504
505
  - lib/terraspace/cli/help/clean/logs.md
505
- - lib/terraspace/cli/help/cloud/destroy.md
506
- - lib/terraspace/cli/help/cloud/list.md
507
- - lib/terraspace/cli/help/cloud/runs/list.md
508
- - lib/terraspace/cli/help/cloud/runs/prune.md
509
- - lib/terraspace/cli/help/cloud/sync.md
510
506
  - lib/terraspace/cli/help/completion.md
511
507
  - lib/terraspace/cli/help/completion_script.md
512
508
  - lib/terraspace/cli/help/console.md
513
509
  - lib/terraspace/cli/help/down.md
510
+ - lib/terraspace/cli/help/fmt.md
514
511
  - lib/terraspace/cli/help/info.md
515
512
  - lib/terraspace/cli/help/init.md
516
513
  - lib/terraspace/cli/help/list.md
@@ -536,6 +533,11 @@ files:
536
533
  - lib/terraspace/cli/help/show.md
537
534
  - lib/terraspace/cli/help/summary.md
538
535
  - lib/terraspace/cli/help/test.md
536
+ - lib/terraspace/cli/help/tfc/destroy.md
537
+ - lib/terraspace/cli/help/tfc/list.md
538
+ - lib/terraspace/cli/help/tfc/runs/list.md
539
+ - lib/terraspace/cli/help/tfc/runs/prune.md
540
+ - lib/terraspace/cli/help/tfc/sync.md
539
541
  - lib/terraspace/cli/help/up.md
540
542
  - lib/terraspace/cli/help/validate.md
541
543
  - lib/terraspace/cli/info.rb
@@ -562,8 +564,11 @@ files:
562
564
  - lib/terraspace/cli/new/stack.rb
563
565
  - lib/terraspace/cli/new/test.rb
564
566
  - lib/terraspace/cli/seed.rb
567
+ - lib/terraspace/cli/state.rb
565
568
  - lib/terraspace/cli/summary.rb
566
569
  - lib/terraspace/cli/test.rb
570
+ - lib/terraspace/cli/tfc.rb
571
+ - lib/terraspace/cli/tfc/runs.rb
567
572
  - lib/terraspace/cli/tfc_concern.rb
568
573
  - lib/terraspace/cli/up.rb
569
574
  - lib/terraspace/command.rb
@@ -622,10 +627,12 @@ files:
622
627
  - lib/terraspace/ext.rb
623
628
  - lib/terraspace/ext/bundler.rb
624
629
  - lib/terraspace/ext/core/module.rb
630
+ - lib/terraspace/ext/core/string.rb
625
631
  - lib/terraspace/hooks/builder.rb
626
632
  - lib/terraspace/hooks/concern.rb
627
633
  - lib/terraspace/hooks/dsl.rb
628
634
  - lib/terraspace/hooks/runner.rb
635
+ - lib/terraspace/layering.rb
629
636
  - lib/terraspace/logger.rb
630
637
  - lib/terraspace/logger/formatter.rb
631
638
  - lib/terraspace/mod.rb
@@ -634,6 +641,7 @@ files:
634
641
  - lib/terraspace/plugin/backend/interface.rb
635
642
  - lib/terraspace/plugin/config/interface.rb
636
643
  - lib/terraspace/plugin/decorator/interface.rb
644
+ - lib/terraspace/plugin/expander/friendly.rb
637
645
  - lib/terraspace/plugin/expander/generic.rb
638
646
  - lib/terraspace/plugin/expander/interface.rb
639
647
  - lib/terraspace/plugin/finder.rb
@@ -665,14 +673,9 @@ files:
665
673
  - lib/terraspace/terraform/args/default.rb
666
674
  - lib/terraspace/terraform/args/dsl.rb
667
675
  - lib/terraspace/terraform/args/shorthands.rb
668
- - lib/terraspace/terraform/cloud/runs.rb
669
- - lib/terraspace/terraform/cloud/runs/base.rb
670
- - lib/terraspace/terraform/cloud/runs/item_presenter.rb
671
- - lib/terraspace/terraform/cloud/runs/lister.rb
672
- - lib/terraspace/terraform/cloud/runs/pruner.rb
673
- - lib/terraspace/terraform/cloud/sync.rb
674
- - lib/terraspace/terraform/cloud/syncer.rb
675
- - lib/terraspace/terraform/cloud/workspace.rb
676
+ - lib/terraspace/terraform/ihooks/after/plan.rb
677
+ - lib/terraspace/terraform/ihooks/base.rb
678
+ - lib/terraspace/terraform/ihooks/before/plan.rb
676
679
  - lib/terraspace/terraform/remote_state/fetcher.rb
677
680
  - lib/terraspace/terraform/remote_state/marker/output.rb
678
681
  - lib/terraspace/terraform/remote_state/marker/pretty_tracer.rb
@@ -680,6 +683,14 @@ files:
680
683
  - lib/terraspace/terraform/remote_state/unresolved.rb
681
684
  - lib/terraspace/terraform/runner.rb
682
685
  - lib/terraspace/terraform/runner/retryer.rb
686
+ - lib/terraspace/terraform/tfc/runs.rb
687
+ - lib/terraspace/terraform/tfc/runs/base.rb
688
+ - lib/terraspace/terraform/tfc/runs/item_presenter.rb
689
+ - lib/terraspace/terraform/tfc/runs/lister.rb
690
+ - lib/terraspace/terraform/tfc/runs/pruner.rb
691
+ - lib/terraspace/terraform/tfc/sync.rb
692
+ - lib/terraspace/terraform/tfc/syncer.rb
693
+ - lib/terraspace/terraform/tfc/workspace.rb
683
694
  - lib/terraspace/tester.rb
684
695
  - lib/terraspace/tester/finder.rb
685
696
  - lib/terraspace/tester/meta.rb
@@ -1,18 +0,0 @@
1
- class Terraspace::App
2
- class Hooks
3
- class_attribute :hooks
4
- self.hooks = {}
5
-
6
- def on_boot(&block)
7
- self.class.hooks[:on_boot] = block
8
- end
9
-
10
- class << self
11
- def run_hook(name)
12
- name = name.to_sym
13
- hook = hooks[name]
14
- hook.call if hook
15
- end
16
- end
17
- end
18
- end