convection 0.0.1 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +26 -8
  4. data/.rubocop_todo.yml +77 -0
  5. data/.ruby-version +1 -0
  6. data/.travis.yml +10 -0
  7. data/Gemfile +9 -0
  8. data/README.md +27 -2
  9. data/Rakefile +11 -1
  10. data/bin/convection +49 -0
  11. data/convection.gemspec +5 -7
  12. data/example/.ruby-version +1 -0
  13. data/example/Cloudfile +13 -0
  14. data/example/deprecated/elb.rb +27 -0
  15. data/example/deprecated/iam_access_key.rb +18 -0
  16. data/example/deprecated/iam_group.rb +31 -0
  17. data/example/{iam_role.rb → deprecated/iam_role.rb} +21 -32
  18. data/example/deprecated/iam_user.rb +31 -0
  19. data/example/deprecated/rds.rb +70 -0
  20. data/example/{s3.rb → deprecated/s3.rb} +0 -0
  21. data/example/deprecated/sqs.rb +32 -0
  22. data/example/deprecated/vpc.rb +85 -0
  23. data/example/foobar.rb +22 -0
  24. data/example/output/vpc.json +335 -0
  25. data/example/security-groups.rb +40 -0
  26. data/example/trust_cloudtrail.rb +24 -0
  27. data/example/vpc.rb +63 -81
  28. data/ext/resource_generator.sh +21 -0
  29. data/lib/convection.rb +5 -4
  30. data/lib/convection/control/cloud.rb +59 -0
  31. data/lib/convection/control/stack.rb +261 -60
  32. data/lib/convection/dsl/helpers.rb +63 -5
  33. data/lib/convection/model/attributes.rb +60 -0
  34. data/lib/convection/model/cloudfile.rb +58 -0
  35. data/lib/convection/model/diff.rb +39 -0
  36. data/lib/convection/model/event.rb +62 -0
  37. data/lib/convection/model/exceptions.rb +18 -0
  38. data/lib/convection/model/mixin/cidr_block.rb +4 -4
  39. data/lib/convection/model/mixin/colorize.rb +20 -0
  40. data/lib/convection/model/mixin/conditional.rb +1 -3
  41. data/lib/convection/model/mixin/policy.rb +89 -0
  42. data/lib/convection/model/mixin/protocol.rb +29 -0
  43. data/lib/convection/model/mixin/taggable.rb +2 -2
  44. data/lib/convection/model/template.rb +248 -21
  45. data/lib/convection/model/template/condition.rb +56 -0
  46. data/lib/convection/model/template/mapping.rb +4 -3
  47. data/lib/convection/model/template/output.rb +9 -7
  48. data/lib/convection/model/template/parameter.rb +19 -4
  49. data/lib/convection/model/template/resource.rb +317 -23
  50. data/lib/convection/model/template/resource/aws_auto_scaling_auto_scaling_group.rb +39 -0
  51. data/lib/convection/model/template/resource/aws_auto_scaling_launch_configuration.rb +30 -0
  52. data/lib/convection/model/template/resource/aws_auto_scaling_scaling_policy.rb +20 -0
  53. data/lib/convection/model/template/resource/aws_cloud_watch_alarm.rb +31 -0
  54. data/lib/convection/model/template/resource/aws_ec2_instance.rb +10 -46
  55. data/lib/convection/model/template/resource/aws_ec2_internet_gateway.rb +3 -14
  56. data/lib/convection/model/template/resource/aws_ec2_network_acl.rb +45 -0
  57. data/lib/convection/model/template/resource/aws_ec2_network_acl_entry.rb +27 -0
  58. data/lib/convection/model/template/resource/aws_ec2_route.rb +7 -40
  59. data/lib/convection/model/template/resource/aws_ec2_route_table.rb +2 -17
  60. data/lib/convection/model/template/resource/aws_ec2_security_group.rb +24 -30
  61. data/lib/convection/model/template/resource/aws_ec2_security_group_ingres.rb +25 -0
  62. data/lib/convection/model/template/resource/aws_ec2_subnet.rb +21 -28
  63. data/lib/convection/model/template/resource/aws_ec2_subnet_network_acl_association.rb +18 -0
  64. data/lib/convection/model/template/resource/aws_ec2_subnet_route_table_association.rb +3 -24
  65. data/lib/convection/model/template/resource/aws_ec2_vpc.rb +20 -22
  66. data/lib/convection/model/template/resource/aws_ec2_vpc_gateway_attachment.rb +4 -28
  67. data/lib/convection/model/template/resource/aws_elasticache_cluster.rb +24 -0
  68. data/lib/convection/model/template/resource/aws_elasticache_parameter_group.rb +19 -0
  69. data/lib/convection/model/template/resource/aws_elasticache_security_group.rb +17 -0
  70. data/lib/convection/model/template/resource/aws_elasticache_security_group_ingress.rb +19 -0
  71. data/lib/convection/model/template/resource/aws_elb.rb +39 -0
  72. data/lib/convection/model/template/resource/aws_iam_access_key.rb +19 -0
  73. data/lib/convection/model/template/resource/aws_iam_group.rb +18 -0
  74. data/lib/convection/model/template/resource/aws_iam_instance_profile.rb +21 -0
  75. data/lib/convection/model/template/resource/aws_iam_policy.rb +28 -24
  76. data/lib/convection/model/template/resource/aws_iam_role.rb +88 -19
  77. data/lib/convection/model/template/resource/aws_iam_user.rb +53 -0
  78. data/lib/convection/model/template/resource/aws_logs_loggroup.rb +33 -0
  79. data/lib/convection/model/template/resource/aws_rds_db_instance.rb +59 -0
  80. data/lib/convection/model/template/resource/aws_rds_db_parameter_group.rb +27 -0
  81. data/lib/convection/model/template/resource/aws_rds_db_security_group.rb +40 -0
  82. data/lib/convection/model/template/resource/aws_rds_db_subnet_group.rb +26 -0
  83. data/lib/convection/model/template/resource/aws_route53_health_check.rb +17 -0
  84. data/lib/convection/model/template/resource/aws_route53_recordset.rb +30 -0
  85. data/lib/convection/model/template/resource/aws_s3_bucket.rb +8 -44
  86. data/lib/convection/model/template/resource/aws_s3_bucket_policy.rb +14 -19
  87. data/lib/convection/model/template/resource/aws_sns_topic.rb +19 -0
  88. data/lib/convection/model/template/resource/aws_sqs_queue.rb +31 -0
  89. data/lib/convection/model/template/resource/aws_sqs_queue_policy.rb +18 -0
  90. data/test/convection/model/test_conditions.rb +121 -0
  91. data/test/convection/model/test_elasticache.rb +97 -0
  92. data/test/convection/model/test_loggroups.rb +25 -0
  93. data/test/convection/model/test_rds.rb +76 -0
  94. data/test/convection/model/test_template.rb +64 -0
  95. data/test/convection/model/test_validation.rb +216 -0
  96. data/test/test_helper.rb +17 -0
  97. metadata +131 -50
