terraspace 0.6.11 → 0.6.12
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 +8 -0
- data/lib/terraspace/cli.rb +2 -2
- data/lib/terraspace/cli/check_setup.rb +1 -1
- data/lib/terraspace/cli/help/state.md +30 -0
- data/lib/terraspace/cli/init.rb +1 -1
- data/lib/terraspace/command.rb +9 -1
- data/lib/terraspace/compiler/builder.rb +9 -5
- data/lib/terraspace/compiler/commands_concern.rb +2 -2
- data/lib/terraspace/compiler/dsl/syntax/helpers/common.rb +1 -1
- data/lib/terraspace/core.rb +10 -0
- data/lib/terraspace/terraform/args/default.rb +16 -4
- data/lib/terraspace/version.rb +1 -1
- data/terraspace.gemspec +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 381066a03744a48afd9149f20496f9c8179eb7c70e084dd1f70f341c01443c62
|
|
4
|
+
data.tar.gz: 5030206fd23d619433651f7ae266b70ddb88e0123ce56838b448661e35d4f09a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 65ec02586d40a8e5edcd93983d6f7a0a34398d8112c08b8748aa6d877421b6aa1c913ea7765aa15357f9d843170aee35efccca35debfe7137e5087a16507f0a0
|
|
7
|
+
data.tar.gz: 5e7641fbf3d8dd81c5e4da97b7f4689d42dde1ac64fb26de08ac8502cf095ba77b69e665f3eef39ca876e4e2384b82a2a6c72d7faa9e116d9f4dec2016a929e1
|
data/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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
|
+
## [0.6.12] - 2021-07-26
|
|
7
|
+
- [#128](https://github.com/boltops-tools/terraspace/pull/128) Improve terraspace state comands and Terraspace.argv for internal usage
|
|
8
|
+
- [#129](https://github.com/boltops-tools/terraspace/pull/129) use Dir.glob(expr, File::FNM_DOTMATCH) so dotfiles are copied, allowing .terraform-version for tfenv
|
|
9
|
+
- allow -h to help outside terraspace project generally
|
|
10
|
+
- require rspec-terraspace 0.3.0
|
|
11
|
+
- state subcommands: straight delegate args
|
|
12
|
+
- Terraspace.argv for consistency with terraspace test
|
|
13
|
+
|
|
6
14
|
## [0.6.11] - 2021-06-22
|
|
7
15
|
- [#120](https://github.com/boltops-tools/terraspace/pull/120) version check handles a major change
|
|
8
16
|
|
data/lib/terraspace/cli.rb
CHANGED
|
@@ -189,8 +189,8 @@ module Terraspace
|
|
|
189
189
|
|
|
190
190
|
desc "state SUBCOMMAND STACK", "Run state."
|
|
191
191
|
long_desc Help.text(:state)
|
|
192
|
-
def state(subcommand, mod)
|
|
193
|
-
State.new(options.merge(subcommand: subcommand, mod: mod)).run
|
|
192
|
+
def state(subcommand, mod, *rest)
|
|
193
|
+
State.new(options.merge(subcommand: subcommand, mod: mod, rest: rest)).run
|
|
194
194
|
end
|
|
195
195
|
|
|
196
196
|
desc "test", "Run test."
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
## Examples
|
|
2
|
+
|
|
3
|
+
terraspace state list demo
|
|
4
|
+
terraspace state mv demo
|
|
5
|
+
terraspace state pull demo
|
|
6
|
+
terraspace state push demo
|
|
7
|
+
terraspace state replace demo
|
|
8
|
+
terraspace state rm demo
|
|
9
|
+
terraspace state show demo
|
|
10
|
+
|
|
11
|
+
## Args Straight Delegation
|
|
12
|
+
|
|
13
|
+
The `terraspace state` command delegates to the `terraform state` commands passing the arguments straight through. Refer to the underlying `terraform` command help for arguments. Example:
|
|
14
|
+
|
|
15
|
+
terraform state list -h
|
|
16
|
+
...
|
|
17
|
+
Options:
|
|
18
|
+
...
|
|
19
|
+
-id=ID Filters the results to include only instances whose
|
|
20
|
+
resource types have an attribute named "id" whose value
|
|
21
|
+
equals the given id string.
|
|
22
|
+
|
|
23
|
+
This means we can use the `-id` or `--id` option and terraspace will pass it straight through. Example:
|
|
24
|
+
|
|
25
|
+
terraspace state list demo --id enabled-bull
|
|
26
|
+
Building .terraspace-cache/us-west-2/dev/stacks/demo
|
|
27
|
+
Built in .terraspace-cache/us-west-2/dev/stacks/demo
|
|
28
|
+
Current directory: .terraspace-cache/us-west-2/dev/stacks/demo
|
|
29
|
+
=> terraform state list --id enabled-bull
|
|
30
|
+
random_pet.this
|
data/lib/terraspace/cli/init.rb
CHANGED
data/lib/terraspace/command.rb
CHANGED
|
@@ -30,6 +30,9 @@ module Terraspace
|
|
|
30
30
|
include Terraspace::Util::Logging
|
|
31
31
|
|
|
32
32
|
def dispatch(m, args, options, config)
|
|
33
|
+
# Terraspace.argv provides consistency when terraspace is being called by rspec-terrspace test harness
|
|
34
|
+
Terraspace.argv = args.clone # important to clone since Thor removes the first argv
|
|
35
|
+
|
|
33
36
|
check_standalone_install!
|
|
34
37
|
check_project!(args.first)
|
|
35
38
|
|
|
@@ -42,7 +45,6 @@ module Terraspace
|
|
|
42
45
|
# as well thor's normal way:
|
|
43
46
|
#
|
|
44
47
|
# terraspace help command
|
|
45
|
-
help_flags = Thor::HELP_MAPPINGS + ["help"]
|
|
46
48
|
if args.length > 1 && !(args & help_flags).empty?
|
|
47
49
|
args -= help_flags
|
|
48
50
|
args.insert(-2, "help")
|
|
@@ -59,6 +61,11 @@ module Terraspace
|
|
|
59
61
|
super
|
|
60
62
|
end
|
|
61
63
|
|
|
64
|
+
def help_flags
|
|
65
|
+
Thor::HELP_MAPPINGS + ["help"]
|
|
66
|
+
end
|
|
67
|
+
private :help_flags
|
|
68
|
+
|
|
62
69
|
def check_standalone_install!
|
|
63
70
|
return unless opt?
|
|
64
71
|
version_manager = "rvm" if rvm?
|
|
@@ -94,6 +101,7 @@ module Terraspace
|
|
|
94
101
|
def check_project!(command_name)
|
|
95
102
|
return if subcommand?
|
|
96
103
|
return if command_name.nil?
|
|
104
|
+
return if help_flags.include?(Terraspace.argv.last) # IE: -h help
|
|
97
105
|
return if %w[-h -v check_setup completion completion_script help new test version].include?(command_name)
|
|
98
106
|
return if File.exist?("#{Terraspace.root}/config/app.rb")
|
|
99
107
|
logger.error "ERROR: It doesnt look like this is a terraspace project. Are you sure you are in a terraspace project?".color(:red)
|
|
@@ -37,7 +37,7 @@ module Terraspace::Compiler
|
|
|
37
37
|
|
|
38
38
|
def build_config_terraform
|
|
39
39
|
expr = "#{Terraspace.root}/config/terraform/**/*"
|
|
40
|
-
|
|
40
|
+
search(expr).each do |path|
|
|
41
41
|
next unless File.file?(path)
|
|
42
42
|
next if path.include?('config/terraform/tfvars')
|
|
43
43
|
build_config_file(basename(path))
|
|
@@ -45,13 +45,13 @@ module Terraspace::Compiler
|
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
def build_config_file(file)
|
|
48
|
-
existing =
|
|
48
|
+
existing = search("#{@mod.root}/#{file}").first
|
|
49
49
|
return if existing && existing.ends_with?(".tf") # do not overwrite existing backend.tf, provider.tf, etc
|
|
50
50
|
|
|
51
51
|
if file.ends_with?(".rb")
|
|
52
|
-
src_path =
|
|
52
|
+
src_path = search("#{@mod.root}/#{basename(file)}").first # existing source. IE: backend.rb in module folder
|
|
53
53
|
end
|
|
54
|
-
src_path ||=
|
|
54
|
+
src_path ||= search("#{Terraspace.root}/config/terraform/#{file}").first
|
|
55
55
|
build_mod_file(src_path) if src_path
|
|
56
56
|
end
|
|
57
57
|
|
|
@@ -65,7 +65,7 @@ module Terraspace::Compiler
|
|
|
65
65
|
end
|
|
66
66
|
|
|
67
67
|
def with_path(path)
|
|
68
|
-
|
|
68
|
+
search(path).each do |src_path|
|
|
69
69
|
next if skip?(src_path)
|
|
70
70
|
yield(src_path)
|
|
71
71
|
end
|
|
@@ -80,5 +80,9 @@ module Terraspace::Compiler
|
|
|
80
80
|
src_path.include?("#{@mod.root}/test") ||
|
|
81
81
|
src_path.include?("#{@mod.root}/tfvars")
|
|
82
82
|
end
|
|
83
|
+
|
|
84
|
+
def search(expr)
|
|
85
|
+
Dir.glob(expr, File::FNM_DOTMATCH)
|
|
86
|
+
end
|
|
83
87
|
end
|
|
84
88
|
end
|
|
@@ -11,8 +11,8 @@ module Terraspace::Compiler
|
|
|
11
11
|
def command_is?(*commands)
|
|
12
12
|
commands.flatten!
|
|
13
13
|
commands.map!(&:to_s)
|
|
14
|
-
commands.include?(
|
|
15
|
-
|
|
14
|
+
commands.include?(Terraspace.argv[0]) || # IE: terraspace up
|
|
15
|
+
Terraspace.argv[0] == "all" && commands.include?(Terraspace.argv[1]) # IE: terraspace all up
|
|
16
16
|
end
|
|
17
17
|
end
|
|
18
18
|
end
|
|
@@ -19,7 +19,7 @@ module Terraspace::Compiler::Dsl::Syntax::Helpers
|
|
|
19
19
|
# terraspace_command('-') => "terraspace-up-demo"
|
|
20
20
|
#
|
|
21
21
|
def terraspace_command(separator=' ')
|
|
22
|
-
args =
|
|
22
|
+
args = Terraspace.argv[0..1] || []
|
|
23
23
|
command = ["terraspace"] + args
|
|
24
24
|
command.join(separator)
|
|
25
25
|
end
|
data/lib/terraspace/core.rb
CHANGED
|
@@ -58,5 +58,15 @@ module Terraspace
|
|
|
58
58
|
i.is_a?(Regexp) ? path =~ i : path.include?(i)
|
|
59
59
|
end
|
|
60
60
|
end
|
|
61
|
+
|
|
62
|
+
# Terraspace.argv provides consistency when terraspace is being called by rspec-terrspace test harness
|
|
63
|
+
# So use Terraspace.argv instead of ARGV constant
|
|
64
|
+
def argv=(argv)
|
|
65
|
+
@@argv = argv
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def argv
|
|
69
|
+
@@argv
|
|
70
|
+
end
|
|
61
71
|
end
|
|
62
72
|
end
|
|
@@ -11,12 +11,24 @@ module Terraspace::Terraform::Args
|
|
|
11
11
|
# https://terraspace.cloud/docs/ci-automation/
|
|
12
12
|
ENV['TF_IN_AUTOMATION'] = '1' if @options[:auto]
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
args = []
|
|
15
|
+
|
|
16
|
+
if straight_delegate_args?
|
|
17
|
+
args += @options[:rest]
|
|
18
|
+
args.flatten!
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
args_meth = "#{@name}_args".gsub(' ', '_') # IE: apply_args, init_args
|
|
15
22
|
if respond_to?(args_meth)
|
|
16
|
-
send(args_meth)
|
|
17
|
-
else
|
|
18
|
-
[]
|
|
23
|
+
args += send(args_meth)
|
|
19
24
|
end
|
|
25
|
+
|
|
26
|
+
args
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# delegate args straight through for special commands, currently state seems to be the only case
|
|
30
|
+
def straight_delegate_args?
|
|
31
|
+
@name.include?("state") # IE: "state list", "state pull", "state show"
|
|
20
32
|
end
|
|
21
33
|
|
|
22
34
|
def force_unlock_args
|
data/lib/terraspace/version.rb
CHANGED
data/terraspace.gemspec
CHANGED
|
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
|
|
|
37
37
|
spec.add_dependency "terraspace_plugin_aws", "~> 0.3.0"
|
|
38
38
|
spec.add_dependency "terraspace_plugin_azurerm", "~> 0.3.0"
|
|
39
39
|
spec.add_dependency "terraspace_plugin_google", "~> 0.3.0"
|
|
40
|
-
spec.add_dependency "rspec-terraspace", "~> 0.
|
|
40
|
+
spec.add_dependency "rspec-terraspace", "~> 0.3.0"
|
|
41
41
|
|
|
42
42
|
spec.add_development_dependency "bundler"
|
|
43
43
|
spec.add_development_dependency "byebug"
|
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.6.
|
|
4
|
+
version: 0.6.12
|
|
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-
|
|
11
|
+
date: 2021-07-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -254,14 +254,14 @@ dependencies:
|
|
|
254
254
|
requirements:
|
|
255
255
|
- - "~>"
|
|
256
256
|
- !ruby/object:Gem::Version
|
|
257
|
-
version: 0.
|
|
257
|
+
version: 0.3.0
|
|
258
258
|
type: :runtime
|
|
259
259
|
prerelease: false
|
|
260
260
|
version_requirements: !ruby/object:Gem::Requirement
|
|
261
261
|
requirements:
|
|
262
262
|
- - "~>"
|
|
263
263
|
- !ruby/object:Gem::Version
|
|
264
|
-
version: 0.
|
|
264
|
+
version: 0.3.0
|
|
265
265
|
- !ruby/object:Gem::Dependency
|
|
266
266
|
name: bundler
|
|
267
267
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -532,6 +532,7 @@ files:
|
|
|
532
532
|
- lib/terraspace/cli/help/refresh.md
|
|
533
533
|
- lib/terraspace/cli/help/seed.md
|
|
534
534
|
- lib/terraspace/cli/help/show.md
|
|
535
|
+
- lib/terraspace/cli/help/state.md
|
|
535
536
|
- lib/terraspace/cli/help/summary.md
|
|
536
537
|
- lib/terraspace/cli/help/test.md
|
|
537
538
|
- lib/terraspace/cli/help/tfc/destroy.md
|