cfndsl 0.15.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +3 -0
  3. data/.rubocop.yml +6 -6
  4. data/.travis.yml +10 -5
  5. data/CHANGELOG.md +721 -400
  6. data/Gemfile +2 -0
  7. data/README.md +85 -23
  8. data/Rakefile +28 -6
  9. data/TODO.md +18 -0
  10. data/UPGRADING.md +22 -0
  11. data/cfndsl.gemspec +17 -16
  12. data/exe/cfndsl +5 -0
  13. data/lib/cfndsl.rb +3 -113
  14. data/lib/cfndsl/aws/cloud_formation_template.rb +10 -1
  15. data/lib/cfndsl/aws/patches/000_CloudFormationResourceSpecification.json +51726 -0
  16. data/lib/cfndsl/aws/patches/000_sam.spec.json +1242 -0
  17. data/lib/cfndsl/aws/patches/100_sam.spec_DeploymentPreference_patch.json +64 -0
  18. data/lib/cfndsl/aws/patches/200_Scrutinies_patch.json +86 -0
  19. data/lib/cfndsl/aws/patches/500_Cognito_IdentityPoolRoleAttachment_patches.json +25 -0
  20. data/lib/cfndsl/aws/patches/500_IoT1Click_patch_PlacementTemplate_DeviceTemplates.json +20 -0
  21. data/lib/cfndsl/aws/patches/500_NetworkAclEntry_patch.json +16 -0
  22. data/lib/cfndsl/aws/patches/500_SAM_Serverless_Function_S3Event_Events_patch.json +16 -0
  23. data/lib/cfndsl/aws/patches/500_SAM_Serverless_Function_S3Location_Version_patch.json +16 -0
  24. data/lib/cfndsl/aws/patches/500_SSM_AssociationName_patch.json +16 -0
  25. data/lib/cfndsl/aws/patches/500_VPCEndpoint_patch.json +17 -0
  26. data/lib/cfndsl/aws/patches/510_ElasticSearch_Domain_patches.json +15 -0
  27. data/lib/cfndsl/aws/patches/520_ServiceDiscovery_InstanceAttributes_patch.json +16 -0
  28. data/lib/cfndsl/aws/patches/600_RefKinds_patch.json +3654 -0
  29. data/lib/cfndsl/aws/patches/700_SAM_Serverless_Function_InlineCode_patch.json +20 -0
  30. data/lib/cfndsl/aws/patches/800_List_types_patch.json +115 -0
  31. data/lib/cfndsl/aws/resource_specification.json +39955 -9293
  32. data/lib/cfndsl/aws/types.rb +5 -3
  33. data/lib/cfndsl/cfnlego.rb +34 -0
  34. data/lib/{cfnlego → cfndsl/cfnlego}/cloudformation.erb +0 -0
  35. data/lib/{cfnlego → cfndsl/cfnlego}/cloudformation.rb +3 -1
  36. data/lib/{cfnlego → cfndsl/cfnlego}/resource.rb +5 -8
  37. data/lib/cfndsl/cloudformation.rb +114 -0
  38. data/lib/cfndsl/conditions.rb +13 -1
  39. data/lib/cfndsl/creation_policy.rb +3 -1
  40. data/lib/cfndsl/deep_merge.rb +4 -0
  41. data/lib/cfndsl/external_parameters.rb +12 -13
  42. data/lib/cfndsl/globals.rb +51 -10
  43. data/lib/cfndsl/json_serialisable_object.rb +4 -2
  44. data/lib/cfndsl/jsonable.rb +51 -68
  45. data/lib/cfndsl/mappings.rb +3 -1
  46. data/lib/cfndsl/module.rb +18 -5
  47. data/lib/cfndsl/names.rb +2 -0
  48. data/lib/cfndsl/orchestration_template.rb +193 -73
  49. data/lib/cfndsl/outputs.rb +7 -1
  50. data/lib/cfndsl/parameters.rb +3 -1
  51. data/lib/cfndsl/plurals.rb +23 -10
  52. data/lib/cfndsl/properties.rb +3 -1
  53. data/lib/cfndsl/rake_task.rb +217 -15
  54. data/lib/cfndsl/ref_check.rb +21 -11
  55. data/lib/cfndsl/resources.rb +8 -19
  56. data/lib/cfndsl/rules.rb +46 -0
  57. data/lib/cfndsl/runner.rb +143 -0
  58. data/lib/cfndsl/specification.rb +82 -84
  59. data/lib/cfndsl/types.rb +212 -95
  60. data/lib/cfndsl/update_policy.rb +3 -1
  61. data/lib/cfndsl/version.rb +3 -1
  62. data/lib/deep_merge/core.rb +10 -6
  63. data/lib/deep_merge/deep_merge.rb +3 -1
  64. data/sample/autoscale.rb +1 -1
  65. data/sample/autoscale2.rb +4 -3
  66. data/sample/circular.rb +2 -0
  67. data/sample/codedeploy.rb +3 -1
  68. data/sample/config_service.rb +5 -3
  69. data/sample/ecs.rb +3 -1
  70. data/sample/export.rb +5 -3
  71. data/sample/iam_policies.rb +2 -0
  72. data/sample/import.rb +4 -2
  73. data/sample/lambda.rb +3 -1
  74. data/sample/s3.rb +2 -0
  75. data/sample/t1.rb +3 -1
  76. data/sample/vpc_example.rb +3 -1
  77. data/sample/vpc_with_vpn_example.rb +3 -1
  78. data/spec/aws/ec2_security_group_spec.rb +2 -0
  79. data/spec/aws/ecs_task_definition_spec.rb +2 -0
  80. data/spec/aws/iam_managed_policy_spec.rb +2 -0
  81. data/spec/aws/kms_alias_spec.rb +2 -0
  82. data/spec/aws/list_type_patches_spec.rb +35 -0
  83. data/spec/aws/logs_log_group_spec.rb +2 -0
  84. data/spec/aws/nested_arrays_spec.rb +194 -0
  85. data/spec/aws/rds_db_instance_spec.rb +2 -0
  86. data/spec/aws/serverless_spec.rb +2 -2
  87. data/spec/cfndsl_spec.rb +102 -63
  88. data/spec/cli_spec.rb +52 -49
  89. data/spec/cloud_formation_template_spec.rb +235 -0
  90. data/spec/condition_spec.rb +24 -0
  91. data/spec/deep_merge_spec.rb +2 -0
  92. data/spec/direct_ruby_spec.rb +19 -0
  93. data/spec/external_parameters_spec.rb +25 -20
  94. data/spec/fixtures/condition-assertion.json +1 -0
  95. data/spec/fixtures/params.json +1 -0
  96. data/spec/fixtures/params.yaml +2 -0
  97. data/spec/fixtures/params_struct1.yaml +4 -0
  98. data/spec/fixtures/params_struct2.yaml +4 -0
  99. data/spec/fixtures/rule-assertion.json +1 -0
  100. data/spec/fixtures/test.rb +12 -4
  101. data/spec/generate_spec.rb +4 -0
  102. data/spec/jsonable_spec.rb +2 -0
  103. data/spec/metadata_spec.rb +2 -0
  104. data/spec/names_spec.rb +2 -0
  105. data/spec/output_spec.rb +2 -0
  106. data/spec/plurals_spec.rb +2 -0
  107. data/spec/resource_name_spec.rb +21 -0
  108. data/spec/resources_spec.rb +2 -7
  109. data/spec/rule_spec.rb +17 -0
  110. data/spec/spec_helper.rb +4 -7
  111. data/spec/support/shared_examples/orchestration_template.rb +17 -2
  112. data/spec/transform_spec.rb +2 -0
  113. data/spec/types_definition_spec.rb +6 -7
  114. metadata +79 -25
  115. data/bin/cfndsl +0 -143
  116. data/lib/cfndsl/errors.rb +0 -29
  117. data/lib/cfndsl/os/heat_template.rb +0 -16
  118. data/lib/cfndsl/os/types.rb +0 -12
  119. data/lib/cfndsl/os/types.yaml +0 -2423
  120. data/lib/cfndsl/patches.rb +0 -98
  121. data/lib/cfnlego.rb +0 -42
  122. data/spec/fixtures/heattest.rb +0 -22
  123. data/spec/heat_template_spec.rb +0 -5
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe CfnDsl::ConditionDefinition do
6
+ let(:template) { CfnDsl::OrchestrationTemplate.new }
7
+ let(:target) { File.read("#{File.dirname(__FILE__)}/fixtures/condition-assertion.json") }
8
+
9
+ context '#Condition' do
10
+ it 'formats correctly' do
11
+ template.declare do
12
+ Condition(:TestConditionTwo, FnNot(Condition(:TestConditionOne)))
13
+ Resource(:TestResource) do
14
+ Condition(:TestConditionTwo)
15
+ end
16
+ Output(:TestOutput) do
17
+ Condition(:TestConditionOne)
18
+ end
19
+ end
20
+ json = template.to_json
21
+ expect(json).to eq(target)
22
+ end
23
+ end
24
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  describe DeepMerge do
3
5
  source = { key1: { keya1: 1, keya2: 2 }, key2: [1, 2] }
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ class TemplateBuilder
6
+ include CfnDsl::CloudFormation
7
+ end
8
+
9
+ describe TemplateBuilder do
10
+ it 'includes Functions' do
11
+ expect(subject.FnSub('Substitution')).to be_an_instance_of(CfnDsl::Fn)
12
+ end
13
+
14
+ context('#CloudFormation') do
15
+ it 'returns a CloudFormationTemplate' do
16
+ expect(subject.CloudFormation('A Template')).to be_an_instance_of(CfnDsl::CloudFormationTemplate)
17
+ end
18
+ end
19
+ end
@@ -1,6 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe CfnDsl::ExternalParameters do
6
+ let(:params_struct1) { "#{File.dirname(__FILE__)}/fixtures/params_struct1.yaml" }
7
+ let(:params_struct2) { "#{File.dirname(__FILE__)}/fixtures/params_struct2.yaml" }
8
+ let(:params_json) { "#{File.dirname(__FILE__)}/fixtures/params.json" }
9
+ let(:params_yaml) { "#{File.dirname(__FILE__)}/fixtures/params.yaml" }
10
+
4
11
  subject do