@@ -0,0 +1,25 @@
1
+ require 'test_helper'
2
+ require 'json'
3
+ require 'pp'
4
+
5
+ class TestLogGroups < Minitest::Test
6
+ def setup
7
+ @template = ::Convection.template do
8
+ description 'Logroups Test Template'
9
+
10
+ resource 'testgroup' do
11
+ type 'AWS::Logs::LogGroup'
12
+ property 'RetentionInDays', 365
13
+ end
14
+ end
15
+ end
16
+
17
+ def from_json
18
+ JSON.parse(@template.to_json)
19
+ end
20
+
21
+ def test_log_groups
22
+ refute_empty(from_json['Resources'])
23
+ assert_includes(from_json['Resources'], 'testgroup')
24
+ end
25
+ end
@@ -0,0 +1,76 @@
1
+ require 'test_helper'
2
+ require 'json'
3
+ require 'pp'
4
+
5
+ class TestRDS < Minitest::Test
6
+ def setup
7
+ # Inspired by http://www.unixdaemon.net/cloud/intro-to-cloudformations-conditionals.html
8
+ @template = ::Convection.template do
9
+ description 'RDS Test Template'
10
+
11
+ rds_security_group 'MyRDSSecGroup' do
12
+ description 'Pulls in EC2 SGs'
13
+ ec2_security_group 'MyEC2SecGroup', '123456789012'
14
+ cidr_ip 'my_cidr_value'
15
+ end
16
+
17
+ rds_instance 'MyRDSInstance' do
18
+ engine 'MySQL'
19
+ instance_class 'db.m1.medium'
20
+ allocated_storage 5
21
+ backup_retention_period 7
22
+ multi_az false
23
+
24
+ master_username 'root'
25
+ master_password 'secret'
26
+
27
+ security_group [fn_ref('MyRDSSecGroup')]
28
+ end
29
+ end
30
+ end
31
+
32
+ def from_json
33
+ JSON.parse(@template.to_json)
34
+ end
35
+
36
+ def test_rds_instance
37
+ # Expected JSON:
38
+ json = from_json['Resources']['MyRDSInstance']
39
+ db_secgroups = json['Properties']['DBSecurityGroups']
40
+
41
+ assert db_secgroups.is_a? Array
42
+ assert_equal 1, db_secgroups.size
43
+
44
+ perform_parameter_ref_comparison db_secgroups, 'MyRDSSecGroup', nil
45
+ end
46
+
47
+ def test_rds_secgroup
48
+ # Expected JSON:
49
+ json = from_json['Resources']['MyRDSSecGroup']
50
+ ingress_rules = json['Properties']['DBSecurityGroupIngress']
51
+
52
+ assert ingress_rules.is_a? Array
53
+ assert_equal 2, ingress_rules.size
54
+
55
+ ingress_rules.each do |rule|
56
+ if rule.key? 'CIDRIP'
57
+ assert rule.value? 'my_cidr_value'
58
+ else
59
+ assert rule['EC2SecurityGroupName'] == 'MyEC2SecGroup'
60
+ assert rule['EC2SecurityGroupOwnerId'] == '123456789012'
61
+ end
62
+ end
63
+ end
64
+
65
+ private
66
+
67
+ def perform_parameter_ref_comparison(comparison_array, parameter_name, expected_value)
68
+ parameter_ref = comparison_array[0]
69
+ assert parameter_ref.is_a? Hash
70
+ assert_equal 1, parameter_ref.size
71
+ assert parameter_ref.key? 'Ref'
72
+ assert parameter_ref.value? parameter_name
73
+
74
+ assert_equal expected_value, comparison_array[1]
75
+ end
76
+ end
@@ -0,0 +1,64 @@
1
+ require 'test_helper'
2
+ require 'json'
3
+ require 'pp'
4
+
5
+ class TestTemplate < Minitest::Test
6
+ def setup
7
+ @template = Convection.template do
8
+ description 'Test Template'
9
+
10
+ ec2_instance 'TestInstance1' do
11
+ availability_zone 'us-east-1'
12
+ image_id 'ami-asdf83'
13
+ end
14
+
15
+ ec2_instance 'TestInstance2' do
16
+ availability_zone 'us-west-1'
17
+ image_id 'ami-lda34f'
18
+ depends_on 'TestInstance1'
19
+ end
20
+ end
21
+ end
22
+
23
+ def from_json
24
+ JSON.parse(@template.to_json)
25
+ end
26
+
27
+ def test_template_class
28
+ assert_kind_of Convection::Model::Template, @template
29
+ end
30
+
31
+ def test_template_format_version
32
+ assert_equal '2010-09-09', from_json['AWSTemplateFormatVersion']
33
+ end
34
+
35
+ def test_template_description
36
+ assert_equal 'Test Template', from_json['Description']
37
+ end
38
+
39
+ %w(Parameters Mappings Conditions Resources).each do |section|
40
+ define_method("test_template_#{section.downcase}") do
41
+ assert_respond_to from_json[section], :key?, "#{section} expected to respond to :key? method"
42
+ end
43
+ end
44
+
45
+ def test_template_resources
46
+ assert_includes from_json['Resources'], 'TestInstance1'
47
+ end
48
+
49
+ def instance1
50
+ from_json['Resources']['TestInstance1']
51
+ end
52
+
53
+ def test_template_instance_has_properties
54
+ assert_includes instance1, 'Properties'
55
+ end
56
+
57
+ def test_template_instance_type
58
+ assert_equal 'AWS::EC2::Instance', instance1['Type']
59
+ end
60
+
61
+ def test_template_depends_on
62
+ assert_includes from_json['Resources']['TestInstance2']['DependsOn'], 'TestInstance1'
63
+ end
64
+ end
@@ -0,0 +1,216 @@
1
+ require 'test_helper'
2
+ require 'json'
3
+ require 'pp'
4
+
5
+ class TestValidations < Minitest::Test
6
+ def test_within_limits
7
+ @within_limits = ::Convection.template do
8
+ description 'Validations Test Template - Within Limits'
9
+ 10.times do |count|
10
+ resource "EC2_INSTANCE_#{count}" do
11
+ type 'AWS::EC2::Instance'
12
+ property 'AvailabilityZone', 'us-east-1a'
13
+ property 'ImageId', 'ami-76e27e1e'
14
+ property 'KeyName', 'test'
15
+ property 'SecurityGroupIds', ['sg-dd733c41', 'sg-dd738df3']
16
+ end
17
+ mapping "Mapping_#{count}" do
18
+ item 'one', 'two', 'three'
19
+ item '1', '2', '3'
20
+ end
21
+ output "Output_#{count}" do
22
+ description 'An Important Attribute'
23
+ value get_att('Resource', 'Attribute')
24
+ end
25
+ parameter "Parameter_#{count}" do
26
+ type 'String'
27
+ description 'Example Parameter'
28
+ default 'm3.medium'
29
+ end
30
+ end
31
+ end
32
+
33
+ assert_nothing_raised(StandardError) do
34
+ @within_limits.to_json
35
+ end
36
+ end
37
+
38
+ def test_bytesize
39
+ @excessive_bytesize = ::Convection.template do
40
+ description 'Validations Test Template - Excessive Bytesize'
41
+ 200.times do |count|
42
+ resource "EC2_INSTANCE_#{count}" do
43
+ type 'AWS::EC2::Instance'
44
+ property 'AvailabilityZone', 'us-east-1a'
45
+ property 'ImageId', 'ami-76e27e1e'
46
+ property 'KeyName', 'test'
47
+ property 'SecurityGroupIds', ['sg-dd733c41', 'sg-dd738df3']
48
+ property 'Tags', [{
49
+ 'Key' => 'Name',
50
+ 'Value' => 'test-1'
51
+ }]
52
+ end
53
+ end
54
+ 80.times do |count|
55
+ mapping "Mapping_#{count}" do
56
+ item 'us-east-1', 'test', 'cf-test-keys'
57
+ item 'us-west-1', 'test', 'cf-test-keys'
58
+ end
59
+ end
60
+ end
61
+ assert_raises(ExcessiveTemplateSizeError) do
62
+ JSON.generate(@excessive_bytesize.to_json).bytesize
63
+ end
64
+ end
65
+
66
+ def test_resources
67
+ @excessive_resources = ::Convection.template do
68
+ description 'Validations Test Template - Too Many Resources'
69
+ 201.times do |count|
70
+ logs_log_group "Log_Group_#{count}" do
71
+ retention_in_days 365
72
+ end
73
+ end
74
+ end
75
+ @excessive_resource_name = ::Convection.template do
76
+ description 'Validations Test Template - Excessive Resource Name'
77
+ logs_log_group '0' * 256 do
78
+ retention_in_days 365
79
+ end
80
+ end
81
+
82
+ assert_raises(ExcessiveResourcesError) do
83
+ @excessive_resources.to_json
84
+ end
85
+ assert_raises(ExcessiveResourceNameError) do
86
+ @excessive_resource_name.to_json
87
+ end
88
+ end
89
+
90
+ def test_mappings
91
+ @excessive_mappings = ::Convection.template do
92
+ description 'Validations Test Template - Too Many Mappings'
93
+ 101.times do |count|
94
+ mapping "Mapping_#{count}" do
95
+ item 'us-east-1', 'test', 'cf-test-keys'
96
+ item 'us-west-1', 'test', 'cf-test-keys'
97
+ end
98
+ end
99
+ end
100
+ @excessive_mapping_name = ::Convection.template do
101
+ description 'Validations Test Template - Excessive Mapping Name'
102
+ mapping '0' * 256 do
103
+ item '1', '2', '3'
104
+ end
105
+ end
106
+
107
+ assert_raises(ExcessiveMappingsError) do
108
+ @excessive_mappings.to_json
109
+ end
110
+ assert_raises(ExcessiveMappingNameError) do
111
+ @excessive_mapping_name.to_json
112
+ end
113
+ end
114
+
115
+ def test_mapping_attributes
116
+ @excessive_mapping_attributes = ::Convection.template do
117
+ description 'Validations Test Template - Too Many Mapping Attributes'
118
+ mapping 'Mapping_Example' do
119
+ 31.times do |count|
120
+ item "#{count}_1", "#{count}_2", "#{count}_3"
121
+ end
122
+ end
123
+ end
124
+ @excessive_mapping_attribute_names = ::Convection.template do
125
+ description 'Validations Test Template - Excessive Mapping Attribute Name'
126
+ mapping 'Mapping_1' do
127
+ item '0' * 256, 'value', 'value'
128
+ end
129
+ end
130
+
131
+ assert_raises(ExcessiveMappingAttributesError)do
132
+ @excessive_mapping_attributes.to_json
133
+ end
134
+ assert_raises(ExcessiveMappingAttributeNameError) do
135
+ @excessive_mapping_attribute_names.to_json
136
+ end
137
+ end
138
+
139
+ def test_outputs
140
+ @excessive_outputs = ::Convection.template do
141
+ description 'Validations Test Template - Too Many Outputs'
142
+ 61.times do |count|
143
+ output "Output_#{count}" do
144
+ description 'An Important Attribute'
145
+ value get_att('Resource', 'Attribute')
146
+ end
147
+ end
148
+ end
149
+ @excessive_output_name = ::Convection.template do
150
+ description 'Validations Test Template - Excessive Output Name'
151
+ output '0' * 256 do
152
+ description 'An Important Attribute'
153
+ value get_att('Resource', 'Attribute')
154
+ end
155
+ end
156
+
157
+ assert_raises(ExcessiveOutputsError) do
158
+ @excessive_outputs.to_json
159
+ end
160
+ assert_raises(ExcessiveOutputNameError) do
161
+ @excessive_output_name.to_json
162
+ end
163
+ end
164
+
165
+ def test_parameters
166
+ @excessive_parameters = ::Convection.template do
167
+ description 'Validations Test Template - Too Many Parameters'
168
+ 61.times do |count|
169
+ parameter "Parameter_#{count}" do
170
+ type 'String'
171
+ description 'Example Parameter'
172
+ default 'm3.medium'
173
+ end
174
+ end
175
+ end
176
+ @excessive_parameter_name = ::Convection.template do
177
+ description 'Validations Test Template - Excessive Parameter Name'
178
+ parameter '0' * 256 do
179
+ type 'String'
180
+ description 'Example Parameter'
181
+ default 'm3.medium'
182
+ end
183
+ end
184
+
185
+ assert_raises(ExcessiveParametersError) do
186
+ @excessive_parameters.to_json
187
+ end
188
+ assert_raises(ExcessiveParameterNameError) do
189
+ @excessive_parameter_name.to_json
190
+ end
191
+ end
192
+
193
+ def test_parameter_bytesize
194
+ @excessive_parameter_value_bytesize = ::Convection.template do
195
+ description 'Validations Test Template - Excessive Parameter Value Bytesize'
196
+ parameter 'Excessive_Parameter' do
197
+ type 'String' * 150
198
+ description 'Example Parameter' * 150
199
+ default 'm3.medium' * 150
200
+ end
201
+ end
202
+
203
+ assert_raises(ExcessiveParameterBytesizeError) do
204
+ @excessive_parameter_value_bytesize.to_json
205
+ end
206
+ end
207
+
208
+ def test_description
209
+ @excessive_description = ::Convection.template do
210
+ description '0' * 1_025
211
+ end
212
+ assert_raises(ExcessiveDescriptionError) do
213
+ @excessive_description.to_json
214
+ end
215
+ end
216
+ end
@@ -0,0 +1,17 @@
1
+ require 'simplecov'
2
+ SimpleCov.start do
3
+ add_group 'Control', 'lib/convection/control'
4
+ add_group 'Model', 'lib/convection/model'
5
+ add_group 'DSL', 'lib/convection/dsl'
6
+ end
7
+
8
+ gem 'minitest'
9
+ require 'minitest/autorun'
10
+ require 'minitest/spec'
11
+ require_relative '../lib/convection'
12
+
13
+ module Minitest::Assertions
14
+ def assert_nothing_raised(*)
15
+ yield
16
+ end
17
+ end
metadata CHANGED
@@ -1,87 +1,73 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: convection
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Manero
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-12 00:00:00.000000000 Z
11
+ date: 2015-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ~>
18
- - !ruby/object:Gem::Version
19
- version: '1.7'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ~>
25
- - !ruby/object:Gem::Version
26
- version: '1.7'
27
- - !ruby/object:Gem::Dependency
28
- name: rake
14
+ name: aws-sdk
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
- - - ~>
17
+ - - ">="
32
18
  - !ruby/object:Gem::Version
