terraspace 0.3.3 → 0.3.4
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 -0
- data/.cody/azurerm/bin/build.sh +2 -0
- data/.cody/google/bin/build.sh +2 -0
- data/CHANGELOG.md +10 -0
- data/lib/terraspace.rb +1 -0
- data/lib/terraspace/all/summary.rb +21 -1
- data/lib/terraspace/cli.rb +25 -25
- data/lib/terraspace/cli/all.rb +9 -9
- data/lib/terraspace/cli/cloud.rb +3 -9
- data/lib/terraspace/cli/cloud/runs.rb +0 -2
- data/lib/terraspace/cli/help/all/down.md +32 -0
- data/lib/terraspace/cli/help/all/graph.md +21 -0
- data/lib/terraspace/cli/help/all/output.md +22 -0
- data/lib/terraspace/cli/help/all/plan.md +25 -0
- data/lib/terraspace/cli/help/all/providers.md +21 -0
- data/lib/terraspace/cli/help/all/refresh.md +17 -0
- data/lib/terraspace/cli/help/all/show.md +21 -0
- data/lib/terraspace/cli/help/all/up.md +27 -0
- data/lib/terraspace/cli/help/all/validate.md +21 -0
- data/lib/terraspace/cli/help/build.md +6 -0
- data/lib/terraspace/cli/help/bundle.md +9 -5
- data/lib/terraspace/cli/help/check_setup.md +9 -0
- data/lib/terraspace/cli/help/clean.md +5 -0
- data/lib/terraspace/cli/help/cloud/destroy.md +16 -0
- data/lib/terraspace/cli/help/cloud/list.md +7 -0
- data/lib/terraspace/cli/help/cloud/runs/list.md +3 -3
- data/lib/terraspace/cli/help/cloud/runs/prune.md +1 -1
- data/lib/terraspace/cli/help/cloud/sync.md +26 -2
- data/lib/terraspace/cli/help/console.md +8 -0
- data/lib/terraspace/cli/help/down.md +26 -0
- data/lib/terraspace/cli/help/info.md +43 -0
- data/lib/terraspace/cli/help/init.md +37 -0
- data/lib/terraspace/cli/help/list.md +20 -0
- data/lib/terraspace/cli/help/log.md +2 -0
- data/lib/terraspace/cli/help/logs/remove.md +5 -0
- data/lib/terraspace/cli/help/logs/truncate.md +5 -0
- data/lib/terraspace/cli/help/new/bootstrap_test.md +8 -0
- data/lib/terraspace/cli/help/new/example.md +8 -0
- data/lib/terraspace/cli/help/new/git_hook.md +6 -0
- data/lib/terraspace/cli/help/new/module.md +9 -0
- data/lib/terraspace/cli/help/new/module_test.md +12 -0
- data/lib/terraspace/cli/help/new/plugin.md +49 -0
- data/lib/terraspace/cli/help/new/project.md +40 -0
- data/lib/terraspace/cli/help/new/project_test.md +8 -0
- data/lib/terraspace/cli/help/new/shim.md +21 -0
- data/lib/terraspace/cli/help/new/stack.md +9 -0
- data/lib/terraspace/cli/help/output.md +6 -0
- data/lib/terraspace/cli/help/plan.md +29 -0
- data/lib/terraspace/cli/help/providers.md +18 -0
- data/lib/terraspace/cli/help/refresh.md +11 -0
- data/lib/terraspace/cli/help/seed.md +7 -0
- data/lib/terraspace/cli/help/show.md +36 -0
- data/lib/terraspace/cli/help/summary.md +11 -0
- data/lib/terraspace/cli/help/test.md +35 -0
- data/lib/terraspace/cli/help/up.md +30 -0
- data/lib/terraspace/cli/help/validate.md +9 -0
- data/lib/terraspace/cli/info.rb +4 -16
- data/lib/terraspace/cli/logs.rb +1 -1
- data/lib/terraspace/cli/new.rb +18 -18
- data/lib/terraspace/cli/new/git_hook.rb +4 -1
- data/lib/terraspace/cli/new/project.rb +1 -1
- data/lib/terraspace/cli/summary.rb +2 -2
- data/lib/terraspace/command.rb +1 -1
- data/lib/terraspace/dependency/graph.rb +2 -1
- data/lib/terraspace/plugin/summary/interface.rb +1 -1
- data/lib/terraspace/shell.rb +14 -4
- data/lib/terraspace/terraform/cloud/runs/lister.rb +0 -2
- data/lib/terraspace/terraform/cloud/syncer.rb +2 -2
- data/lib/terraspace/terraform/cloud/workspace.rb +0 -9
- data/lib/terraspace/version.rb +1 -1
- data/spec/terraspace/all/summary_spec.rb +1 -1
- metadata +43 -3
- data/lib/terraspace/cli/help/update.md +0 -5
@@ -15,7 +15,10 @@ class Terraspace::CLI::New
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def create
|
18
|
-
|
18
|
+
unless File.exist?(".git")
|
19
|
+
puts "No .git folder found. Not creating git hook."
|
20
|
+
return
|
21
|
+
end
|
19
22
|
dest = ".git/hooks/#{options[:type]}"
|
20
23
|
template "hook.sh", dest
|
21
24
|
chmod dest, 0755
|
@@ -12,7 +12,7 @@ class Terraspace::CLI
|
|
12
12
|
|
13
13
|
def run
|
14
14
|
Terraspace.check_project!
|
15
|
-
|
15
|
+
build_placeholder
|
16
16
|
puts "Summary of resources based on backend storage statefiles"
|
17
17
|
backend_expr = '.terraspace-cache/**/backend.*'
|
18
18
|
# Currently summary assumes backend are within the same bucket and key prefix
|
@@ -22,7 +22,7 @@ class Terraspace::CLI
|
|
22
22
|
|
23
23
|
# Grab the last module and build that.
|
24
24
|
# Assume the backend key has the same prefix
|
25
|
-
def
|
25
|
+
def build_placeholder
|
26
26
|
Build::Placeholder.new(@options).build
|
27
27
|
end
|
28
28
|
|
data/lib/terraspace/command.rb
CHANGED
@@ -20,8 +20,9 @@ module Terraspace::Dependency
|
|
20
20
|
@batches
|
21
21
|
end
|
22
22
|
|
23
|
+
# Only check when stacks option is pass. Edge case: There can be app/modules but no app/stacks yet
|
23
24
|
def check_empty_nodes!
|
24
|
-
return unless @nodes.empty?
|
25
|
+
return unless @nodes.empty? && @options[:stacks]
|
25
26
|
logger.error "ERROR: No stacks were found that match: #{@options[:stacks].join(' ')}".color(:red)
|
26
27
|
exit 1
|
27
28
|
end
|
@@ -18,7 +18,7 @@ module Terraspace::Plugin::Summary
|
|
18
18
|
# Note: will not change any of these instance variables unless we note breaking changes
|
19
19
|
@bucket = @info[bucket_field]
|
20
20
|
@key = @info[key_field] # key_field is INTERFACE METHOD IE: aws: key , google: prefix
|
21
|
-
@folder = folder(@key)
|
21
|
+
@folder = folder(@key) # useful as prefix for performance when listing objects in buckets
|
22
22
|
@dest = dest(@bucket)
|
23
23
|
# May change any of these instance variables that follow
|
24
24
|
@dest_folder = "#{@dest}/#{@folder}"
|
data/lib/terraspace/shell.rb
CHANGED
@@ -10,15 +10,25 @@ module Terraspace
|
|
10
10
|
end
|
11
11
|
|
12
12
|
# requires @mod to be set
|
13
|
+
# quiet useful for RemoteState::Fetcher
|
13
14
|
def run
|
14
|
-
env = @options[:env] || {}
|
15
|
-
env.stringify_keys!
|
16
|
-
|
17
|
-
# quiet useful for RemoteState::Fetcher
|
18
15
|
msg = "=> #{@command}"
|
19
16
|
@options[:quiet] ? logger.debug(msg) : logger.info(msg)
|
20
17
|
return if ENV['TS_TEST']
|
18
|
+
shell
|
19
|
+
end
|
20
|
+
|
21
|
+
def shell
|
22
|
+
env = @options[:env] || {}
|
23
|
+
env.stringify_keys!
|
24
|
+
if @options[:shell] == "system" # terraspace console
|
25
|
+
system(env, @command, chdir: @mod.cache_dir)
|
26
|
+
else
|
27
|
+
popen3(env)
|
28
|
+
end
|
29
|
+
end
|
21
30
|
|
31
|
+
def popen3(env)
|
22
32
|
Open3.popen3(env, @command, chdir: @mod.cache_dir) do |stdin, stdout, stderr, wait_thread|
|
23
33
|
mimic_terraform_input(stdin, stdout)
|
24
34
|
while err = stderr.gets
|
@@ -20,15 +20,6 @@ module Terraspace::Terraform::Cloud
|
|
20
20
|
logger.info names.join("\n")
|
21
21
|
end
|
22
22
|
|
23
|
-
def setup
|
24
|
-
build
|
25
|
-
unless backend.dig('remote','workspaces') # in case called by terraspace down demo -y --destroy-workspace with a non-remote backend
|
26
|
-
logger.info "ERROR: Workspace not configured in backend.tf"
|
27
|
-
exit 1
|
28
|
-
end
|
29
|
-
init
|
30
|
-
end
|
31
|
-
|
32
23
|
def init
|
33
24
|
Terraspace::CLI::Init.new(@options.merge(calling_command: "cloud-setup")).run
|
34
25
|
end
|
data/lib/terraspace/version.rb
CHANGED
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.3.
|
4
|
+
version: 0.3.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: 2020-09-
|
11
|
+
date: 2020-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -475,14 +475,54 @@ files:
|
|
475
475
|
- lib/terraspace/cli/commander.rb
|
476
476
|
- lib/terraspace/cli/down.rb
|
477
477
|
- lib/terraspace/cli/help.rb
|
478
|
+
- lib/terraspace/cli/help/all/down.md
|
479
|
+
- lib/terraspace/cli/help/all/graph.md
|
480
|
+
- lib/terraspace/cli/help/all/output.md
|
481
|
+
- lib/terraspace/cli/help/all/plan.md
|
482
|
+
- lib/terraspace/cli/help/all/providers.md
|
483
|
+
- lib/terraspace/cli/help/all/refresh.md
|
484
|
+
- lib/terraspace/cli/help/all/show.md
|
485
|
+
- lib/terraspace/cli/help/all/up.md
|
486
|
+
- lib/terraspace/cli/help/all/validate.md
|
487
|
+
- lib/terraspace/cli/help/build.md
|
478
488
|
- lib/terraspace/cli/help/bundle.md
|
489
|
+
- lib/terraspace/cli/help/check_setup.md
|
490
|
+
- lib/terraspace/cli/help/clean.md
|
491
|
+
- lib/terraspace/cli/help/cloud/destroy.md
|
492
|
+
- lib/terraspace/cli/help/cloud/list.md
|
479
493
|
- lib/terraspace/cli/help/cloud/runs/list.md
|
480
494
|
- lib/terraspace/cli/help/cloud/runs/prune.md
|
481
495
|
- lib/terraspace/cli/help/cloud/sync.md
|
482
496
|
- lib/terraspace/cli/help/completion.md
|
483
497
|
- lib/terraspace/cli/help/completion_script.md
|
498
|
+
- lib/terraspace/cli/help/console.md
|
499
|
+
- lib/terraspace/cli/help/down.md
|
500
|
+
- lib/terraspace/cli/help/info.md
|
501
|
+
- lib/terraspace/cli/help/init.md
|
502
|
+
- lib/terraspace/cli/help/list.md
|
484
503
|
- lib/terraspace/cli/help/log.md
|
485
|
-
- lib/terraspace/cli/help/
|
504
|
+
- lib/terraspace/cli/help/logs/remove.md
|
505
|
+
- lib/terraspace/cli/help/logs/truncate.md
|
506
|
+
- lib/terraspace/cli/help/new/bootstrap_test.md
|
507
|
+
- lib/terraspace/cli/help/new/example.md
|
508
|
+
- lib/terraspace/cli/help/new/git_hook.md
|
509
|
+
- lib/terraspace/cli/help/new/module.md
|
510
|
+
- lib/terraspace/cli/help/new/module_test.md
|
511
|
+
- lib/terraspace/cli/help/new/plugin.md
|
512
|
+
- lib/terraspace/cli/help/new/project.md
|
513
|
+
- lib/terraspace/cli/help/new/project_test.md
|
514
|
+
- lib/terraspace/cli/help/new/shim.md
|
515
|
+
- lib/terraspace/cli/help/new/stack.md
|
516
|
+
- lib/terraspace/cli/help/output.md
|
517
|
+
- lib/terraspace/cli/help/plan.md
|
518
|
+
- lib/terraspace/cli/help/providers.md
|
519
|
+
- lib/terraspace/cli/help/refresh.md
|
520
|
+
- lib/terraspace/cli/help/seed.md
|
521
|
+
- lib/terraspace/cli/help/show.md
|
522
|
+
- lib/terraspace/cli/help/summary.md
|
523
|
+
- lib/terraspace/cli/help/test.md
|
524
|
+
- lib/terraspace/cli/help/up.md
|
525
|
+
- lib/terraspace/cli/help/validate.md
|
486
526
|
- lib/terraspace/cli/info.rb
|
487
527
|
- lib/terraspace/cli/init.rb
|
488
528
|
- lib/terraspace/cli/list.rb
|