inspec-cloudformation 0.0.2 → 0.0.5
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 +2 -0
- data/README.md +9 -0
- data/lib/inspec-cloudformation/input.rb +15 -11
- data/lib/inspec-cloudformation/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e96908dc7e410048189fb3e7e4ddd8ddcde32109204a2f2b4cb3e792907bdd47
|
|
4
|
+
data.tar.gz: a4dd5efe5c88c82778eb421627df4fd0ff8daf454a08d49a466143563036c6e9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: df1da2ff6388e562e048f9f73ec6f495a24e339483021895d0d5048abfc309723492ab5fed8e3013e33d041b778e981ddd01ebe4e25d38e7bff1f778d90e4bc6
|
|
7
|
+
data.tar.gz: 3512c44a93d000d5f6acca4cbb050ad0e632adab8eb585b4f175f5124fdb4cfeca392f3bbbc8c67c05f0c75401c29b545d38c46e6958389e9d3576820b8427cc
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -5,10 +5,10 @@ require 'aws-sdk-cloudformation'
|
|
|
5
5
|
module InspecPlugins::CloudFormation
|
|
6
6
|
class Input < Inspec.plugin(2, :input)
|
|
7
7
|
|
|
8
|
-
VALID_PATTERNS = [
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
].freeze
|
|
8
|
+
# VALID_PATTERNS = [
|
|
9
|
+
# Regexp.new("^databag://[^/]+/[^/]+/.+$"),
|
|
10
|
+
# Regexp.new("^node://[^/]*/attributes/.+$"),
|
|
11
|
+
# ].freeze
|
|
12
12
|
|
|
13
13
|
attr_reader :plugin_conf
|
|
14
14
|
attr_reader :priority
|
|
@@ -41,15 +41,16 @@ module InspecPlugins::CloudFormation
|
|
|
41
41
|
def fetch(profile_name, input_name)
|
|
42
42
|
# skip any input name that is an invalid cloudformation stack name to keep things quick...no need to make the AWS API call.
|
|
43
43
|
return nil if input_name.include?('_')
|
|
44
|
-
|
|
45
|
-
cf = Aws::CloudFormation::Client.new
|
|
44
|
+
return nil unless input_name.include?('/')
|
|
46
45
|
|
|
47
46
|
# input format will be "cloudformation stack name / output name"
|
|
48
47
|
stack_name = input_name.split('/').first
|
|
49
48
|
output_name = input_name.split('/').last
|
|
50
49
|
|
|
51
|
-
logger.
|
|
52
|
-
logger.
|
|
50
|
+
logger.debug format("The stack name is %s", stack_name)
|
|
51
|
+
logger.debug format("The output name is %s", output_name)
|
|
52
|
+
|
|
53
|
+
cf = Aws::CloudFormation::Client.new
|
|
53
54
|
|
|
54
55
|
name = { stack_name: stack_name }
|
|
55
56
|
resp = cf.describe_stacks(name)
|
|
@@ -59,13 +60,16 @@ module InspecPlugins::CloudFormation
|
|
|
59
60
|
next unless output['output_key'] == output_name
|
|
60
61
|
return output['output_value']
|
|
61
62
|
end
|
|
63
|
+
|
|
64
|
+
# if no CloudFormation output found
|
|
65
|
+
return nil
|
|
62
66
|
end
|
|
63
67
|
|
|
64
68
|
private
|
|
65
69
|
|
|
66
|
-
def valid_plugin_input?(input)
|
|
67
|
-
|
|
68
|
-
end
|
|
70
|
+
# def valid_plugin_input?(input)
|
|
71
|
+
# VALID_PATTERNS.any? { |regex| regex.match? input }
|
|
72
|
+
# end
|
|
69
73
|
|
|
70
74
|
def fetch_plugin_setting(setting_name, default = nil)
|
|
71
75
|
env_var_name = "INSPEC_CLOUDFORMATION_#{setting_name.upcase}"
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: inspec-cloudformation
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andy Boutte
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-07-
|
|
11
|
+
date: 2022-07-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: This plugin allows InSpec 'inputs' to be provided by CloudFormation Outputs.
|
|
14
14
|
email:
|