cfndsl-pipeline 0.1.0 → 0.1.1

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/monkey_patches.rb +21 -7
  3. data/lib/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e9d71f50ea1fafc076f9390e279f8bb3c3c3799567a16f04894708fd79727ad8
4
- data.tar.gz: b75350a9198ab44e4907c07c2e9ccdb27b6f8600a6ab9ea2c1dbbf4d6fc4995f
3
+ metadata.gz: f001f1bc6ba3694429cd2e221331d45a6b013c6a49f7260a672b67de7c246558
4
+ data.tar.gz: 06a059c9b463b55a7b732a0b7f32d2bbba14abe1c6d44e48062a9225e4cc128c
5
5
  SHA512:
6
- metadata.gz: 226f45ed1fef866683576232ce522a5a8de498562d2b8d1b0a58a79018c03ad00cf2f1a6d78f666d76d69e478de244728af7767b1ed579fdcdafc8a7e639be58
7
- data.tar.gz: a97395d390c44b247521915fd42610c3257e53311c770e807ed99cfa40c70f3b8c37205008f2181284b76f443f87dc628324129957f700e3dc05cb4200cf1905
6
+ metadata.gz: 57d07fb86fc4d6f98cc8cf53ff0abdf80a2b30e3e7f2f72bfc29e985d95c84c43f51dfc076f816f23c90be7ae41d0583655e50de8c110dd7cc78fec3f3c13762
7
+ data.tar.gz: dc9d3a0fb2699ed97af75f03a695b6c029428b018e788c633373c8832cec1924dc3796d52870d8005852478eff35a24bb29b7e51af46f53b6cc7990ec5654787
@@ -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 Tag standard to CfnDsl Resources (if supplied)
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
- # begin
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
- # rescue
71
- # end
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
@@ -1,3 +1,3 @@
1
1
  module CfnDslPipeline
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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.0
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-13 00:00:00.000000000 Z
11
+ date: 2019-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cfn-nag