33
- version: '10.0'
34
- type: :development
19
+ version: '2'
20
+ type: :runtime
35
21
  prerelease: false
36
22
  version_requirements: !ruby/object:Gem::Requirement
37
23
  requirements:
38
- - - ~>
24
+ - - ">="
39
25
  - !ruby/object:Gem::Version
40
- version: '10.0'
26
+ version: '2'
41
27
  - !ruby/object:Gem::Dependency
42
- name: thor-scmversion
28
+ name: httparty
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
- - - '='
31
+ - - "~>"
46
32
  - !ruby/object:Gem::Version
47
- version: 1.7.0
48
- type: :development
33
+ version: '0.13'
34
+ type: :runtime
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
- - - '='
38
+ - - "~>"
53
39
  - !ruby/object:Gem::Version
54
- version: 1.7.0
40
+ version: '0.13'
55
41
  - !ruby/object:Gem::Dependency
56
- name: aws-sdk
42
+ name: netaddr
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
- - - <
45
+ - - "~>"
60
46
  - !ruby/object:Gem::Version
61
- version: '2'
47
+ version: '1.5'
62
48
  type: :runtime
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
- - - <
52
+ - - "~>"
67
53
  - !ruby/object:Gem::Version
68
- version: '2'
54
+ version: '1.5'
69
55
  - !ruby/object:Gem::Dependency