5
12
  exp = described_class.new
6
13
  exp.set_param(:username, 'Wiz Khalifa')
@@ -39,6 +46,21 @@ describe CfnDsl::ExternalParameters do
39
46
  end
40
47
  end
41
48
 
49
+ context '#set_param_capitalised' do
50
+ it 'treats keys as symbols only' do
51
+ subject.set_param('Reminder', 'You Know What It Is')
52
+ expect(subject['Reminder']).to eq('You Know What It Is')
53
+ end
54
+ end
55
+
56
+ context '#set_param_merge_struct' do
57
+ it 'treats keys as symbols only' do
58
+ subject.load_file(params_struct1)
59
+ subject.load_file(params_struct2)
60
+ expect(subject['TagStandard']).to eq('Tag1' => { 'Default' => 'value1' }, 'Tag2' => { 'Default' => 'value2' })
61
+ end
62
+ end
63
+
42
64
  context '#get_param' do
43
65
  it 'treats keys as symbols only' do
44
66
  subject.set_param(:reminder, 'You Know What It Is')
@@ -52,35 +74,18 @@ describe CfnDsl::ExternalParameters do
52
74
  end
53
75
  end
54
76
 
55
- context '#add_to_binding' do
56
- it 'defines the parameters as variables in the current binding' do
57
- current = binding
58
- subject.add_to_binding(current, nil)
59
- expect(current).to be_local_variable_defined(:username)
60
- end
61
-
62
- it 'prints to a logstream if given' do
63
- logstream = StringIO.new
64
- subject.add_to_binding(binding, logstream)
65
- logstream.rewind
66
- expect(logstream.read).to match('Setting local variable username to Wiz Khalifa')
67
- end
68
- end
69
-
70
77
  context '#load_file JSON', type: :aruba do
