terraspace 0.3.1 → 0.3.6
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 +24 -0
- data/README.md +2 -2
- data/lib/terraspace.rb +2 -0
- data/lib/terraspace/all/preview.rb +1 -1
- data/lib/terraspace/all/summary.rb +21 -1
- data/lib/terraspace/app.rb +1 -0
- data/lib/terraspace/builder.rb +3 -6
- 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 +2 -2
- 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 +8 -2
- 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 +3 -1
- data/lib/terraspace/cli/logs/tasks.rb +13 -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/compiler/backend.rb +10 -0
- data/lib/terraspace/compiler/builder.rb +2 -1
- data/lib/terraspace/compiler/commands_concern.rb +18 -0
- data/lib/terraspace/compiler/dependencies/helpers.rb +34 -0
- data/lib/terraspace/compiler/dsl/syntax/helpers/common.rb +0 -26
- data/lib/terraspace/compiler/dsl/syntax/tfvar.rb +1 -0
- data/lib/terraspace/compiler/erb/context.rb +1 -1
- data/lib/terraspace/compiler/erb/helpers.rb +6 -0
- data/lib/terraspace/dependency/graph.rb +2 -1
- data/lib/terraspace/dependency/helper/base.rb +7 -0
- data/lib/terraspace/dependency/helper/depends_on.rb +12 -0
- data/lib/terraspace/dependency/helper/output.rb +11 -0
- data/lib/terraspace/plugin/summary/interface.rb +1 -1
- data/lib/terraspace/shell.rb +44 -16
- 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/terraform/remote_state/fetcher.rb +37 -7
- data/lib/terraspace/terraform/remote_state/marker/output.rb +3 -1
- data/lib/terraspace/terraform/remote_state/null_object.rb +40 -0
- data/lib/terraspace/terraform/remote_state/output_proxy.rb +18 -14
- data/lib/terraspace/version.rb +1 -1
- data/spec/fixtures/dependencies/app/stacks/a1/tfvars/dev.tfvars +1 -0
- data/spec/fixtures/fetcher/c1.json +4 -0
- data/spec/terraspace/all/summary_spec.rb +1 -1
- data/spec/terraspace/compiler/erb/render_spec.rb +15 -0
- data/spec/terraspace/dependency/helper/depends_on_spec.rb +27 -0
- data/spec/terraspace/dependency/helper/output_spec.rb +29 -0
- data/spec/terraspace/terraform/remote_state/fetcher_spec.rb +108 -27
- data/spec/terraspace/terraform/remote_state/marker/output_spec.rb +36 -0
- data/spec/terraspace/terraform/remote_state/output_proxy_spec.rb +69 -0
- metadata +62 -3
- data/lib/terraspace/cli/help/update.md +0 -5
@@ -0,0 +1,30 @@
|
|
1
|
+
## Example
|
2
|
+
|
3
|
+
$ terraspace up demo
|
4
|
+
Building .terraspace-cache/us-west-2/dev/stacks/demo
|
5
|
+
Built in .terraspace-cache/us-west-2/dev/stacks/demo
|
6
|
+
Current directory: .terraspace-cache/us-west-2/dev/stacks/demo
|
7
|
+
=> terraform apply
|
8
|
+
...
|
9
|
+
Plan: 2 to add, 0 to change, 0 to destroy.
|
10
|
+
|
11
|
+
Changes to Outputs:
|
12
|
+
+ bucket_name = (known after apply)
|
13
|
+
|
14
|
+
Do you want to perform these actions?
|
15
|
+
Terraform will perform the actions described above.
|
16
|
+
Only 'yes' will be accepted to approve.
|
17
|
+
Enter a value: yes
|
18
|
+
|
19
|
+
random_pet.this: Creating...
|
20
|
+
random_pet.this: Creation complete after 0s [id=trusty-marmoset]
|
21
|
+
module.bucket.aws_s3_bucket.this: Creating...
|
22
|
+
module.bucket.aws_s3_bucket.this: Creation complete after 2s [id=bucket-trusty-marmoset]
|
23
|
+
|
24
|
+
Apply complete! Resources: 2 added, 0 changed, 0 destroyed.
|
25
|
+
|
26
|
+
Outputs:
|
27
|
+
|
28
|
+
bucket_name = bucket-trusty-marmoset
|
29
|
+
Time took: 39s
|
30
|
+
$
|
@@ -0,0 +1,9 @@
|
|
1
|
+
## Example
|
2
|
+
|
3
|
+
$ terraspace validate demo
|
4
|
+
Building .terraspace-cache/us-west-2/dev/stacks/demo
|
5
|
+
Built in .terraspace-cache/us-west-2/dev/stacks/demo
|
6
|
+
Current directory: .terraspace-cache/us-west-2/dev/stacks/demo
|
7
|
+
=> terraform validate
|
8
|
+
Success! The configuration is valid.
|
9
|
+
$
|
data/lib/terraspace/cli/info.rb
CHANGED
@@ -3,26 +3,14 @@ class Terraspace::CLI
|
|
3
3
|
extend Memoist
|
4
4
|
|
5
5
|
def run
|
6
|
-
|
7
|
-
|
8
|
-
end
|
9
|
-
|
10
|
-
def json_output
|
11
|
-
puts JSON.pretty_generate(info)
|
12
|
-
end
|
13
|
-
|
14
|
-
def text_output
|
6
|
+
presenter = CliFormat::Presenter.new(@options)
|
7
|
+
presenter.header = %w[Name Value]
|
15
8
|
info.each do |k,v|
|
16
|
-
|
17
|
-
puts "#{k} #{v}"
|
9
|
+
presenter.rows << [k, v]
|
18
10
|
end
|
11
|
+
presenter.show
|
19
12
|
end
|
20
13
|
|
21
|
-
def rpad
|
22
|
-
info.keys.map(&:size).max
|
23
|
-
end
|
24
|
-
memoize :rpad
|
25
|
-
|
26
14
|
def info
|
27
15
|
@mod.to_info
|
28
16
|
end
|
data/lib/terraspace/cli/logs.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
class Terraspace::CLI
|
2
2
|
class Logs < Terraspace::Command
|
3
|
-
|
3
|
+
class_option :yes, aliases: :y, type: :boolean, desc: "bypass are you sure prompt"
|
4
|
+
|
5
|
+
desc "truncate", "Truncates logs. IE: Keeps the files but removes contents and zero bytes the files."
|
4
6
|
long_desc Help.text("logs/truncate")
|
5
7
|
def truncate
|
6
8
|
Tasks.new(options).truncate
|
@@ -1,17 +1,21 @@
|
|
1
1
|
class Terraspace::CLI::Logs
|
2
2
|
class Tasks
|
3
|
+
include Terraspace::Util::Sure
|
4
|
+
|
3
5
|
def initialize(options={})
|
4
6
|
@options = options
|
7
|
+
Terraspace.check_project!
|
5
8
|
end
|
6
9
|
|
7
10
|
def truncate
|
8
|
-
|
11
|
+
are_you_sure?("truncate")
|
9
12
|
log_files.each do |path|
|
10
13
|
File.open(path, "w").close # truncates files
|
11
14
|
end
|
12
15
|
end
|
13
16
|
|
14
17
|
def remove
|
18
|
+
are_you_sure?("remove")
|
15
19
|
puts "Removing all files in #{pretty_log_root}/" unless @options[:mute]
|
16
20
|
FileUtils.rm_rf(log_root)
|
17
21
|
FileUtils.mkdir_p(log_root)
|
@@ -28,5 +32,13 @@ class Terraspace::CLI::Logs
|
|
28
32
|
def log_root
|
29
33
|
Terraspace.config.log.root
|
30
34
|
end
|
35
|
+
|
36
|
+
def are_you_sure?(action)
|
37
|
+
message = <<~EOL.chomp
|
38
|
+
Will #{action} all the log files in #{pretty_log_root}/ folder
|
39
|
+
Are you sure?
|
40
|
+
EOL
|
41
|
+
sure?(message) # from Util::Sure
|
42
|
+
end
|
31
43
|
end
|
32
44
|
end
|
data/lib/terraspace/cli/new.rb
CHANGED
@@ -1,40 +1,40 @@
|
|
1
1
|
class Terraspace::CLI
|
2
2
|
class New < Terraspace::Command
|
3
|
-
long_desc Help.text(
|
3
|
+
long_desc Help.text("new/git_hook")
|
4
4
|
GitHook.cli_options.each { |args| option(*args) }
|
5
|
-
register(GitHook, "git_hook", "git_hook", "Generates new git hook")
|
5
|
+
register(GitHook, "git_hook", "git_hook", "Generates new git hook.")
|
6
6
|
|
7
|
-
long_desc Help.text(
|
7
|
+
long_desc Help.text("new/shim")
|
8
8
|
Shim.cli_options.each { |args| option(*args) }
|
9
|
-
register(Shim, "shim", "shim", "Generates terraspace shim")
|
9
|
+
register(Shim, "shim", "shim", "Generates terraspace shim.")
|
10
10
|
|
11
|
-
long_desc Help.text(
|
11
|
+
long_desc Help.text("new/module")
|
12
12
|
Module.base_options.each { |args| option(*args) }
|
13
13
|
Module.component_options.each { |args| option(*args) }
|
14
|
-
register(Module, "module", "module NAME", "Generates new module")
|
14
|
+
register(Module, "module", "module NAME", "Generates new module.")
|
15
15
|
|
16
|
-
long_desc Help.text(
|
16
|
+
long_desc Help.text("new/stack")
|
17
17
|
Stack.base_options.each { |args| option(*args) }
|
18
18
|
Stack.component_options.each { |args| option(*args) }
|
19
|
-
register(Stack, "stack", "stack NAME", "Generates new stack")
|
19
|
+
register(Stack, "stack", "stack NAME", "Generates new stack.")
|
20
20
|
|
21
|
-
long_desc Help.text(
|
21
|
+
long_desc Help.text("new/project")
|
22
22
|
Project.base_options.each { |args| option(*args) }
|
23
23
|
Project.project_options.each { |args| option(*args) }
|
24
|
-
register(Project, "project", "project NAME", "Generates new project")
|
24
|
+
register(Project, "project", "project NAME", "Generates new project.")
|
25
25
|
|
26
|
-
long_desc Help.text(
|
27
|
-
register(Test::Project, "project_test", "project_test NAME", "Generates new project test")
|
26
|
+
long_desc Help.text("new/project_test")
|
27
|
+
register(Test::Project, "project_test", "project_test NAME", "Generates new project test.")
|
28
28
|
|
29
|
-
long_desc Help.text(
|
30
|
-
register(Test::Module, "module_test", "module_test NAME", "Generates new module test")
|
29
|
+
long_desc Help.text("new/module_test")
|
30
|
+
register(Test::Module, "module_test", "module_test NAME", "Generates new module test.")
|
31
31
|
|
32
|
-
long_desc Help.text(
|
32
|
+
long_desc Help.text("new/bootstrap_test")
|
33
33
|
Test::Bootstrap.options.each { |args| option(*args) }
|
34
|
-
register(Test::Bootstrap, "bootstrap_test", "bootstrap_test", "Generates bootstrap test setup")
|
34
|
+
register(Test::Bootstrap, "bootstrap_test", "bootstrap_test", "Generates bootstrap test setup.")
|
35
35
|
|
36
|
-
long_desc Help.text(
|
36
|
+
long_desc Help.text("new/plugin")
|
37
37
|
Plugin.options.each { |args| option(*args) }
|
38
|
-
register(Plugin, "plugin", "plugin", "Generates plugin")
|
38
|
+
register(Plugin, "plugin", "plugin", "Generates plugin.")
|
39
39
|
end
|
40
40
|
end
|
@@ -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
@@ -6,7 +6,13 @@ module Terraspace::Compiler
|
|
6
6
|
@mod = mod
|
7
7
|
end
|
8
8
|
|
9
|
+
@@created = {}
|
9
10
|
def create
|
11
|
+
return if @@created[cache_key]
|
12
|
+
# set immediately, since local storage wont reach bottom.
|
13
|
+
# if fail for other backends, there will be an exception anyway
|
14
|
+
@@created[cache_key] = true
|
15
|
+
|
10
16
|
klass = backend_interface(backend_name)
|
11
17
|
return unless klass # in case auto-creation is not supported for specific backend
|
12
18
|
|
@@ -14,6 +20,10 @@ module Terraspace::Compiler
|
|
14
20
|
interface.call
|
15
21
|
end
|
16
22
|
|
23
|
+
def cache_key
|
24
|
+
@mod.build_dir
|
25
|
+
end
|
26
|
+
|
17
27
|
def backend_name
|
18
28
|
backend.keys.first # IE: s3, gcs, etc
|
19
29
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
module Terraspace::Compiler
|
2
2
|
class Builder
|
3
|
+
include CommandsConcern
|
3
4
|
include Basename
|
4
5
|
|
5
6
|
def initialize(mod)
|
@@ -9,7 +10,7 @@ module Terraspace::Compiler
|
|
9
10
|
def build
|
10
11
|
build_config
|
11
12
|
build_module if @mod.resolved
|
12
|
-
build_tfvars
|
13
|
+
build_tfvars unless command_is?(:seed) # avoid dependencies being built and erroring when backend bucket doesnt exist
|
13
14
|
end
|
14
15
|
|
15
16
|
# build common config files: provider and backend for the root module
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Terraspace::Compiler
|
2
|
+
module CommandsConcern
|
3
|
+
def requires_backend?
|
4
|
+
command_is?(requires_backend_commands)
|
5
|
+
end
|
6
|
+
|
7
|
+
def requires_backend_commands
|
8
|
+
%w[down init output plan providers refresh show up validate]
|
9
|
+
end
|
10
|
+
|
11
|
+
def command_is?(*commands)
|
12
|
+
commands.flatten!
|
13
|
+
commands.map!(&:to_s)
|
14
|
+
commands.include?(ARGV[0]) || # IE: terraspace up
|
15
|
+
ARGV[0] == "all" && commands.include?(ARGV[1]) # IE: terraspace all up
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Terraspace::Compiler::Dependencies
|
2
|
+
# This is a separate module specifically because the DSL also has an output method.
|
3
|
+
# The module allows us to include dependency related methods only within tfvars context for the DSL.
|
4
|
+
#
|
5
|
+
# 1. Only include this module to DSL tfvars context.
|
6
|
+
# So the output method works in tfvars .rb files works.
|
7
|
+
# At the same time, the DSL usage of output also works for normal main.tf files.
|
8
|
+
# Passing specs prove this.
|
9
|
+
# 2. For ERB, there's currently only one ERB context. So this module is included in all contexts.
|
10
|
+
# The builder only processes dependencies from tfvars, so these helpers are only respected there.
|
11
|
+
#
|
12
|
+
# Where the module is included in the code:
|
13
|
+
#
|
14
|
+
# 1. lib/terraspace/compiler/dsl/syntax/tfvar.rb
|
15
|
+
# 2. lib/terraspace/compiler/erb/helpers.rb
|
16
|
+
#
|
17
|
+
module Helpers
|
18
|
+
def output(identifier, options={})
|
19
|
+
Terraspace::Dependency::Helper::Output.new(@mod, identifier, options).result
|
20
|
+
end
|
21
|
+
alias_method :terraform_output, :output # backwards compatibility
|
22
|
+
|
23
|
+
def depends_on(*child_names, **options)
|
24
|
+
child_names.flatten!
|
25
|
+
child_names.map do |child_name|
|
26
|
+
each_depends_on(child_name, options)
|
27
|
+
end.join("\n")
|
28
|
+
end
|
29
|
+
|
30
|
+
def each_depends_on(child_name, options={})
|
31
|
+
Terraspace::Dependency::Helper::DependsOn.new(@mod, child_name, options).result
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -1,8 +1,6 @@
|
|
1
1
|
module Terraspace::Compiler::Dsl::Syntax::Helpers
|
2
2
|
module Common
|
3
3
|
extend Memoist
|
4
|
-
Fetcher = Terraspace::Terraform::RemoteState::Fetcher
|
5
|
-
Marker = Terraspace::Terraform::RemoteState::Marker
|
6
4
|
Meta = Terraspace::Compiler::Dsl::Meta
|
7
5
|
|
8
6
|
def var
|
@@ -25,29 +23,5 @@ module Terraspace::Compiler::Dsl::Syntax::Helpers
|
|
25
23
|
command = ["terraspace"] + args
|
26
24
|
command.join(separator)
|
27
25
|
end
|
28
|
-
|
29
|
-
def terraform_output(identifier, options={})
|
30
|
-
if @mod.resolved # dependencies have been resolved
|
31
|
-
Fetcher.new(@mod, identifier, options).output
|
32
|
-
else
|
33
|
-
Marker::Output.new(@mod, identifier, options).build
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def depends_on(*child_names, **options)
|
38
|
-
child_names.flatten!
|
39
|
-
child_names.map do |child_name|
|
40
|
-
each_depends_on(child_name, options)
|
41
|
-
end.join("\n")
|
42
|
-
end
|
43
|
-
|
44
|
-
def each_depends_on(child_name, options={})
|
45
|
-
if @mod.resolved # dependencies have been resolved
|
46
|
-
# Note: A generated line is not really needed. Dependencies are stored in memory. Added to assist users with debugging
|
47
|
-
"# #{@mod.name} depends on #{child_name}"
|
48
|
-
else
|
49
|
-
Marker::Output.new(@mod, child_name, options).build
|
50
|
-
end
|
51
|
-
end
|
52
26
|
end
|
53
27
|
end
|
@@ -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
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Terraspace::Dependency::Helper
|
2
|
+
class DependsOn < Base
|
3
|
+
def result
|
4
|
+
if @mod.resolved # dependencies have been resolved
|
5
|
+
# Note: A generated line is not really needed. Dependencies are stored in memory. Added to assist users with debugging
|
6
|
+
"# #{@mod.name} depends on #{@identifier}" # raw String value
|
7
|
+
else
|
8
|
+
Terraspace::Terraform::RemoteState::Marker::Output.new(@mod, @identifier, @options).build # Returns OutputProxy which defaults to json
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Terraspace::Dependency::Helper
|
2
|
+
class Output < Base
|
3
|
+
def result
|
4
|
+
if @mod.resolved # dependencies have been resolved
|
5
|
+
Terraspace::Terraform::RemoteState::Fetcher.new(@mod, @identifier, @options).output # Returns OutputProxy which defaults to json
|
6
|
+
else
|
7
|
+
Terraspace::Terraform::RemoteState::Marker::Output.new(@mod, @identifier, @options).build # Returns OutputProxy is NullObject when unresolved
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
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}"
|