convection 0.2.33 → 0.2.34.pre.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/CONTRIBUTING.md +22 -0
  4. data/README.md +15 -202
  5. data/Rakefile +3 -0
  6. data/docs/adding-new-resource-coverage.md +265 -0
  7. data/docs/canceling-stack-updates.md +5 -0
  8. data/docs/deleting-stacks.md +5 -0
  9. data/docs/getting-started.md +904 -0
  10. data/docs/index.md +69 -0
  11. data/docs/pygment.css +62 -0
  12. data/docs/relationship-to-cloudformation.md +51 -0
  13. data/docs/stacks.md +86 -0
  14. data/docs/template.html +130 -0
  15. data/example/getting-started-guide/Cloudfile +12 -0
  16. data/example/getting-started-guide/vpc.rb +74 -0
  17. data/example/stacks/Cloudfile +12 -0
  18. data/example/stacks/tasks/lookup_vpc_task.rb +28 -0
  19. data/example/stacks/templates/vpc.rb +14 -0
  20. data/lib/convection.rb +6 -0
  21. data/lib/convection/control/cloud.rb +1 -0
  22. data/lib/convection/control/stack.rb +126 -15
  23. data/lib/convection/model/cloudfile.rb +3 -0
  24. data/lib/convection/model/template/resource/aws_cloudfront_distribution.rb +24 -30
  25. data/lib/convection/model/template/resource/aws_ec2_dhcp_options.rb +38 -0
  26. data/lib/convection/model/template/resource/aws_ec2_security_group.rb +24 -2
  27. data/lib/convection/model/template/resource/aws_iam_user.rb +17 -3
  28. data/lib/convection/model/template/resource/aws_s3_bucket.rb +9 -3
  29. data/lib/convection/model/template/resource/aws_s3_bucket_policy.rb +10 -3
  30. data/lib/convection/model/template/resource/aws_sns_topic.rb +6 -3
  31. data/lib/convection/model/template/resource/aws_sns_topic_policy.rb +10 -3
  32. data/lib/convection/model/template/resource/aws_sqs_queue.rb +5 -3
  33. data/lib/convection/model/template/resource/aws_sqs_queue_policy.rb +10 -3
  34. data/spec/convection/model/template/resource/ec2_dhcp_options_spec.rb +55 -0
  35. data/yard_extensions.rb +4 -0
  36. data/yard_extensions/properties_handler.rb +30 -0
  37. data/yard_extensions/type_handler.rb +188 -0
  38. metadata +27 -23
  39. data/example/Cloudfile +0 -13
  40. data/example/deprecated/elb.rb +0 -27
  41. data/example/deprecated/iam_access_key.rb +0 -18
  42. data/example/deprecated/iam_group.rb +0 -31
  43. data/example/deprecated/iam_role.rb +0 -52
  44. data/example/deprecated/iam_user.rb +0 -31
  45. data/example/deprecated/rds.rb +0 -70
  46. data/example/deprecated/s3.rb +0 -13
  47. data/example/deprecated/sqs.rb +0 -32
  48. data/example/deprecated/vpc.rb +0 -85
  49. data/example/instances.rb +0 -93
  50. data/example/output/vpc.json +0 -335
  51. data/example/security-groups.rb +0 -77
  52. data/example/sqs-queue/Cloudfile +0 -19
  53. data/example/sqs-queue/README.md +0 -12
  54. data/example/trust_cloudtrail.rb +0 -24
  55. data/example/vpc.rb +0 -143
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: convection
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.33
4
+ version: 0.2.34.pre.beta.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: 2016-07-14 00:00:00.000000000 Z
11
+ date: 2016-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -81,6 +81,8 @@ files:
81
81
  - ".rubocop_todo.yml"
82
82
  - ".ruby-version"
83
83
  - ".travis.yml"
84
+ - ".yardopts"
85
+ - CONTRIBUTING.md
84
86
  - Gemfile
85
87
  - LICENSE
86
88
  - README.md
@@ -88,24 +90,21 @@ files:
88
90
  - Thorfile
89
91
  - bin/convection
90
92
  - convection.gemspec
93
+ - docs/adding-new-resource-coverage.md
94
+ - docs/canceling-stack-updates.md
95
+ - docs/deleting-stacks.md
96
+ - docs/getting-started.md
97
+ - docs/index.md
98
+ - docs/pygment.css
99
+ - docs/relationship-to-cloudformation.md
100
+ - docs/stacks.md
101
+ - docs/template.html
91
102
  - example/.ruby-version