71
78
  before { write_file('params.json', '{"reminder":"You Know What It Is"}') }
72
79
 
73
80
  it 'merges a JSON file as parameters' do
74
- subject.load_file File.join(expand_path('./params.json'))
81
+ subject.load_file(params_json)
75
82
  expect(subject[:reminder]).to eq('You Know What It Is')
76
83
  end
77
84
  end
78
85
 
79
- context '#load_file YAML', type: :aruba do
80
- before { write_file('params.yaml', '{"reminder":"You Know What It Is"}') }
81
-
86
+ context '#load_file YAML' do
82
87
  it 'merges a YAML file as parameters' do
83
- subject.load_file File.join(expand_path('./params.yaml'))
88
+ subject.load_file(params_yaml)
84
89
  expect(subject[:reminder]).to eq('You Know What It Is')
85
90
  end
86
91
  end
@@ -0,0 +1 @@
1
+ {"AWSTemplateFormatVersion":"2010-09-09","Conditions":{"TestConditionTwo":{"Fn::Not":[{"Condition":"TestConditionOne"}]}},"Resources":{"TestResource":{"Condition":"TestConditionTwo"}},"Outputs":{"TestOutput":{"Condition":"TestConditionOne"}}}
@@ -0,0 +1 @@
1
+ {"reminder":"You Know What It Is"}
@@ -0,0 +1,2 @@
1
+ ---
2
+ reminder: You Know What It Is
@@ -0,0 +1,4 @@
1
+ ---
2
+ TagStandard:
3
+ Tag1:
4
+ Default: value1
@@ -0,0 +1,4 @@
1
+ ---
2
+ TagStandard:
3
+ Tag2:
4
+ Default: value2
@@ -0,0 +1 @@
1
+ {"Assertions":[{"Assert":{"Fn::EachMemberIn":[{"Fn::ValueOfAll":["a","b"]},{"Fn::RefAll":"c"}]},"AssertDescription":"x"}],"RuleCondition":{"Fn::Equals":[{"Ref":"y"},"z"]}}
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  CloudFormation do
2
- TEST ||= 'no value set'.freeze
4
+ TEST ||= 'no value set'
3
5
  puts TEST
