terraspace 1.1.4 → 1.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.cody/all/bin/build.sh +33 -0
- data/.cody/all/buildspec.yml +10 -0
- data/.cody/all/project.rb +2 -0
- data/.cody/all/role.rb +6 -0
- data/.pipedream/pipeline.rb +1 -0
- data/CHANGELOG.md +12 -0
- data/lib/terraspace/all/runner.rb +2 -1
- data/lib/terraspace/builder/children.rb +6 -7
- data/lib/terraspace/builder.rb +7 -1
- data/lib/terraspace/compiler/strategy/tfvar/layer.rb +21 -5
- data/lib/terraspace/compiler/strategy/tfvar.rb +3 -0
- data/lib/terraspace/plugin/expander/friendly.rb +2 -1
- data/lib/terraspace/version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82379236de38c541366efe70b69e9393490f5da74a4aecd4a975b3b9be0af907
|
4
|
+
data.tar.gz: b5cb25d94d6015f01768ec6970b66221b78851ef72ef5614f0a5e54e774aaa94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 917fc2cd69a9eab564e2c8a69e9493a04e0a2e424784e09217a79f5c3433b9a790a1bfc9669e9b68a0f53cce32565900aeb4134861faf9a9266b91d847fea39d
|
7
|
+
data.tar.gz: a2977e19c20a1841892f4b275623e080837ccd10359282108475cad9bdd993ccaac3d7d1f0f7e38a530b823ab4c8c2816e9564b882cb482618bd7701e306da6d
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
set -eu
|
4
|
+
|
5
|
+
# will build from /tmp because terraspace/Gemfile may interfere
|
6
|
+
cd /tmp
|
7
|
+
|
8
|
+
export PATH=~/bin:$PATH # ~/bin/terraspace wrapper
|
9
|
+
|
10
|
+
set -x
|
11
|
+
|
12
|
+
git clone https://github.com/boltops-tools/terraspace-graph-demo
|
13
|
+
cd terraspace-graph-demo
|
14
|
+
|
15
|
+
# Rewrite the Gemfile to use the local terraspace gem for testing
|
16
|
+
cat << EOF > Gemfile
|
17
|
+
source "https://rubygems.org"
|
18
|
+
gem "terraspace", path: "$CODEBUILD_SRC_DIR", submodules: true
|
19
|
+
gem "rspec-terraspace", git: "https://github.com/boltops-tools/rspec-terraspace", branch: "master"
|
20
|
+
gem "terraspace_plugin_aws", git: "https://github.com/boltops-tools/terraspace_plugin_aws", branch: "master"
|
21
|
+
EOF
|
22
|
+
bundle
|
23
|
+
|
24
|
+
# Uncomment to enable logger level debug
|
25
|
+
# cat << EOF > config/app.rb
|
26
|
+
# Terraspace.configure do |config|
|
27
|
+
# config.logger.level = :debug
|
28
|
+
# end
|
29
|
+
# EOF
|
30
|
+
|
31
|
+
terraspace all up -y
|
32
|
+
terraspace clean all -y
|
33
|
+
terraspace all down -y
|
data/.cody/all/role.rb
ADDED
data/.pipedream/pipeline.rb
CHANGED
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,18 @@
|
|
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.7] - 2022-02-22
|
7
|
+
- [#215](https://github.com/boltops-tools/terraspace/pull/215) fix all down by building child nodes
|
8
|
+
- [#216](https://github.com/boltops-tools/terraspace/pull/216) add codebuild project with acceptance test for terraspace all
|
9
|
+
|
10
|
+
## [1.1.6] - 2022-02-21
|
11
|
+
- [#213](https://github.com/boltops-tools/terraspace/pull/213) ability to show layers for debugging
|
12
|
+
|
13
|
+
## [1.1.5] - 2022-02-21
|
14
|
+
- [#212](https://github.com/boltops-tools/terraspace/pull/212) ability to show layers for debugging
|
15
|
+
- show layers for debugging with logger level debug and TS_SHOW_ALL_LAYERS=1
|
16
|
+
- stringify_keys layer friendly names map
|
17
|
+
|
6
18
|
## [1.1.4] - 2022-02-21
|
7
19
|
- [#210](https://github.com/boltops-tools/terraspace/pull/210) write files without magic conversion, fixes #209
|
8
20
|
- cleanup argv and root
|
@@ -68,7 +68,8 @@ module Terraspace::All
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def build_stack(name)
|
71
|
-
|
71
|
+
include_stacks = @command == "down" ? :root_with_children : :root_only
|
72
|
+
builder = Terraspace::Builder.new(@options.merge(mod: name, clean: false, quiet: true, include_stacks: include_stacks))
|
72
73
|
builder.build(modules: false)
|
73
74
|
end
|
74
75
|
|
@@ -8,19 +8,18 @@ class Terraspace::Builder
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def build
|
11
|
-
dependencies = Terraspace::Dependency::Registry.data
|
12
11
|
# Find out if current deploy stack contains dependency
|
13
|
-
|
12
|
+
dependencies = Terraspace::Dependency::Registry.data
|
13
|
+
root = dependencies.find do |parent_child|
|
14
14
|
parent, _ = parent_child.split(':')
|
15
15
|
parent == @mod.name
|
16
16
|
end
|
17
|
-
return unless
|
17
|
+
return unless root
|
18
18
|
|
19
|
-
# Go down graph
|
20
|
-
|
21
|
-
node = Terraspace::Dependency::Node.find_by(name:
|
19
|
+
# Go down dependency graph to build a queue for processing
|
20
|
+
name, _ = root.split(':')
|
21
|
+
node = Terraspace::Dependency::Node.find_by(name: name)
|
22
22
|
build_queue(node)
|
23
|
-
|
24
23
|
logger.debug "Terraspace::Builder::Children @queue #{@queue}"
|
25
24
|
|
26
25
|
# Process queue in reverse order to build leaf nodes first
|
data/lib/terraspace/builder.rb
CHANGED
@@ -6,9 +6,15 @@ module Terraspace
|
|
6
6
|
|
7
7
|
# @include_stacks can be 3 values: root_with_children, none, root_only
|
8
8
|
#
|
9
|
+
# terraspace all:
|
10
|
+
#
|
9
11
|
# none: dont build any stacks at all. used by `terraspace all up`
|
10
12
|
# root_only: only build root stack. used by `terraspace all up`
|
11
|
-
# root_with_children: build all
|
13
|
+
# root_with_children: build all children stacks as well as the root stack. normal `terraspace all down`
|
14
|
+
#
|
15
|
+
# terraspace up:
|
16
|
+
#
|
17
|
+
# root_with_children: build all children stacks as well as the root stack. normal `terraspace up`
|
12
18
|
#
|
13
19
|
def initialize(options={})
|
14
20
|
super
|
@@ -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
|
@@ -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
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.7
|
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-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -341,6 +341,10 @@ extensions: []
|
|
341
341
|
extra_rdoc_files: []
|
342
342
|
files:
|
343
343
|
- ".cody/README.md"
|
344
|
+
- ".cody/all/bin/build.sh"
|
345
|
+
- ".cody/all/buildspec.yml"
|
346
|
+
- ".cody/all/project.rb"
|
347
|
+
- ".cody/all/role.rb"
|
344
348
|
- ".cody/aws/bin/build.sh"
|
345
349
|
- ".cody/aws/buildspec.yml"
|
346
350
|
- ".cody/aws/project.rb"
|