92
- - example/Cloudfile
93
- - example/deprecated/elb.rb
94
- - example/deprecated/iam_access_key.rb
95
- - example/deprecated/iam_group.rb
96
- - example/deprecated/iam_role.rb
97
- - example/deprecated/iam_user.rb
98
- - example/deprecated/rds.rb
99
- - example/deprecated/s3.rb
100
- - example/deprecated/sqs.rb
101
- - example/deprecated/vpc.rb
102
- - example/instances.rb
103
- - example/output/vpc.json
104
- - example/security-groups.rb
105
- - example/sqs-queue/Cloudfile
106
- - example/sqs-queue/README.md
107
- - example/trust_cloudtrail.rb
108
- - example/vpc.rb
103
+ - example/getting-started-guide/Cloudfile
104
+ - example/getting-started-guide/vpc.rb
105
+ - example/stacks/Cloudfile
106
+ - example/stacks/tasks/lookup_vpc_task.rb
107
+ - example/stacks/templates/vpc.rb
109
108
  - ext/resource_generator.sh
110
109
  - lib/convection.rb
111
110
  - lib/convection/control/cloud.rb
@@ -137,6 +136,7 @@ files:
137
136
  - lib/convection/model/template/resource/aws_cloudfront_distribution.rb
138
137
  - lib/convection/model/template/resource/aws_directory_service_simple_ad.rb
139
138
  - lib/convection/model/template/resource/aws_ec2_customer_gateway.rb
139
+ - lib/convection/model/template/resource/aws_ec2_dhcp_options.rb
140
140
  - lib/convection/model/template/resource/aws_ec2_eip.rb
141
141
  - lib/convection/model/template/resource/aws_ec2_eip_association.rb
142
142
  - lib/convection/model/template/resource/aws_ec2_instance.rb
@@ -232,6 +232,7 @@ files:
232
232
  - spec/convection/dsl/intrinsic_functions_spec.rb
233
233
  - spec/convection/model/template/condition_spec.rb
234
234
  - spec/convection/model/template/resource/directoryservice_simple_ad_spec.rb
235
+ - spec/convection/model/template/resource/ec2_dhcp_options_spec.rb
235
236
  - spec/convection/model/template/resource/ec2_security_group_spec.rb
236
237
  - spec/convection/model/template/resource/ec2_subnet_spec.rb
237
238
  - spec/convection/model/template/resource/elasticache_cache_cluster_spec.rb
@@ -255,6 +256,9 @@ files:
255
256
  - spec/convection/model/template/validate_resources_spec.rb
256
257
  - spec/ec2_client_context.rb
257
258
  - spec/spec_helper.rb
259
+ - yard_extensions.rb
260
+ - yard_extensions/properties_handler.rb
261
+ - yard_extensions/type_handler.rb
258
262
  homepage: https://github.com/rapid7/convection
259
263
  licenses:
260
264
  - MIT
@@ -270,12 +274,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
270
274
  version: '0'
271
275
  required_rubygems_version: !ruby/object:Gem::Requirement
272
276
  requirements:
273
- - - ">="
277
+ - - ">"
274
278
  - !ruby/object:Gem::Version
275
- version: '0'
279
+ version: 1.3.1
276
280
  requirements: []
277
281
  rubyforge_project:
278
- rubygems_version: 2.4.3
282
+ rubygems_version: 2.4.5
279
283
  signing_key:
280
284
  specification_version: 4
281
285
  summary: A fully generic, modular DSL for AWS CloudFormation
@@ -291,6 +295,7 @@ test_files:
291
295
  - spec/convection/dsl/intrinsic_functions_spec.rb
292
296
  - spec/convection/model/template/condition_spec.rb
293
297
  - spec/convection/model/template/resource/directoryservice_simple_ad_spec.rb
298
+ - spec/convection/model/template/resource/ec2_dhcp_options_spec.rb
294
299
  - spec/convection/model/template/resource/ec2_security_group_spec.rb
295
300
  - spec/convection/model/template/resource/ec2_subnet_spec.rb
296
301
  - spec/convection/model/template/resource/elasticache_cache_cluster_spec.rb