4
6
 
5
7
  Description external_parameters[:test]
@@ -16,6 +18,11 @@ CloudFormation do
16
18
  MaxLength 15
17
19
  end
18
20
 
21
+ Parameter('Three') do
22
+ String
23
+ Default external_parameters[:three]
24
+ end
25
+
19
26
  # Condition Function examples
20
27
  Condition('OneIsTest', FnEquals(Ref('One'), 'Test'))
21
28
  Condition('OneIsNotTest', FnNot(FnEquals(Ref('One'), 'Test')))
@@ -23,7 +30,8 @@ CloudFormation do
23
30
  FnAnd(
24
31
  [
25
32
  FnEquals(Ref('One'), 'Test'),
26
- FnNot(FnEquals(Ref('Two'), 'Test'))
33
+ FnNot(FnEquals(Ref('Two'), 'Test')),
34
+ Condition('OneIsTest')
27
35
  ]
28
36
  ))
29
37
 
@@ -68,8 +76,8 @@ CloudFormation do
68
76
  AutoScalingGroup('ASG') do
69
77
  UpdatePolicy('AutoScalingRollingUpdate',
70
78
  'MinInstancesInService' => '1',
71
- 'MaxBatchSize' => '1',
72
- 'PauseTime' => 'PT15M')
79
+ 'MaxBatchSize' => '1',
80
+ 'PauseTime' => 'PT15M')
73
81
  AvailabilityZones FnGetAZs('')
74
82
  LaunchConfigurationName Ref('LaunchConfig')
75
83
  MinSize 1
@@ -1,4 +1,7 @@
1
+ # frozen_string_literal: false
2
+
1
3
  require 'spec_helper'
4
+
2
5
  describe Cfnlego do
3
6
  let(:template) { Cfnlego.run(resources: ['AWS::EC2::EIP,EIP']) }
4
7
 
@@ -8,6 +11,7 @@ describe Cfnlego do
8
11
  output << " EC2_EIP('EIP') do\n Domain String "
9
12
  output << '# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip.html#cfn-ec2-eip-domain'
10
13
  output << "\n InstanceId String # http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip.html#cfn-ec2-eip-instanceid"
14
+ output << "\n PublicIpv4Pool String # http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip.html#cfn-ec2-eip-publicipv4pool"
11
15
  output << "\n end\nend\n"
12
16
  expect(template).to eq output
13
17
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe CfnDsl::JSONable do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe 'Metadata' do
data/spec/names_spec.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe CfnDsl do
data/spec/output_spec.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe CfnDsl::OutputDefinition do
data/spec/plurals_spec.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe CfnDsl::Plurals do
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe 'cfndsl', type: :aruba do
6
+ let(:template_content) do
7
+ <<-TEMPLATE.gsub(/^ {6}/, '')
8
+ CloudFormation do
9
+ EC2_Instance(:my_instance) do
10
+ end
11
+ end
12
+ TEMPLATE
13
+ end
14
+ before(:each) { write_file('template.rb', template_content) }
15
+ context 'cfndsl FILE' do
16
+ it 'errors because the name is invalid' do
17
+ run_command 'cfndsl template.rb'
18
+ expect(last_command_started).to have_output_on_stderr('Resource name: my_instance is invalid')
19
+ end
20
+ end
21
+ end
@@ -1,15 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe CfnDsl::ResourceDefinition do
4
6
  subject { CfnDsl::CloudFormationTemplate.new.AutoScalingGroup(:web_servers) }
