terraspace_hooks 0.2.2 → 0.4.0
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/Gemfile +1 -1
- data/Gemfile.lock +49 -31
- data/lib/terraspace_hooks/infracost_generator.rb +11 -7
- data/lib/terraspace_hooks/tf_fmt_validator.rb +12 -8
- data/lib/terraspace_hooks/tf_validator.rb +12 -8
- data/lib/terraspace_hooks/tflint_validator.rb +4 -4
- data/lib/terraspace_hooks/tfsec_validator.rb +3 -3
- data/lib/terraspace_hooks/version.rb +1 -1
- metadata +3 -7
- data/terraspace_hooks.gemspec +0 -37
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 89b1ff06a4353838156a5402278693be36da27320e81b92a51a1f5755545409a
|
|
4
|
+
data.tar.gz: e563c37a8515993c247c61c44a111b48b31352927347846dedcde4876860db48
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e56199c882cb9d29c7c5b8958c2c2f130bc1e2e0e756331537d8b7de2e51d98f491fa8d841f464893dee28cf609b927f0a6fd5c0648cbc31a7062ab08bf870da
|
|
7
|
+
data.tar.gz: 386678a572d5e95cf145926fe225bd0010b4348556373e0c8c66b09e873cb45a34e58a7961ce5735991626a9ce59de2fb98284e100ff7f77697e85b3e19a13f4
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,58 +1,76 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
terraspace_hooks (0.
|
|
4
|
+
terraspace_hooks (0.4.0)
|
|
5
5
|
zeitwerk (~> 2.6.7)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
-
ast (2.4.
|
|
11
|
-
json (2.
|
|
12
|
-
language_server-protocol (3.17.0.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
ast (2.4.3)
|
|
11
|
+
json (2.15.0)
|
|
12
|
+
language_server-protocol (3.17.0.5)
|
|
13
|
+
lint_roller (1.1.0)
|
|
14
|
+
minitest (5.25.5)
|
|
15
|
+
parallel (1.27.0)
|
|
16
|
+
parser (3.3.9.0)
|
|
16
17
|
ast (~> 2.4.1)
|
|
18
|
+
racc
|
|
19
|
+
prism (1.5.1)
|
|
20
|
+
racc (1.8.1)
|
|
17
21
|
rainbow (3.1.1)
|
|
18
|
-
rake (13.0
|
|
19
|
-
regexp_parser (2.
|
|
20
|
-
|
|
21
|
-
rubocop (1.44.1)
|
|
22
|
+
rake (13.3.0)
|
|
23
|
+
regexp_parser (2.11.3)
|
|
24
|
+
rubocop (1.80.2)
|
|
22
25
|
json (~> 2.3)
|
|
26
|
+
language_server-protocol (~> 3.17.0.2)
|
|
27
|
+
lint_roller (~> 1.1.0)
|
|
23
28
|
parallel (~> 1.10)
|
|
24
|
-
parser (>= 3.
|
|
29
|
+
parser (>= 3.3.0.2)
|
|
25
30
|
rainbow (>= 2.2.2, < 4.0)
|
|
26
|
-
regexp_parser (>=
|
|
27
|
-
|
|
28
|
-
rubocop-ast (>= 1.24.1, < 2.0)
|
|
31
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
|
32
|
+
rubocop-ast (>= 1.46.0, < 2.0)
|
|
29
33
|
ruby-progressbar (~> 1.7)
|
|
30
|
-
unicode-display_width (>= 2.4.0, <
|
|
31
|
-
rubocop-ast (1.
|
|
32
|
-
parser (>= 3.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
rubocop (
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
35
|
+
rubocop-ast (1.47.1)
|
|
36
|
+
parser (>= 3.3.7.2)
|
|
37
|
+
prism (~> 1.4)
|
|
38
|
+
rubocop-performance (1.25.0)
|
|
39
|
+
lint_roller (~> 1.1)
|
|
40
|
+
rubocop (>= 1.75.0, < 2.0)
|
|
41
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
|
42
|
+
rubocop-rake (0.7.1)
|
|
43
|
+
lint_roller (~> 1.1)
|
|
44
|
+
rubocop (>= 1.72.1)
|
|
45
|
+
ruby-progressbar (1.13.0)
|
|
46
|
+
standard (1.51.1)
|
|
40
47
|
language_server-protocol (~> 3.17.0.2)
|
|
41
|
-
|
|
42
|
-
rubocop
|
|
43
|
-
|
|
44
|
-
|
|
48
|
+
lint_roller (~> 1.0)
|
|
49
|
+
rubocop (~> 1.80.2)
|
|
50
|
+
standard-custom (~> 1.0.0)
|
|
51
|
+
standard-performance (~> 1.8)
|
|
52
|
+
standard-custom (1.0.2)
|
|
53
|
+
lint_roller (~> 1.0)
|
|
54
|
+
rubocop (~> 1.50)
|
|
55
|
+
standard-performance (1.8.0)
|
|
56
|
+
lint_roller (~> 1.1)
|
|
57
|
+
rubocop-performance (~> 1.25.0)
|
|
58
|
+
unicode-display_width (3.2.0)
|
|
59
|
+
unicode-emoji (~> 4.1)
|
|
60
|
+
unicode-emoji (4.1.0)
|
|
61
|
+
zeitwerk (2.6.18)
|
|
45
62
|
|
|
46
63
|
PLATFORMS
|
|
47
64
|
arm64-darwin-22
|
|
65
|
+
arm64-darwin-24
|
|
48
66
|
x86_64-linux
|
|
49
67
|
|
|
50
68
|
DEPENDENCIES
|
|
51
|
-
minitest (~> 5.
|
|
69
|
+
minitest (~> 5.25.5)
|
|
52
70
|
rake (~> 13.0)
|
|
53
71
|
rubocop-rake
|
|
54
72
|
standard
|
|
55
73
|
terraspace_hooks!
|
|
56
74
|
|
|
57
75
|
BUNDLED WITH
|
|
58
|
-
2.
|
|
76
|
+
2.7.2
|
|
@@ -5,8 +5,11 @@ module TerraspaceHooks
|
|
|
5
5
|
class InfracostGenerator
|
|
6
6
|
# rubocop:disable Metrics/MethodLength
|
|
7
7
|
def call(runner)
|
|
8
|
+
return if ENV['SKIP_TERRASPACE_HOOKS_ALL']
|
|
9
|
+
return if ENV['SKIP_TERRASPACE_HOOKS_INFRACOST_GENERATOR']
|
|
10
|
+
|
|
8
11
|
raise 'Infracost not available' unless infracost_available?
|
|
9
|
-
raise 'Terraform not available' unless
|
|
12
|
+
raise 'Terraform not available' unless opentofu_available?
|
|
10
13
|
|
|
11
14
|
mod = runner.mod
|
|
12
15
|
command = <<-COMMAND
|
|
@@ -14,16 +17,13 @@ module TerraspaceHooks
|
|
|
14
17
|
NC='\033[0m'
|
|
15
18
|
cd #{mod.cache_dir} && \
|
|
16
19
|
echo "${YELLOW}[INFO #{mod.name}]${NC} Convert to plan.json..." && \
|
|
17
|
-
|
|
20
|
+
#{terraform_bin} show -json tfplan.binary > plan.json && \
|
|
18
21
|
|
|
19
22
|
echo "${YELLOW}[INFO #{mod.name}]${NC} Infracost breakdown for #{mod.name}..." && \
|
|
20
23
|
infracost breakdown --project-name #{mod.name} --path plan.json --format json --out-file infracost_breakdown.json && \
|
|
21
24
|
infracost output --path infracost_breakdown.json --format table --show-skipped
|
|
22
25
|
COMMAND
|
|
23
26
|
|
|
24
|
-
return if ENV['SKIP_TERRASPACE_HOOKS_ALL']
|
|
25
|
-
return if ENV['SKIP_TERRASPACE_HOOKS_INFRACOST_GENERATOR']
|
|
26
|
-
|
|
27
27
|
system(command, exception: true)
|
|
28
28
|
end
|
|
29
29
|
# rubocop:enable Metrics/MethodLength
|
|
@@ -32,8 +32,12 @@ module TerraspaceHooks
|
|
|
32
32
|
system('which infracost')
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
-
def
|
|
36
|
-
|
|
35
|
+
def terraform_bin
|
|
36
|
+
ENV['TERRASPACE_HOOKS_BIN'] || 'tofu'
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def opentofu_available?
|
|
40
|
+
system("which #{terraform_bin}")
|
|
37
41
|
end
|
|
38
42
|
end
|
|
39
43
|
end
|
|
@@ -5,26 +5,30 @@ module TerraspaceHooks
|
|
|
5
5
|
class TfFmtValidator
|
|
6
6
|
# rubocop:disable Metrics/MethodLength
|
|
7
7
|
def call(runner)
|
|
8
|
-
|
|
8
|
+
return if ENV['SKIP_TERRASPACE_HOOKS_ALL']
|
|
9
|
+
return if ENV['SKIP_TERRASPACE_HOOKS_TF_FMT_VALIDATOR']
|
|
10
|
+
|
|
11
|
+
raise 'Terraform not available' unless opentofu_available?
|
|
9
12
|
|
|
10
13
|
mod = runner.mod
|
|
11
14
|
command = <<-COMMAND
|
|
12
15
|
YELLOW='\033[0;33m'
|
|
13
16
|
NC='\033[0m'
|
|
14
17
|
cd #{mod.cache_dir} && \
|
|
15
|
-
echo "${YELLOW}[INFO #{mod.name}]${NC} Run
|
|
16
|
-
|
|
18
|
+
echo "${YELLOW}[INFO #{mod.name}]${NC} Run #{terraform_bin} fmt for #{mod.name}..." && \
|
|
19
|
+
#{terraform_bin} fmt
|
|
17
20
|
COMMAND
|
|
18
21
|
|
|
19
|
-
return if ENV['SKIP_TERRASPACE_HOOKS_ALL']
|
|
20
|
-
return if ENV['SKIP_TERRASPACE_HOOKS_TF_FMT_VALIDATOR']
|
|
21
|
-
|
|
22
22
|
system(command, exception: true)
|
|
23
23
|
end
|
|
24
24
|
# rubocop:enable Metrics/MethodLength
|
|
25
25
|
|
|
26
|
-
def
|
|
27
|
-
|
|
26
|
+
def terraform_bin
|
|
27
|
+
ENV['TERRASPACE_HOOKS_BIN'] || 'tofu'
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def opentofu_available?
|
|
31
|
+
system("which #{terraform_bin}")
|
|
28
32
|
end
|
|
29
33
|
end
|
|
30
34
|
end
|
|
@@ -5,26 +5,30 @@ module TerraspaceHooks
|
|
|
5
5
|
class TfValidator
|
|
6
6
|
# rubocop:disable Metrics/MethodLength
|
|
7
7
|
def call(runner)
|
|
8
|
-
|
|
8
|
+
return if ENV['SKIP_TERRASPACE_HOOKS_ALL']
|
|
9
|
+
return if ENV['SKIP_TERRASPACE_HOOKS_TF_VALIDATOR']
|
|
10
|
+
|
|
11
|
+
raise 'Terraform not available' unless opentofu_available?
|
|
9
12
|
|
|
10
13
|
mod = runner.mod
|
|
11
14
|
command = <<-COMMAND
|
|
12
15
|
YELLOW='\033[0;33m'
|
|
13
16
|
NC='\033[0m'
|
|
14
17
|
cd #{mod.cache_dir} && \
|
|
15
|
-
echo "${YELLOW}[INFO #{mod.name}]${NC} Run
|
|
16
|
-
|
|
18
|
+
echo "${YELLOW}[INFO #{mod.name}]${NC} Run #{terraform_bin} validate for #{mod.name}..." && \
|
|
19
|
+
#{terraform_bin} validate
|
|
17
20
|
COMMAND
|
|
18
21
|
|
|
19
|
-
return if ENV['SKIP_TERRASPACE_HOOKS_ALL']
|
|
20
|
-
return if ENV['SKIP_TERRASPACE_HOOKS_TF_VALIDATOR']
|
|
21
|
-
|
|
22
22
|
system(command, exception: true)
|
|
23
23
|
end
|
|
24
24
|
# rubocop:enable Metrics/MethodLength
|
|
25
25
|
|
|
26
|
-
def
|
|
27
|
-
|
|
26
|
+
def terraform_bin
|
|
27
|
+
ENV['TERRASPACE_HOOKS_BIN'] || 'tofu'
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def opentofu_available?
|
|
31
|
+
system("which #{terraform_bin}")
|
|
28
32
|
end
|
|
29
33
|
end
|
|
30
34
|
end
|
|
@@ -5,6 +5,9 @@ module TerraspaceHooks
|
|
|
5
5
|
class TflintValidator
|
|
6
6
|
# rubocop:disable Metrics/MethodLength
|
|
7
7
|
def call(runner)
|
|
8
|
+
return if ENV['SKIP_TERRASPACE_HOOKS_ALL']
|
|
9
|
+
return if ENV['SKIP_TERRASPACE_HOOKS_TFLINT_VALIDATOR']
|
|
10
|
+
|
|
8
11
|
raise 'Tflint not available' unless tflint_available?
|
|
9
12
|
|
|
10
13
|
mod = runner.mod
|
|
@@ -13,12 +16,9 @@ module TerraspaceHooks
|
|
|
13
16
|
NC='\033[0m'
|
|
14
17
|
cd #{mod.cache_dir} && \
|
|
15
18
|
echo "${YELLOW}[INFO #{mod.name}]${NC} Run tflint for #{mod.name}..." && \
|
|
16
|
-
tflint
|
|
19
|
+
tflint --disable-rule=terraform_required_version --call-module-type=all
|
|
17
20
|
COMMAND
|
|
18
21
|
|
|
19
|
-
return if ENV['SKIP_TERRASPACE_HOOKS_ALL']
|
|
20
|
-
return if ENV['SKIP_TERRASPACE_HOOKS_TFLINT_VALIDATOR']
|
|
21
|
-
|
|
22
22
|
system(command, exception: true)
|
|
23
23
|
end
|
|
24
24
|
# rubocop:enable Metrics/MethodLength
|
|
@@ -5,6 +5,9 @@ module TerraspaceHooks
|
|
|
5
5
|
class TfsecValidator
|
|
6
6
|
# rubocop:disable Metrics/MethodLength
|
|
7
7
|
def call(runner)
|
|
8
|
+
return if ENV['SKIP_TERRASPACE_HOOKS_ALL']
|
|
9
|
+
return if ENV['SKIP_TERRASPACE_HOOKS_TFSEC_VALIDATOR']
|
|
10
|
+
|
|
8
11
|
raise 'Tfsec not available' unless tfsec_available?
|
|
9
12
|
|
|
10
13
|
mod = runner.mod
|
|
@@ -16,9 +19,6 @@ module TerraspaceHooks
|
|
|
16
19
|
tfsec --concise-output
|
|
17
20
|
COMMAND
|
|
18
21
|
|
|
19
|
-
return if ENV['SKIP_TERRASPACE_HOOKS_ALL']
|
|
20
|
-
return if ENV['SKIP_TERRASPACE_HOOKS_TFSEC_VALIDATOR']
|
|
21
|
-
|
|
22
22
|
system(command, exception: true)
|
|
23
23
|
end
|
|
24
24
|
# rubocop:enable Metrics/MethodLength
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: terraspace_hooks
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- slamet kristanto
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: zeitwerk
|
|
@@ -48,7 +47,6 @@ files:
|
|
|
48
47
|
- lib/terraspace_hooks/tfsec_validator.rb
|
|
49
48
|
- lib/terraspace_hooks/version.rb
|
|
50
49
|
- sig/terraspace_hooks.rbs
|
|
51
|
-
- terraspace_hooks.gemspec
|
|
52
50
|
homepage: https://github.com/drselump14/terraspace_hooks
|
|
53
51
|
licenses:
|
|
54
52
|
- MIT
|
|
@@ -56,7 +54,6 @@ metadata:
|
|
|
56
54
|
homepage_uri: https://github.com/drselump14/terraspace_hooks
|
|
57
55
|
source_code_uri: https://github.com/drselump14/terraspace_hooks
|
|
58
56
|
changelog_uri: https://github.com/drselump14/terraspace_hooks
|
|
59
|
-
post_install_message:
|
|
60
57
|
rdoc_options: []
|
|
61
58
|
require_paths:
|
|
62
59
|
- lib
|
|
@@ -71,8 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
71
68
|
- !ruby/object:Gem::Version
|
|
72
69
|
version: '0'
|
|
73
70
|
requirements: []
|
|
74
|
-
rubygems_version: 3.
|
|
75
|
-
signing_key:
|
|
71
|
+
rubygems_version: 3.7.2
|
|
76
72
|
specification_version: 4
|
|
77
73
|
summary: Useful terraspace hook collection (infracost generator, tflint, tf validate)
|
|
78
74
|
test_files: []
|
data/terraspace_hooks.gemspec
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative 'lib/terraspace_hooks/version'
|
|
4
|
-
|
|
5
|
-
Gem::Specification.new do |spec|
|
|
6
|
-
spec.name = 'terraspace_hooks'
|
|
7
|
-
spec.version = TerraspaceHooks::VERSION
|
|
8
|
-
spec.authors = ['slamet kristanto']
|
|
9
|
-
spec.email = ['botoksgonzales@gmail.com']
|
|
10
|
-
|
|
11
|
-
spec.summary = 'Useful terraspace hook collection (infracost generator, tflint, tf validate)'
|
|
12
|
-
spec.description = 'Useful terraspace hook collection (infracost generator, tflint, tf validate)'
|
|
13
|
-
spec.homepage = 'https://github.com/drselump14/terraspace_hooks'
|
|
14
|
-
spec.license = 'MIT'
|
|
15
|
-
spec.required_ruby_version = '>= 2.6.0'
|
|
16
|
-
|
|
17
|
-
spec.metadata['homepage_uri'] = spec.homepage
|
|
18
|
-
spec.metadata['source_code_uri'] = 'https://github.com/drselump14/terraspace_hooks'
|
|
19
|
-
spec.metadata['changelog_uri'] = 'https://github.com/drselump14/terraspace_hooks'
|
|
20
|
-
|
|
21
|
-
# Specify which files should be added to the gem when it is released.
|
|
22
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
23
|
-
spec.files = Dir.chdir(__dir__) do
|
|
24
|
-
`git ls-files -z`.split("\x0").reject do |f|
|
|
25
|
-
(File.expand_path(f) == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|circleci)|appveyor)})
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
spec.bindir = 'exe'
|
|
29
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
|
30
|
-
spec.require_paths = ['lib']
|
|
31
|
-
|
|
32
|
-
# Uncomment to register a new dependency of your gem
|
|
33
|
-
spec.add_dependency 'zeitwerk', '~> 2.6.7'
|
|
34
|
-
|
|
35
|
-
# For more information and examples about making a new gem, check out our
|
|
36
|
-
# guide at: https://bundler.io/guides/creating_gem.html
|
|
37
|
-
end
|