terraspace 1.1.2 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/lib/terraspace/all/runner.rb +18 -5
- data/lib/terraspace/compiler/strategy/tfvar/layer.rb +21 -5
- data/lib/terraspace/compiler/strategy/tfvar.rb +3 -0
- data/lib/terraspace/compiler/writer.rb +1 -1
- data/lib/terraspace/core.rb +3 -21
- data/lib/terraspace/ext/core/module.rb +1 -1
- data/lib/terraspace/plugin/expander/friendly.rb +2 -1
- data/lib/terraspace/version.rb +1 -1
- data/terraspace.gemspec +4 -0
- metadata +6 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1645fa9d7679907d214d87b276d1282f0ae0fba29f1a2fff4019c4324a61b9c4
|
|
4
|
+
data.tar.gz: 26e2f27c70bf1872fce821778a80d20e3923b1dbf8e56013c88ee3d0c66ff002
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9a512a5c8c7d9b30959a967023be912979c2f666d510f95094cf1c531c00b3d52c11bca88528e72e62842484fdfa82d22c62edffe86d11a6a8ec11126117baba
|
|
7
|
+
data.tar.gz: 9f88a7337013171c4944f4c8b86067ba1df3a9e009cedb773fac0199cd35a7828c535439848abc9addec41cf918b7df0152c2d0360255ec8381a7df9ff87c000
|
data/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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
|
+
## [1.1.6] - 2022-02-21
|
|
7
|
+
- [#213](https://github.com/boltops-tools/terraspace/pull/213) ability to show layers for debugging
|
|
8
|
+
|
|
9
|
+
## [1.1.5] - 2022-02-21
|
|
10
|
+
- [#212](https://github.com/boltops-tools/terraspace/pull/212) ability to show layers for debugging
|
|
11
|
+
- show layers for debugging with logger level debug and TS_SHOW_ALL_LAYERS=1
|
|
12
|
+
- stringify_keys layer friendly names map
|
|
13
|
+
|
|
14
|
+
## [1.1.4] - 2022-02-21
|
|
15
|
+
- [#210](https://github.com/boltops-tools/terraspace/pull/210) write files without magic conversion, fixes #209
|
|
16
|
+
- cleanup argv and root
|
|
17
|
+
- write files without magic conversion, fixes #209
|
|
18
|
+
|
|
19
|
+
## [1.1.3] - 2022-02-17
|
|
20
|
+
- [#207](https://github.com/boltops-tools/terraspace/pull/207) dont fork when all.concurrency = 1
|
|
21
|
+
|
|
6
22
|
## [1.1.2] - 2022-02-17
|
|
7
23
|
- [#200](https://github.com/boltops-tools/terraspace/pull/200) fix terraspace typos
|
|
8
24
|
- [#202](https://github.com/boltops-tools/terraspace/pull/202) Windows support: fix include_dir for windows
|
|
@@ -41,18 +41,27 @@ module Terraspace::All
|
|
|
41
41
|
concurrency = Terraspace.config.all.concurrency
|
|
42
42
|
batch.sort_by(&:name).each_slice(concurrency) do |slice|
|
|
43
43
|
slice.each do |node|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
if fork?
|
|
45
|
+
pid = fork do
|
|
46
|
+
deploy_stack(node)
|
|
47
|
+
end
|
|
48
|
+
@pids[pid] = node.name # store mod_name mapping
|
|
49
|
+
else
|
|
50
|
+
deploy_stack(node)
|
|
47
51
|
end
|
|
48
|
-
@pids[pid] = node.name # store mod_name mapping
|
|
49
52
|
end
|
|
50
53
|
end
|
|
54
|
+
return unless fork?
|
|
51
55
|
wait_for_child_proccess
|
|
52
56
|
summarize # also reports lower-level error info
|
|
53
57
|
report_errors # reports finall errors and possibly exit
|
|
54
58
|
end
|
|
55
59
|
|
|
60
|
+
def deploy_stack(node)
|
|
61
|
+
build_stack(node.name)
|
|
62
|
+
run_terraspace(node.name)
|
|
63
|
+
end
|
|
64
|
+
|
|
56
65
|
def build_modules
|
|
57
66
|
builder = Terraspace::Builder.new(@options.merge(mod: "placeholder", clean: true, quiet: true, include_stacks: :none))
|
|
58
67
|
builder.build(modules: true)
|
|
@@ -109,7 +118,7 @@ module Terraspace::All
|
|
|
109
118
|
end
|
|
110
119
|
|
|
111
120
|
def run_terraspace(mod_name)
|
|
112
|
-
set_log_path!(mod_name)
|
|
121
|
+
set_log_path!(mod_name) if fork?
|
|
113
122
|
name = command_map(@command)
|
|
114
123
|
o = @options.merge(mod: mod_name, yes: true, build: false, input: false, log_to_stderr: true)
|
|
115
124
|
o.merge!(quiet: false) if @command == "init" # noisy so can filter and summarize output
|
|
@@ -123,6 +132,10 @@ module Terraspace::All
|
|
|
123
132
|
end
|
|
124
133
|
end
|
|
125
134
|
|
|
135
|
+
def fork?
|
|
136
|
+
Terraspace.config.all.concurrency > 1
|
|
137
|
+
end
|
|
138
|
+
|
|
126
139
|
def set_log_path!(mod_name)
|
|
127
140
|
command = terraspace_command(mod_name)
|
|
128
141
|
path = log_path(mod_name)
|
|
@@ -32,6 +32,7 @@ class Terraspace::Compiler::Strategy::Tfvar
|
|
|
32
32
|
extend Memoist
|
|
33
33
|
include Terraspace::Layering
|
|
34
34
|
include Terraspace::Plugin::Expander::Friendly
|
|
35
|
+
include Terraspace::Util
|
|
35
36
|
|
|
36
37
|
def initialize(mod)
|
|
37
38
|
@mod = mod
|
|
@@ -40,7 +41,11 @@ class Terraspace::Compiler::Strategy::Tfvar
|
|
|
40
41
|
def paths
|
|
41
42
|
project_paths = full_paths(project_tfvars_dir)
|
|
42
43
|
stack_paths = full_paths(stack_tfvars_dir)
|
|
43
|
-
project_paths + stack_paths
|
|
44
|
+
paths = project_paths + stack_paths
|
|
45
|
+
show_layers(paths)
|
|
46
|
+
paths.select do |path|
|
|
47
|
+
File.exist?(path)
|
|
48
|
+
end
|
|
44
49
|
end
|
|
45
50
|
memoize :paths
|
|
46
51
|
|
|
@@ -51,10 +56,6 @@ class Terraspace::Compiler::Strategy::Tfvar
|
|
|
51
56
|
"#{tfvars_dir}/#{layer}.rb",
|
|
52
57
|
]
|
|
53
58
|
end.flatten
|
|
54
|
-
|
|
55
|
-
layer_paths.select do |path|
|
|
56
|
-
File.exist?(path)
|
|
57
|
-
end
|
|
58
59
|
end
|
|
59
60
|
|
|
60
61
|
def full_layering
|
|
@@ -130,5 +131,20 @@ class Terraspace::Compiler::Strategy::Tfvar
|
|
|
130
131
|
empty = Dir.glob("#{seed_dir}/*").empty?
|
|
131
132
|
empty ? mod_dir : seed_dir
|
|
132
133
|
end
|
|
134
|
+
|
|
135
|
+
@@shown_layers = {}
|
|
136
|
+
def show_layers(paths)
|
|
137
|
+
return unless @mod.resolved
|
|
138
|
+
return if @@shown_layers[@mod.name]
|
|
139
|
+
logger.debug "Layers for #{@mod.name}:"
|
|
140
|
+
paths.each do |path|
|
|
141
|
+
next unless path.include?('.tfvars')
|
|
142
|
+
show = File.exist?(path) || ENV['TS_SHOW_ALL_LAYERS']
|
|
143
|
+
logger.debug " #{pretty_path(path)}" if show
|
|
144
|
+
end
|
|
145
|
+
logger.debug ""
|
|
146
|
+
@@shown_layers[@mod.name] = true
|
|
147
|
+
end
|
|
148
|
+
|
|
133
149
|
end
|
|
134
150
|
end
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
module Terraspace::Compiler::Strategy
|
|
2
2
|
class Tfvar
|
|
3
|
+
extend Memoist
|
|
4
|
+
|
|
3
5
|
def initialize(mod)
|
|
4
6
|
@mod = mod
|
|
5
7
|
@order = 0
|
|
@@ -24,6 +26,7 @@ module Terraspace::Compiler::Strategy
|
|
|
24
26
|
def layer_paths
|
|
25
27
|
Layer.new(@mod).paths
|
|
26
28
|
end
|
|
29
|
+
memoize :layer_paths
|
|
27
30
|
|
|
28
31
|
# Tact on number to ensure that tfvars will be processed in desired order.
|
|
29
32
|
# Also name auto.tfvars so it will automatically load
|
|
@@ -34,7 +34,7 @@ module Terraspace::Compiler
|
|
|
34
34
|
if content.respond_to?(:path) # IO filehandle
|
|
35
35
|
FileUtils.cp(content.path, dest_path) # preserves permission
|
|
36
36
|
else # just content
|
|
37
|
-
IO.write(dest_path, content)
|
|
37
|
+
IO.write(dest_path, content, mode: "wb")
|
|
38
38
|
end
|
|
39
39
|
logger.debug "Created #{Terraspace::Util.pretty_path(dest_path)}"
|
|
40
40
|
end
|
data/lib/terraspace/core.rb
CHANGED
|
@@ -11,11 +11,8 @@ module Terraspace
|
|
|
11
11
|
def root
|
|
12
12
|
@@root ||= ENV['TS_ROOT'] || Dir.pwd
|
|
13
13
|
end
|
|
14
|
-
|
|
15
14
|
# allow testing frameworks to switch roots
|
|
16
|
-
|
|
17
|
-
@@root = v
|
|
18
|
-
end
|
|
15
|
+
cattr_writer :root
|
|
19
16
|
|
|
20
17
|
def cache_root
|
|
21
18
|
ENV['TS_CACHE_ROOT'] || config.build.cache_root || "#{root}/.terraspace-cache"
|
|
@@ -61,22 +58,7 @@ module Terraspace
|
|
|
61
58
|
|
|
62
59
|
# Terraspace.argv provides consistency when terraspace is being called by rspec-terraspace test harness
|
|
63
60
|
# So use Terraspace.argv instead of ARGV constant
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
def argv
|
|
69
|
-
@@argv
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
@@check_project = true
|
|
73
|
-
def check_project
|
|
74
|
-
@@check_project
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
# allow testing frameworks to disable
|
|
78
|
-
def check_project=(v)
|
|
79
|
-
@@check_project = v
|
|
80
|
-
end
|
|
61
|
+
cattr_accessor :argv
|
|
62
|
+
cattr_accessor :check_project, default: true
|
|
81
63
|
end
|
|
82
64
|
end
|
|
@@ -8,7 +8,7 @@ class Module
|
|
|
8
8
|
# Caller lines are different for OSes:
|
|
9
9
|
#
|
|
10
10
|
# windows: "C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/terraspace-1.1.1/lib/terraspace/builder.rb:34:in `build'"
|
|
11
|
-
# linux: "/home/ec2-user/.rvm/gems/ruby-3.0.3/gems/terraspace-1.1.1
|
|
11
|
+
# linux: "/home/ec2-user/.rvm/gems/ruby-3.0.3/gems/terraspace-1.1.1/lib/terraspace/compiler/dsl/syntax/mod.rb:4:in `<module:Mod>'"
|
|
12
12
|
#
|
|
13
13
|
def include_dir(dir)
|
|
14
14
|
caller_line = caller[0]
|
|
@@ -5,7 +5,8 @@ module Terraspace::Plugin::Expander
|
|
|
5
5
|
# Terraspace::Plugin::Expander::Interface
|
|
6
6
|
def friendly_name(name)
|
|
7
7
|
return '' if name.nil?
|
|
8
|
-
Terraspace.config.layering.names
|
|
8
|
+
names = Terraspace.config.layering.names.stringify_keys
|
|
9
|
+
names[name.to_s] || name
|
|
9
10
|
end
|
|
10
11
|
end
|
|
11
12
|
end
|
data/lib/terraspace/version.rb
CHANGED
data/terraspace.gemspec
CHANGED
|
@@ -12,6 +12,10 @@ Gem::Specification.new do |spec|
|
|
|
12
12
|
spec.homepage = "https://terraspace.cloud"
|
|
13
13
|
spec.license = "Apache-2.0"
|
|
14
14
|
|
|
15
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
16
|
+
spec.metadata["source_code_uri"] = "https://github.com/boltops-tools/terraspace"
|
|
17
|
+
spec.metadata["changelog_uri"] = "https://github.com/boltops-tools/terraspace/blob/master/CHANGELOG.md"
|
|
18
|
+
|
|
15
19
|
spec.files = File.directory?('.git') ? `git ls-files`.split($/) : Dir.glob("**/*")
|
|
16
20
|
spec.bindir = "exe"
|
|
17
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
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: 1.1.
|
|
4
|
+
version: 1.1.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tung Nguyen
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-02-
|
|
11
|
+
date: 2022-02-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -870,7 +870,10 @@ files:
|
|
|
870
870
|
homepage: https://terraspace.cloud
|
|
871
871
|
licenses:
|
|
872
872
|
- Apache-2.0
|
|
873
|
-
metadata:
|
|
873
|
+
metadata:
|
|
874
|
+
homepage_uri: https://terraspace.cloud
|
|
875
|
+
source_code_uri: https://github.com/boltops-tools/terraspace
|
|
876
|
+
changelog_uri: https://github.com/boltops-tools/terraspace/blob/master/CHANGELOG.md
|
|
874
877
|
post_install_message:
|
|
875
878
|
rdoc_options: []
|
|
876
879
|
require_paths:
|