5
7
 
6
- context '#addTag' do
7
- it 'is a pass-through method to add_tag' do
8
- expect(subject).to receive(:add_tag).with('role', 'web-server', true)
9
- subject.addTag('role', 'web-server', true)
10
- end
11
- end
12
-
13
8
  context '#add_tag' do
14
9
  it 'adds a Tag for the resource' do
15
10
  subject.add_tag('role', 'web-server', true)
data/spec/rule_spec.rb ADDED
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe CfnDsl::OutputDefinition do
6
+ let(:template) { CfnDsl::OrchestrationTemplate.new }
7
+ let(:target) { File.read("#{File.dirname(__FILE__)}/fixtures/rule-assertion.json") }
8
+ context '#Assert' do
9
+ it 'formats correctly' do
10
+ output = template.Rule(:testRule) do
11
+ Assert('x', FnEachMemberIn(FnValueOfAll('a', 'b'), FnRefAll('c')))
12
+ RuleCondition FnEquals(Ref('y'), 'z')
13
+ end
14
+ expect(output.to_json).to eq(target)
15
+ end
16
+ end
17
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'aruba/rspec'
2
4
 
3
5
  if ENV['CFNDSL_COV']
@@ -10,12 +12,7 @@ if ENV['CFNDSL_COV']
10
12
  end
11
13
 
12
14
  require 'cfndsl/globals'
13
- CfnDsl.specification_file File.expand_path('../../lib/cfndsl/aws/resource_specification.json', __FILE__)
14
15
  # use local fixture for tests
16
+ CfnDsl.specification_file CfnDsl::LOCAL_SPEC_FILE
15
17
  require 'cfndsl'
16
- require 'cfnlego'
17
-
18
- bindir = File.expand_path('../../bin', __FILE__)
19
- ENV['PATH'] = [ENV['PATH'], bindir].join(':')
20
-
21
- Dir[File.expand_path('../support/**/*.rb', __FILE__)].each { |f| require f }
18
+ Dir[File.expand_path('support/**/*.rb', __dir__)].sort.each { |f| require f }
@@ -1,4 +1,19 @@
1
+ # frozen_string_literal: true
2
+
1
3
  shared_examples 'an orchestration template' do
4
+ context '#initialize with block' do
5
+ subject do
6
+ described_class.new { Resource(:foo) { Type :bar } }
7
+ end
8
+
9
+ it 'evaluates the block' do
10
+ resources = subject.instance_variable_get('@Resources')
11
+ expect(resources).to_not be_empty
12
+ foo = resources.first[1]
13
+ expect(foo.instance_variable_get('@Type')).to eql(:bar)
14
+ end
15
+ end
16
+
2
17
  context '#valid_ref?' do
3
18
  it 'returns true if ref is global' do
4
19
  expect(subject.valid_ref?('AWS::Region')).to eq(true)
@@ -25,7 +40,7 @@ shared_examples 'an orchestration template' do
25
40
  context '#check_resource_refs' do
26
41
  it 'returns an array with an error message if invalid refs are present' do
27
42
  subject.EC2_Instance(:foo) { UserData Ref(:bar) }
28
- expect(subject.check_resource_refs).to eq(['Invalid Reference: Resource foo refers to bar'])
43
+ expect(subject.check_resource_refs.first).to match(/^Invalid Reference:.*foo.*bar/)
29
44
  end
30
45
 
31
46
  it 'returns an empty array ' do
@@ -38,7 +53,7 @@ shared_examples 'an orchestration template' do
38
53
  it 'returns an array with an error message if invalid refs are present' do
39
54
  subject.EC2_Instance(:foo)
40
55
  subject.Output(:baz) { Value Ref(:bar) }
41
- expect(subject.check_output_refs).to eq(['Invalid Reference: Output baz refers to bar'])
56
+ expect(subject.check_output_refs.first).to match(/Invalid Reference:.*baz.*bar/)
42
57
  end
43
58
 
44
59
  it 'returns an empty array' do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe 'Transform' do