70
- name: netaddr
56
+ name: thor
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
- - - ~>
59
+ - - "~>"
74
60
  - !ruby/object:Gem::Version
75
- version: 1.5.0
61
+ version: '0.19'
76
62
  type: :runtime
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
- - - ~>
66
+ - - "~>"
81
67
  - !ruby/object:Gem::Version
82
- version: 1.5.0
68
+ version: '0.19'
83
69
  description: |
84
- # Convection
70
+ # Convection [![Build Status](https://travis-ci.org/rapid7/convection.svg)](https://travis-ci.org/rapid7/convection)
85
71
  _A fully generic, modular DSL for AWS CloudFormation_
86
72
 
87
73
  This gem aims to provide a reusable model for AWS CloudFormation in Ruby. It exposes a DSL for template definition, and a simple, decoupled abstraction of a CloudFormation Stack to compile and apply templates.
@@ -190,7 +176,18 @@ description: |
190
176
  ### Conditions
191
177
  http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/conditions-section-structure.html
192
178
 
193
- Not implemented yet.
179
+ ```ruby
180
+ condition 'ThisCondition' do
181
+ fn_equals( fn_ref('SomeParameter'), 'value_x' )
182
+ end
183
+
184
+ condition 'ThatCondition' do
185
+ fn_or(
186
+ fn_equals( fn_ref('SomeParameter'), 'value_y' ),
187
+ fn_equals( fn_ref('SomeParameter'), 'value_z' )
188
+ )
189
+ end
190
+ ```
194
191
 
