cfndsl-pipeline 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/monkey_patches.rb +21 -7
- data/lib/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: f001f1bc6ba3694429cd2e221331d45a6b013c6a49f7260a672b67de7c246558
|
4
|
+
data.tar.gz: 06a059c9b463b55a7b732a0b7f32d2bbba14abe1c6d44e48062a9225e4cc128c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57d07fb86fc4d6f98cc8cf53ff0abdf80a2b30e3e7f2f72bfc29e985d95c84c43f51dfc076f816f23c90be7ae41d0583655e50de8c110dd7cc78fec3f3c13762
|
7
|
+
data.tar.gz: dc9d3a0fb2699ed97af75f03a695b6c029428b018e788c633373c8832cec1924dc3796d52870d8005852478eff35a24bb29b7e51af46f53b6cc7990ec5654787
|
data/lib/monkey_patches.rb
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
require 'cfndsl/globals'
|
4
4
|
require 'cfndsl/version'
|
5
5
|
PARAM_PROPS = %w[Description Default AllowedPattern AllowedValues].freeze
|
6
|
+
HAS_PROPAGATABLE_TAGS = %w[CfnDsl::AWS::Types::AWS_AutoScaling_AutoScalingGroup].freeze
|
7
|
+
HAS_MAPPED_TAGS = %w[CfnDsl::AWS::Types::AWS_Serverless_Function CfnDsl::AWS::Types::AWS_Serverless_SimpleTable CfnDsl::AWS::Types::AWS_Serverless_Application].freeze
|
6
8
|
|
7
9
|
# Automatically add Parameters for Tag values
|
8
10
|
CfnDsl::CloudFormationTemplate.class_eval do
|
@@ -48,12 +50,13 @@ module CfnDsl
|
|
48
50
|
val.map! { |item| fix_substitutions item }
|
49
51
|
end
|
50
52
|
|
53
|
+
## TODO Need to add exclusion if string is already a propoerty of FnSub...
|
51
54
|
def fix_string(val)
|
52
55
|
val.include?('${') ? FnSub(val) : val
|
53
56
|
end
|
54
57
|
end
|
55
58
|
|
56
|
-
# Automatically apply
|
59
|
+
# Automatically apply resource tag standard to supported resources (if supplied)
|
57
60
|
class ResourceDefinition
|
58
61
|
def initialize
|
59
62
|
apply_tag_standard
|
@@ -61,14 +64,25 @@ module CfnDsl
|
|
61
64
|
|
62
65
|
def apply_tag_standard
|
63
66
|
return unless defined? external_parameters[:TagStandard]
|
67
|
+
return unless external_parameters[:TagStandard].kind_of?(Hash)
|
64
68
|
|
65
|
-
|
66
|
-
external_parameters[:TagStandard].each do |tag_name, props|
|
67
|
-
add_tag(tag_name.to_s, Ref(props['LogicalName'] || tag_name))
|
68
|
-
end if external_parameters[:TagStandard].kind_of?(Hash)
|
69
|
+
resource_type = self.class.to_s
|
69
70
|
|
70
|
-
|
71
|
-
|
71
|
+
if defined? self.Tag
|
72
|
+
external_parameters[:TagStandard].each do |tag_name, props|
|
73
|
+
send(:Tag) do
|
74
|
+
Key tag_name.to_s
|
75
|
+
Value Ref(props['LogicalName'] || tag_name)
|
76
|
+
PropagateAtLaunch true if HAS_PROPAGATABLE_TAGS.include? resource_type
|
77
|
+
end
|
78
|
+
end
|
79
|
+
elsif HAS_MAPPED_TAGS.include? resource_type
|
80
|
+
tag_map = {}
|
81
|
+
external_parameters[:TagStandard].each do |tag_name, props|
|
82
|
+
tag_map[tag_name.to_s] = Ref(props['LogicalName'] || tag_name)
|
83
|
+
end
|
84
|
+
Tags tag_map
|
85
|
+
end
|
72
86
|
end
|
73
87
|
end
|
74
88
|
end
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cfndsl-pipeline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cam Maxwell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-08-
|
11
|
+
date: 2019-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cfn-nag
|