@@ -1,13 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
- # This is a somewhat temporary test class to compare functionality
4
- # between the AWS, OS and new ways of defining types
5
5
  RSpec.describe 'Type Definitions' do
6
- aws_spec = YAML.load_file File.expand_path('../../lib/cfndsl/aws/types.yaml', __FILE__)
7
- os_spec = YAML.load_file File.expand_path('../../lib/cfndsl/os/types.yaml', __FILE__)
8
- new_spec = CfnDsl::Specification.extract_from_resource_spec!
6
+ new_spec = CfnDsl::Types.extract_from_resource_spec(fail_patches: true)
9
7
 
10
- { 'AWS' => aws_spec, 'OS' => os_spec, 'New' => new_spec }.each_pair do |cloud, specdef|
8
+ { 'New' => new_spec }.each_pair do |cloud, specdef|
11
9
  context cloud do
12
10
  resources = specdef['Resources']
13
11
  types = specdef['Types']
@@ -16,7 +14,7 @@ RSpec.describe 'Type Definitions' do
16
14
  resources.each do |name, info|
17
15
  it "#{name} has all property types defined" do
18
16
  properties = info['Properties']
19
- properties.each do |_, type|
17
+ properties.each_value do |type|
20
18
  type = type.first if type.is_a?(Array)
21
19
  expect(types).to have_key(type)
22
20
  end
@@ -27,6 +25,7 @@ RSpec.describe 'Type Definitions' do
27
25
  context 'Types' do
28
26
  types.each do |name, type|
29
27
  it "#{name} has all property types defined" do
28
+ type = type['Properties'] if type.is_a?(Hash) && type.key?('Properties')
30
29
  type = type.first if type.is_a?(Array)
31
30
  if type.is_a?(String)
32
31
  expect(types).to have_key(type)
metadata CHANGED
@@ -1,15 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cfndsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Jack
8
8
  - Chris Howe
9
+ - Travis Dempsey
10
+ - Greg Cockburn
9
11
  autorequire:
10
- bindir: bin
12
+ bindir: exe
11
13
  cert_chain: []
12
- date: 2017-06-18 00:00:00.000000000 Z
14
+ date: 2020-01-16 00:00:00.000000000 Z
13
15
  dependencies:
14
16
  - !ruby/object:Gem::Dependency
15
17
  name: bundler
@@ -17,18 +19,34 @@ dependencies:
17
19
  requirements:
18
20
  - - "~>"
19
21
  - !ruby/object:Gem::Version
20
- version: '1.13'
22
+ version: '2.1'
21
23
  type: :development
22
24
  prerelease: false
23
25
  version_requirements: !ruby/object:Gem::Requirement
24
26
  requirements:
25
27
  - - "~>"
26
28
  - !ruby/object:Gem::Version
27
- version: '1.13'
29
+ version: '2.1'
30
+ - !ruby/object:Gem::Dependency
31
+ name: hana
32
+ requirement: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - "~>"
35
+ - !ruby/object:Gem::Version
36
+ version: '1.3'
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - "~>"
42
+ - !ruby/object:Gem::Version
43
+ version: '1.3'
28
44
  description: DSL for creating AWS Cloudformation templates
29
45
  email:
30
46
  - stevenmajack@gmail.com
31
47
  - chris@howeville.com
48
+ - dempsey.travis@gmail.com
49
+ - gergnz@gmail.com
32
50
  executables:
33
51
  - cfndsl
34
52
  extensions: []
@@ -42,16 +60,39 @@ files:
42
60
  - LICENSE
43
61
  - README.md
44
62
  - Rakefile
45
- - bin/cfndsl
63
+ - TODO.md
64
+ - UPGRADING.md
46
65
  - cfndsl.gemspec
66
+ - exe/cfndsl
47
67
  - lib/cfndsl.rb
48
68
  - lib/cfndsl/aws/cloud_formation_template.rb