195
192
  ### Resources
196
193
  http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resources-section-structure.html
@@ -210,6 +207,17 @@ description: |
210
207
  end
211
208
  ```
212
209
 
210
+ Using a condition to set a resource property:
211
+
212
+ ```ruby
213
+ resource 'MySQL' do
214
+ type 'AWS::RDS::DBInstance'
215
+ ...
216
+ property 'Iops', fn_if('ThisCondition', '1000', fn_ref('AWS::NoValue'))
217
+ ...
218
+ end
219
+ ```
220
+
213
221
  ### Outputs
214
222
  http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/outputs-section-structure.html
215
223
 
@@ -278,6 +286,9 @@ description: |
278
286
  * `#delete` - Delete CloudFormation Stack
279
287
  * `#availability_zones(&block)` - Return an array of strings representing the region's availability zones. Provided codeblock will be called for each AZ.
280
288
 
289
+ ## Futures
290
+ *
291
+
281
292
  ## License
282
293
  _Copyright (c) 2015 John Manero, Rapid7 LLC._
283
294
 
@@ -307,48 +318,111 @@ description: |
307
318
  ```
308
319
  email:
309
320
  - jmanero@rapid7.com
310
- executables: []
321
+ executables:
322
+ - convection
311
323
  extensions: []
312
324
  extra_rdoc_files: []
313
325
  files:
314
- - .gitignore
315
- - .rubocop.yml
326
+ - ".gitignore"
327
+ - ".rubocop.yml"
328
+ - ".rubocop_todo.yml"
329
+ - ".ruby-version"
330
+ - ".travis.yml"
316
331
  - Gemfile
317
332
  - LICENSE
318
333
  - README.md
319
334
  - Rakefile
320
335
  - Thorfile
336
+ - bin/convection
321
337
  - convection.gemspec
322
- - example/iam_role.rb
323
- - example/s3.rb
338
+ - example/.ruby-version
339
+ - example/Cloudfile
340
+ - example/deprecated/elb.rb
341
+ - example/deprecated/iam_access_key.rb
342
+ - example/deprecated/iam_group.rb
343
+ - example/deprecated/iam_role.rb
344
+ - example/deprecated/iam_user.rb
345
+ - example/deprecated/rds.rb
346
+ - example/deprecated/s3.rb
347
+ - example/deprecated/sqs.rb
348
+ - example/deprecated/vpc.rb
349
+ - example/foobar.rb
350
+ - example/output/vpc.json
351
+ - example/security-groups.rb
352
+ - example/trust_cloudtrail.rb
324
353
  - example/vpc.rb
354
+ - ext/resource_generator.sh
325
355
  - lib/convection.rb
356
+ - lib/convection/control/cloud.rb
326
357
  - lib/convection/control/stack.rb
327
358
  - lib/convection/dsl/helpers.rb
328
359
  - lib/convection/dsl/intrinsic_functions.rb
360
+ - lib/convection/model/attributes.rb
361
+ - lib/convection/model/cloudfile.rb
362
+ - lib/convection/model/diff.rb
363
+ - lib/convection/model/event.rb
364
+ - lib/convection/model/exceptions.rb
329
365
  - lib/convection/model/mixin/cidr_block.rb
366
+ - lib/convection/model/mixin/colorize.rb
330
367
  - lib/convection/model/mixin/conditional.rb
368
+ - lib/convection/model/mixin/policy.rb
369
+ - lib/convection/model/mixin/protocol.rb
331
370
  - lib/convection/model/mixin/taggable.rb
332
371
  - lib/convection/model/template.rb
372
+ - lib/convection/model/template/condition.rb
333
373
  - lib/convection/model/template/mapping.rb
334
374
  - lib/convection/model/template/output.rb
335
375
  - lib/convection/model/template/parameter.rb
336
376
  - lib/convection/model/template/resource.rb
377
+ - lib/convection/model/template/resource/aws_auto_scaling_auto_scaling_group.rb
378
+ - lib/convection/model/template/resource/aws_auto_scaling_launch_configuration.rb
379
+ - lib/convection/model/template/resource/aws_auto_scaling_scaling_policy.rb
380
+ - lib/convection/model/template/resource/aws_cloud_watch_alarm.rb
337
381
  - lib/convection/model/template/resource/aws_ec2_instance.rb
338
382
  - lib/convection/model/template/resource/aws_ec2_internet_gateway.rb
383
+ - lib/convection/model/template/resource/aws_ec2_network_acl.rb
384
+ - lib/convection/model/template/resource/aws_ec2_network_acl_entry.rb
339
385
  - lib/convection/model/template/resource/aws_ec2_route.rb
340
386
  - lib/convection/model/template/resource/aws_ec2_route_table.rb
341
387
  - lib/convection/model/template/resource/aws_ec2_security_group.rb
388
+ - lib/convection/model/template/resource/aws_ec2_security_group_ingres.rb
342
389
  - lib/convection/model/template/resource/aws_ec2_subnet.rb
390
+ - lib/convection/model/template/resource/aws_ec2_subnet_network_acl_association.rb
343
391
  - lib/convection/model/template/resource/aws_ec2_subnet_route_table_association.rb
344
392
  - lib/convection/model/template/resource/aws_ec2_vpc.rb
345
393
  - lib/convection/model/template/resource/aws_ec2_vpc_gateway_attachment.rb
394
+ - lib/convection/model/template/resource/aws_elasticache_cluster.rb
395
+ - lib/convection/model/template/resource/aws_elasticache_parameter_group.rb
396
+ - lib/convection/model/template/resource/aws_elasticache_security_group.rb
397
+ - lib/convection/model/template/resource/aws_elasticache_security_group_ingress.rb
398
+ - lib/convection/model/template/resource/aws_elb.rb
399
+ - lib/convection/model/template/resource/aws_iam_access_key.rb
400
+ - lib/convection/model/template/resource/aws_iam_group.rb
401
+ - lib/convection/model/template/resource/aws_iam_instance_profile.rb
346
402
  - lib/convection/model/template/resource/aws_iam_policy.rb
347
403
  - lib/convection/model/template/resource/aws_iam_role.rb
404
+ - lib/convection/model/template/resource/aws_iam_user.rb
405
+ - lib/convection/model/template/resource/aws_logs_loggroup.rb
406
+ - lib/convection/model/template/resource/aws_rds_db_instance.rb
407
+ - lib/convection/model/template/resource/aws_rds_db_parameter_group.rb
408
+ - lib/convection/model/template/resource/aws_rds_db_security_group.rb
409
+ - lib/convection/model/template/resource/aws_rds_db_subnet_group.rb
410
+ - lib/convection/model/template/resource/aws_route53_health_check.rb
411
+ - lib/convection/model/template/resource/aws_route53_recordset.rb
348
412
  - lib/convection/model/template/resource/aws_s3_bucket.rb
349
413
  - lib/convection/model/template/resource/aws_s3_bucket_policy.rb
414
+ - lib/convection/model/template/resource/aws_sns_topic.rb
415
+ - lib/convection/model/template/resource/aws_sqs_queue.rb
416
+ - lib/convection/model/template/resource/aws_sqs_queue_policy.rb
350
417
  - lib/convection/version.rb
351
- homepage: ''
418
+ - test/convection/model/test_conditions.rb
419
+ - test/convection/model/test_elasticache.rb
420
+ - test/convection/model/test_loggroups.rb
421
+ - test/convection/model/test_rds.rb
422
+ - test/convection/model/test_template.rb
423
+ - test/convection/model/test_validation.rb
424
+ - test/test_helper.rb
425
+ homepage: https://github.com/rapid7/convection
352
426
  licenses:
353
427
  - MIT
354
428
  metadata: {}
@@ -358,18 +432,25 @@ require_paths:
358
432
  - lib
359
433
  required_ruby_version: !ruby/object:Gem::Requirement
360
434
  requirements:
361
- - - '>='
435
+ - - ">="
362
436
  - !ruby/object:Gem::Version
363
437
  version: '0'
364
438
  required_rubygems_version: !ruby/object:Gem::Requirement
365
439
  requirements:
366
- - - '>='
440
+ - - ">="
367
441
  - !ruby/object:Gem::Version
368
442
  version: '0'
369
443
  requirements: []
370
444
  rubyforge_project:
371
- rubygems_version: 2.0.14
445
+ rubygems_version: 2.4.5
372
446
  signing_key:
373
447
  specification_version: 4
374
448
  summary: A fully generic, modular DSL for AWS CloudFormation
375
- test_files: []
449
+ test_files:
450
+ - test/convection/model/test_conditions.rb
451
+ - test/convection/model/test_elasticache.rb
452
+ - test/convection/model/test_loggroups.rb
453
+ - test/convection/model/test_rds.rb
454
+ - test/convection/model/test_template.rb
455
+ - test/convection/model/test_validation.rb
456
+ - test/test_helper.rb