@@ -314,4 +319,3 @@ test_files:
314
319
  - spec/convection/model/template/validate_resources_spec.rb
315
320
  - spec/ec2_client_context.rb
316
321
  - spec/spec_helper.rb
317
- has_rdoc:
@@ -1,13 +0,0 @@
1
- require_relative '../lib/convection'
2
- require_relative './vpc'
3
- require_relative './security-groups'
4
- require_relative './instances'
5
-
6
- name 'convection-test'
7
- region 'us-east-1'
8
-
9
- attribute 'vpc', 'subnet', '10.255.0.0/16'
10
-
11
- stack 'vpc', Convection::Demo::VPC
12
- stack 'security-groups', Convection::Demo::SECURITY_GROUPS
13
- stack 'instances', Convection::Demo::INSTANCES
@@ -1,27 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'convection'
3
-
4
- region = 'us-west-1'
5
-
6
- elb_template = Convection.template do
7
- description 'Example ELB via Convection '
8
-
9
- elb 'TestELB' do
10
- availability_zones(
11
- {
12
- "Fn::GetAZs"=>""
13
- }
14
- )
15
- load_balancer_name('ExampleELB')
16
- listeners(
17
- {
18
- 'InstancePort' => '80',
19
- 'LoadBalancerPort' => '80',
20
- 'Protocol' => 'HTTP'
21
- }
22
- )
23
- end
24
- end
25
-
26
- puts elb_template.to_json
27
- #puts Convection.stack('ELBTestStack', elb_template, :region => region).apply
@@ -1,18 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'convection'
3
-
4
- test_iam_access_key_template = Convection.template do
5
- description 'This example creates a user an access keys for that user.'
6
-
7
- iam_user 'NewUser' do
8
- path 'new_user'
9
- end
10
-
11
- iam_access_key 'NewUserKey' do
12
- status 'Active'
13
- user_name fn_ref(:NewUser)
14
- end
15
- end
16
-
17
- puts test_iam_access_key_template.to_json
18
- # puts Convection.stack('IAMTestStack', test_iam_access_key_template, :region => 'us-west-1').apply
@@ -1,31 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'convection'
3
-
4
- test_iam_group_template = Convection.template do
5
- description 'This is an example of a stack representing IAM Groups and Policies.'
6
-
7
- parameter 'Path' do
8
- type 'String'
9
- default '/'
10
- end
11
-
12
- iam_policy 'GroupPolicy' do
13
- policy_name 'NewPolicy'
14
- group fn_ref(:NewGroup)
15
-
16
- policy(
17
- :Statement => [{
18
- :Effect => 'Allow',
19
- :Action => ['s3:GetObject'],
20
- :Resource => ['arn:aws:s3:::some.bucket.name.here/*']
21
- }]
22
- )
23
- end
24
-
25
- iam_group 'NewGroup' do
26
- path fn_ref(:Path)
27
- end
28
- end
29
-
30
- puts test_iam_group_template.to_json
31
- # puts Convection.stack('IAMTestStack', test_iam_group_template, :region => 'us-west-1').apply
@@ -1,52 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # $LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
3
- require 'convection'
4
-
5
- ##
6
- # This is a quick example of building out a cloudformation template without
7
- # extending the underlying DSL.
8
- #
9
- # The reason could be anything from the inability to extend the dsl to a feature
10
- # in AWS has been made availalble but the DSL will be complex - so this is a
11
- # quick way to get access to those features.
12
- ##
13
-
14
- test_iam_role_template = Convection.template do
15
- description 'This is an example of a stack representing IAM Roles and Policies.'
16
-
17
- parameter 'Path' do
18
- type 'String'
19
- default '/'
20
- end
21
-
22
- iam_policy 'RolePolicy' do
23
- policy_name 'NewPolicy'
24
- role fn_ref(:NewRole)
25
-
26
- policy(
27
- :Statement => [{
28
- :Effect => 'Allow',
29
- :Action => ['s3:GetObject'],
30
- :Resource => ['arn:aws:s3:::some.bucket.name.here/*']
31
- }]
32
- )
33
- end
34
-
35
- iam_role 'NewRole' do
36
- path fn_ref(:Path)
37
-
38
- # EC2 Instance Role
39
- trust_relationship(
40
- :Statement => [{
41
- :Effect => 'Allow',
42
- :Principal => {
43
- :Service => 'ec2.amazonaws.com'
44
- },
45
- :Action => 'sts:AssumeRole'
46
- }]
47
- )
48
- end
49
- end
50
-
51
- puts test_iam_role_template.to_json
52
- # puts Convection.stack('IAMTestStack', test_iam_role_template, :region => 'us-west-1').apply
@@ -1,31 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'convection'
3
-
4
- test_iam_user_template = Convection.template do
5
- description 'This is an example of a stack representing IAM Users and Policies.'
6
-
7
- parameter 'Path' do
8
- type 'String'
9
- default '/'
10
- end
11
-
12
- iam_policy 'UserPolicy' do
13
- policy_name 'NewPolicy'
14
- user fn_ref(:NewUser)
15
-
16
- policy(
17
- :Statement => [{
18
- :Effect => 'Allow',
19
- :Action => ['s3:GetObject'],
20
- :Resource => ['arn:aws:s3:::some.bucket.name.here/*']
21
- }]
22
- )
23
- end
24
-
25
- iam_user 'NewUser' do
26
- path fn_ref(:Path)
27
- end
28
- end
29
-
30
- puts test_iam_user_template.to_json
31
- # puts Convection.stack('IAMTestStack', test_iam_user_template, :region => 'us-west-1').apply
@@ -1,70 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'convection'
3
-
4
- rds_template = Convection.template do
5
- description 'Testing RDS DB Instance definition'
6
-
7
- param_group = parameter_group 'TestingParamGroup' do
8
- description 'My Parameter Group for test the app' # Required
9
- family 'MySQL5.6' # Required
10
- parameters({
11
- character_set_database: 'utf8',
12
- slow_query_log: 1,
13
- max_allowed_packet: 10485760,
14
- lower_case_table_names: 1,
15
- innodb_flush_method: 'O_DIRECT',
16
- log_warnings: 2,
17
- collation_connection: 'utf8_unicode_ci',
18
- collation_server: 'utf8_unicode_ci',
19
- long_query_time: 5,
20
- character_set_server: 'utf8',
21
- log_output: 'FILE'
22
- })
23
- tag 'ui-test-db-param-group', 'yep'
24
- end
25
-
26
- #sec_group = db_security_group 'TestingSecurityGroup' do
27
- # ec2_vpc_id 'vpc-98248' #Required
28
- # db_security_group_ingress # Required
29
- # group_description # Required
30
- # tag 'ui-test-db-sec-group', 'yep'
31
- #end
32
-
33
- subnet_group = db_subnet_group 'TestingSubnetGroup' do
34
- db_subnet_group_description 'SubnetGroup for Testing ENV'
35
- subnet_id 's-1345345'
36
- subnet_id 's-23566'
37
- end
38
-
39
- db_master = db_instance 'TestDBMasterInstance' do
40
- allocated_storage '250' # Required
41
- backup_retention_period '7'
42
- db_instance_class 'db.m3.2xlarge' # Required
43
- db_instance_identifier 'ui-test-db'
44
- db_parameter_group_name param_group.name
45
- db_subnet_group_name subnet_group.name
46
- engine 'MySQL'
47
- iops '1000'
48
- master_username 'ui-test-db-user'
49
- master_user_password 'ui-test-db-password'
50
- multi_az true
51
- # vpc_security_groups fn_ref(sec_group.name)
52
- tag 'ui-test-db', 'yep'
53
- end
54
-
55
- db_instance 'TestDBReplicaInstance' do
56
- source_db_instance_identifier db_master.properties['DBInstanceIdentifier']
57
- allocated_storage '250' # Required
58
- db_instance_class 'db.m3.2xlarge' # Required
59
- db_instance_identifier "#{db_master.properties['DBInstanceIdentifier']}-replica"
60
- db_parameter_group_name param_group.name
61
- db_subnet_group_name subnet_group.name
62
- engine 'MySQL'
63
- iops '1000'
64
- # vpc_security_groups fn_ref(sec_group.name)
65
- tag 'ui-test-db-replica', 'yep'
66
- end
67
- end
68
-
69
- puts rds_template.to_json
70
- # puts Convection.stack('S3TestStack', s3_template, :region => 'us-west-1').apply
@@ -1,13 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'convection'
3
-
4
- s3_template = Convection.template do
5
- description 'Testing S3 bucket definition'
6
-
7
- s3_bucket 'TestBucket' do
8
- bucket_name 'convectiontestbucket'
9
- end
10
- end
11
-
12
- puts s3_template.to_json
13
- # puts Convection.stack('S3TestStack', s3_template, :region => 'us-west-1').apply
@@ -1,32 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'convection'
3
-
4
- sqs_template = Convection.template do
5
- description 'Testing SQS bucket definition'
6
-
7
- sqs_queue 'TestQueue' do
8
- message_retention_period '345600'
9
- queue_name 'testQueueName'
10
- visibility_timeout '120'
11
- end
12
-
13
- sqs_queue_policy 'TestQueuePolicy' do
14
- queue fn_ref(:TestQueue)
15
- policy_document :Statement =>[{
16
- :Effect => "Allow",
17
- :Action => [ "SQS:SendMessage" ],
18
- :Resource => "ResourceARN",
19
- :Principal => {
20
- "AWS" => "*"
21
- },
22
- :Condition => {
23
- "ArnLike" => {
24
- "aws:SourceArn" => "arn:aws:s3:*:*:bucket-name"
25
- }
26
- }
27
- }]
28
- end
29
- end
30
-
31
- puts sqs_template.to_json
32
- # puts Convection.stack('SQSTestQueue', sqs_template, :region => 'us-west-1').apply
@@ -1,85 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'convection'
3
-
4
- test_template = Convection.template do
5
- description 'This is a test stack generated with Convection'
6
-
7
- parameter 'InstanceSize' do
8
- type 'String'
9
- description 'Instance Size'
10
- default 'm3.medium'
11
-
12
- allow 'm3.medium'
13
- allow 'm3.large'
14
- allow 'm3.xlarge'
15
- end
16
-
17
- mapping 'RegionalAMIs' do
18
- item 'us-east-1', 'hvm', 'ami-76e27e1e'
19
- item 'us-west-1', 'hvm', 'ami-d5180890'
20
- item 'us-east-1', 'pv', 'ami-64e27e0c'
21
- item 'us-west-1', 'pv', 'ami-c5180880'
22
- end
23
-
24
- mapping 'RegionalKeys' do
25
- item 'us-east-1', 'test', 'cf-test-keys'
26
- item 'us-west-1', 'test', 'cf-test-keys'
27
- end
28
-
29
- ## Define the VPC
30
- ec2_vpc 'TargetVPC' do
31
- network '100.65.0.0/18'
32
- subnet_length 25
33
-
34
- ## Add an InternetGateway
35
- add_internet_gateway
36
-
37
- ## Add a default routing table
38
- public_table = add_route_table('Public', :gateway_route => true)
39
-
40
- ## Define Subnets and Insatnces in each availability zone
41
- stack.availability_zones do |zone, i|
42
- add_subnet "Test#{ i }" do
43
- availability_zone zone
44
- route_table public_table
45
-
46
- tag 'Service', 'Foo'
47
- end
48
- end
49
-
50
- tag 'Name', join('-', 'cf-test-vpc', fn_ref('AWS::StackName'))
51
- end
52
-
53
- ec2_security_group 'BetterSecurityGroup' do
54
- ingress_rule do
55
- cidr_ip '0.0.0.0/0'
56
- from 22
57
- to 22
58
- protocol 'TCP'
59
- end
60
- egress_rule do
61
- cidr_ip '0.0.0.0/0'
62
- from 0
63
- to 65_535
64
- protocol(-1)
65
- end
66
-
67
- description 'Allow SSH traffic from all of the places'
68
- vpc fn_ref(:TargetVPC)
69
-
70
- tag 'Name', join('-', fn_ref('AWS::StackName'), 'BetterSecurityGroup')
71
- end
72
- end
73
-
74
- # puts test_template.render
75
- # puts test_template.to_json
76
-
77
- # stack_e1 = Convection.stack('TestStackE1B1', test_template, :region => 'us-east-1')
78
- stack_w1 = Convection.stack('TestStackW1B2', test_template, :region => 'us-west-1')
79
-
80
- # puts stack_e1.status
81
- # puts stack_e1.apply
82
- puts stack_w1.to_json
83
-
84
- puts "Status #{ stack_w1.status }"
85
- # puts stack_w1.apply