69
+ - lib/cfndsl/aws/patches/000_CloudFormationResourceSpecification.json
70
+ - lib/cfndsl/aws/patches/000_sam.spec.json
71
+ - lib/cfndsl/aws/patches/100_sam.spec_DeploymentPreference_patch.json
72
+ - lib/cfndsl/aws/patches/200_Scrutinies_patch.json
73
+ - lib/cfndsl/aws/patches/500_Cognito_IdentityPoolRoleAttachment_patches.json
74
+ - lib/cfndsl/aws/patches/500_IoT1Click_patch_PlacementTemplate_DeviceTemplates.json
75
+ - lib/cfndsl/aws/patches/500_NetworkAclEntry_patch.json
76
+ - lib/cfndsl/aws/patches/500_SAM_Serverless_Function_S3Event_Events_patch.json
77
+ - lib/cfndsl/aws/patches/500_SAM_Serverless_Function_S3Location_Version_patch.json
78
+ - lib/cfndsl/aws/patches/500_SSM_AssociationName_patch.json
79
+ - lib/cfndsl/aws/patches/500_VPCEndpoint_patch.json
80
+ - lib/cfndsl/aws/patches/510_ElasticSearch_Domain_patches.json
81
+ - lib/cfndsl/aws/patches/520_ServiceDiscovery_InstanceAttributes_patch.json
82
+ - lib/cfndsl/aws/patches/600_RefKinds_patch.json
83
+ - lib/cfndsl/aws/patches/700_SAM_Serverless_Function_InlineCode_patch.json
84
+ - lib/cfndsl/aws/patches/800_List_types_patch.json
49
85
  - lib/cfndsl/aws/resource_specification.json
50
86
  - lib/cfndsl/aws/types.rb
51
87
  - lib/cfndsl/aws/types.yaml
88
+ - lib/cfndsl/cfnlego.rb
89
+ - lib/cfndsl/cfnlego/cloudformation.erb
90
+ - lib/cfndsl/cfnlego/cloudformation.rb
91
+ - lib/cfndsl/cfnlego/resource.rb
92
+ - lib/cfndsl/cloudformation.rb
52
93
  - lib/cfndsl/conditions.rb
53
94
  - lib/cfndsl/creation_policy.rb
54
- - lib/cfndsl/errors.rb
95
+ - lib/cfndsl/deep_merge.rb
55
96
  - lib/cfndsl/external_parameters.rb
56
97
  - lib/cfndsl/globals.rb
57
98
  - lib/cfndsl/json_serialisable_object.rb
@@ -60,25 +101,19 @@ files:
60
101
  - lib/cfndsl/module.rb
61
102
  - lib/cfndsl/names.rb
62
103
  - lib/cfndsl/orchestration_template.rb
63
- - lib/cfndsl/os/heat_template.rb
64
- - lib/cfndsl/os/types.rb
65
- - lib/cfndsl/os/types.yaml
66
104
  - lib/cfndsl/outputs.rb
67
105
  - lib/cfndsl/parameters.rb
68
- - lib/cfndsl/patches.rb
69
106
  - lib/cfndsl/plurals.rb
70
107
  - lib/cfndsl/properties.rb
71
108
  - lib/cfndsl/rake_task.rb
72
109
  - lib/cfndsl/ref_check.rb
73
110
  - lib/cfndsl/resources.rb
111
+ - lib/cfndsl/rules.rb
112
+ - lib/cfndsl/runner.rb
74
113
  - lib/cfndsl/specification.rb
75
114
  - lib/cfndsl/types.rb
76
115
  - lib/cfndsl/update_policy.rb
77
116
  - lib/cfndsl/version.rb
78
- - lib/cfnlego.rb
79
- - lib/cfnlego/cloudformation.erb
80
- - lib/cfnlego/cloudformation.rb
81
- - lib/cfnlego/resource.rb
82
117
  - lib/deep_merge/core.rb
83
118
  - lib/deep_merge/deep_merge.rb
84
119
  - sample/autoscale.rb
@@ -101,44 +136,53 @@ files:
101
136
  - spec/aws/ecs_task_definition_spec.rb
102
137
  - spec/aws/iam_managed_policy_spec.rb
103
138
  - spec/aws/kms_alias_spec.rb
139
+ - spec/aws/list_type_patches_spec.rb
104
140
  - spec/aws/logs_log_group_spec.rb
141
+ - spec/aws/nested_arrays_spec.rb
105
142
  - spec/aws/rds_db_instance_spec.rb
106
143
  - spec/aws/serverless_spec.rb
107
144
  - spec/cfndsl_spec.rb
108
145
  - spec/cli_spec.rb
109
146
  - spec/cloud_formation_template_spec.rb
147
+ - spec/condition_spec.rb
110
148
  - spec/deep_merge_spec.rb
149
+ - spec/direct_ruby_spec.rb
111
150
  - spec/external_parameters_spec.rb
112
- - spec/fixtures/heattest.rb
151
+ - spec/fixtures/condition-assertion.json
152
+ - spec/fixtures/params.json
153
+ - spec/fixtures/params.yaml
154
+ - spec/fixtures/params_struct1.yaml
155
+ - spec/fixtures/params_struct2.yaml
156
+ - spec/fixtures/rule-assertion.json
113
157
  - spec/fixtures/serverless-api.json
114
158
  - spec/fixtures/serverless-function.json
115
159
  - spec/fixtures/test.rb
116
160
  - spec/generate_spec.rb
117
- - spec/heat_template_spec.rb
118
161
  - spec/jsonable_spec.rb
119
162
  - spec/metadata_spec.rb
120
163
  - spec/names_spec.rb
121
164
  - spec/output_spec.rb
122
165
  - spec/plurals_spec.rb
166
+ - spec/resource_name_spec.rb
123
167
  - spec/resources_spec.rb
168
+ - spec/rule_spec.rb
124
169
  - spec/spec_helper.rb
125
170
  - spec/support/shared_examples/orchestration_template.rb
126
171
  - spec/transform_spec.rb
127
172
  - spec/types_definition_spec.rb
128
- homepage: https://github.com/stevenjack/cfndsl
173
+ homepage: https://github.com/cfndsl/cfndsl
129
174
  licenses:
130
175
  - MIT
131
176
  metadata: {}
132
- post_install_message: "'addTag' is now deprecated in favour of 'add_tag'. 'addTag'
133
- will be removed in the next major version."
177
+ post_install_message:
134
178
  rdoc_options: []
135
179
  require_paths:
136
180
  - lib
137
181
  required_ruby_version: !ruby/object:Gem::Requirement
138
182
  requirements:
139
- - - ">="
183
+ - - "~>"
140
184
  - !ruby/object:Gem::Version
141
- version: '0'
185
+ version: '2.3'
142
186
  required_rubygems_version: !ruby/object:Gem::Requirement
143
187
  requirements:
144
188
  - - ">="
@@ -146,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
190
  version: '0'
147
191
  requirements: []
148
192
  rubyforge_project:
149
- rubygems_version: 2.4.5
193
+ rubygems_version: 2.7.7
150
194
  signing_key:
151
195
  specification_version: 4
152
196
  summary: AWS Cloudformation DSL
@@ -155,26 +199,36 @@ test_files:
155
199
  - spec/aws/ecs_task_definition_spec.rb
156
200
  - spec/aws/iam_managed_policy_spec.rb
157
201
  - spec/aws/kms_alias_spec.rb
202
+ - spec/aws/list_type_patches_spec.rb
158
203
  - spec/aws/logs_log_group_spec.rb
204
+ - spec/aws/nested_arrays_spec.rb
159
205
  - spec/aws/rds_db_instance_spec.rb
160
206
  - spec/aws/serverless_spec.rb
161
207
  - spec/cfndsl_spec.rb
162
208
  - spec/cli_spec.rb
163
209
  - spec/cloud_formation_template_spec.rb
210
+ - spec/condition_spec.rb
164
211
  - spec/deep_merge_spec.rb
212
+ - spec/direct_ruby_spec.rb
165
213
  - spec/external_parameters_spec.rb
166
- - spec/fixtures/heattest.rb
214
+ - spec/fixtures/condition-assertion.json
215
+ - spec/fixtures/params.json
216
+ - spec/fixtures/params.yaml
217
+ - spec/fixtures/params_struct1.yaml
218
+ - spec/fixtures/params_struct2.yaml
219
+ - spec/fixtures/rule-assertion.json
167
220
  - spec/fixtures/serverless-api.json
168
221
  - spec/fixtures/serverless-function.json
169
222
  - spec/fixtures/test.rb
170
223
  - spec/generate_spec.rb
171
- - spec/heat_template_spec.rb
172
224
  - spec/jsonable_spec.rb
173
225
  - spec/metadata_spec.rb
174
226
  - spec/names_spec.rb
175
227
  - spec/output_spec.rb
176
228
  - spec/plurals_spec.rb
229
+ - spec/resource_name_spec.rb
177
230
  - spec/resources_spec.rb
231
+ - spec/rule_spec.rb
178
232
  - spec/spec_helper.rb
179
233
  - spec/support/shared_examples/orchestration_template.rb
180
234
  - spec/transform_spec.rb