kumogata-template 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (241) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +54 -0
  3. data/.travis.yml +8 -0
  4. data/Gemfile +4 -0
  5. data/Gemfile.lock +75 -0
  6. data/README.md +204 -0
  7. data/Rakefile +23 -0
  8. data/bin/kumogata-template +9 -0
  9. data/kumogata-template.gemspec +26 -0
  10. data/lib/kumogata/template.rb +17 -0
  11. data/lib/kumogata/template/autoscaling.rb +77 -0
  12. data/lib/kumogata/template/cloudwatch.rb +28 -0
  13. data/lib/kumogata/template/codedeploy.rb +85 -0
  14. data/lib/kumogata/template/const.rb +175 -0
  15. data/lib/kumogata/template/datapipeline.rb +90 -0
  16. data/lib/kumogata/template/dynamodb.rb +111 -0
  17. data/lib/kumogata/template/ec2.rb +165 -0
  18. data/lib/kumogata/template/ecs.rb +119 -0
  19. data/lib/kumogata/template/elasticbeanstalk.rb +33 -0
  20. data/lib/kumogata/template/elb.rb +132 -0
  21. data/lib/kumogata/template/emr.rb +166 -0
  22. data/lib/kumogata/template/events.rb +25 -0
  23. data/lib/kumogata/template/ext/argument_parser.rb +8 -0
  24. data/lib/kumogata/template/ext/kumogata.rb +103 -0
  25. data/lib/kumogata/template/helper.rb +211 -0
  26. data/lib/kumogata/template/iam.rb +96 -0
  27. data/lib/kumogata/template/lambda.rb +34 -0
  28. data/lib/kumogata/template/s3.rb +223 -0
  29. data/lib/kumogata/template/sns.rb +25 -0
  30. data/lib/kumogata/template/version.rb +1 -0
  31. data/template/_template.rb +25 -0
  32. data/template/autoscaling-group.rb +47 -0
  33. data/template/autoscaling-launch-configuration.rb +54 -0
  34. data/template/autoscaling-lifecycle-hook.rb +27 -0
  35. data/template/autoscaling-scaling-policy.rb +33 -0
  36. data/template/autoscaling-scheduled-action.rb +37 -0
  37. data/template/cloudtrail.rb +39 -0
  38. data/template/cloudwatch-alarm.rb +45 -0
  39. data/template/codedeploy-application.rb +15 -0
  40. data/template/codedeploy-deployment-config.rb +23 -0
  41. data/template/codedeploy-deployment-group.rb +35 -0
  42. data/template/datapipeline-pipeline.rb +28 -0
  43. data/template/dynamodb-table.rb +33 -0
  44. data/template/ec2-eip-association.rb +23 -0
  45. data/template/ec2-eip.rb +17 -0
  46. data/template/ec2-instance.rb +65 -0
  47. data/template/ec2-internet-gateway.rb +15 -0
  48. data/template/ec2-nat-gateway.rb +17 -0
  49. data/template/ec2-network-acl-entry.rb +30 -0
  50. data/template/ec2-network-acl.rb +17 -0
  51. data/template/ec2-route-table.rb +17 -0
  52. data/template/ec2-route.rb +27 -0
  53. data/template/ec2-security-group.rb +24 -0
  54. data/template/ec2-subnet-network-acl-association.rb +17 -0
  55. data/template/ec2-subnet-route-table-association.rb +17 -0
  56. data/template/ec2-subnet.rb +23 -0
  57. data/template/ec2-volume-attachment.rb +19 -0
  58. data/template/ec2-volume.rb +31 -0
  59. data/template/ec2-vpc-endpoint.rb +23 -0
  60. data/template/ec2-vpc-gateway-attachment.rb +19 -0
  61. data/template/ec2-vpc.rb +24 -0
  62. data/template/ecs-cluster.rb +11 -0
  63. data/template/ecs-service.rb +24 -0
  64. data/template/ecs-task-definition.rb +18 -0
  65. data/template/elasticache-cache-cluster.rb +63 -0
  66. data/template/elasticache-parameter-group.rb +20 -0
  67. data/template/elasticache-replication-group.rb +58 -0
  68. data/template/elasticache-subnet-group.rb +17 -0
  69. data/template/elasticbeanstalk-application-version.rb +24 -0
  70. data/template/elasticbeanstalk-application.rb +17 -0
  71. data/template/elasticbeanstalk-configuration-template.rb +31 -0
  72. data/template/elasticbeanstalk-environment.rb +44 -0
  73. data/template/elb-loadbalancer.rb +46 -0
  74. data/template/emr-cluster.rb +39 -0
  75. data/template/emr-instance-group-config.rb +33 -0
  76. data/template/emr-step.rb +22 -0
  77. data/template/events-rule.rb +28 -0
  78. data/template/iam-access-key.rb +19 -0
  79. data/template/iam-group.rb +20 -0
  80. data/template/iam-instance-profile.rb +17 -0
  81. data/template/iam-managed-policy.rb +28 -0
  82. data/template/iam-policy.rb +26 -0
  83. data/template/iam-role.rb +21 -0
  84. data/template/iam-user-to-group-addition.rb +17 -0
  85. data/template/iam-user.rb +24 -0
  86. data/template/lambda-alias.rb +21 -0
  87. data/template/lambda-event-source-mapping.rb +24 -0
  88. data/template/lambda-function.rb +34 -0
  89. data/template/lambda-permission.rb +26 -0
  90. data/template/lambda-version.rb +19 -0
  91. data/template/mappings-ec2.rb +85 -0
  92. data/template/output-access-key.rb +6 -0
  93. data/template/output-arn.rb +6 -0
  94. data/template/output-autoscaling.rb +6 -0
  95. data/template/output-az.rb +6 -0
  96. data/template/output-dynamodb.rb +6 -0
  97. data/template/output-ec2.rb +8 -0
  98. data/template/output-elasticache.rb +30 -0
  99. data/template/output-elb.rb +12 -0
  100. data/template/output-emr.rb +6 -0
  101. data/template/output-rds.rb +10 -0
  102. data/template/output-redshift.rb +10 -0
  103. data/template/output-s3.rb +8 -0
  104. data/template/output-security-group.rb +5 -0
  105. data/template/output-sqs.rb +5 -0
  106. data/template/output-topic.rb +6 -0
  107. data/template/output-vpc.rb +10 -0
  108. data/template/output.rb +29 -0
  109. data/template/parameter-ec2.rb +22 -0
  110. data/template/parameter-elasticache.rb +9 -0
  111. data/template/parameter-rds.rb +9 -0
  112. data/template/parameter-redshift.rb +9 -0
  113. data/template/parameter.rb +20 -0
  114. data/template/rds-db-cluster-parameter-group.rb +22 -0
  115. data/template/rds-db-cluster.rb +47 -0
  116. data/template/rds-db-instance.rb +82 -0
  117. data/template/rds-db-parameter-group.rb +21 -0
  118. data/template/rds-db-subnet-group.rb +19 -0
  119. data/template/rds-event-subscription.rb +42 -0
  120. data/template/rds-option-group.rb +23 -0
  121. data/template/redshift-cluster-parameter-group.rb +19 -0
  122. data/template/redshift-cluster-subnet-group.rb +17 -0
  123. data/template/redshift-cluster.rb +60 -0
  124. data/template/s3-bucket-policy.rb +20 -0
  125. data/template/s3-bucket.rb +42 -0
  126. data/template/sns-topic.rb +20 -0
  127. data/template/sqs-queue.rb +27 -0
  128. data/test/_template.rb +26 -0
  129. data/test/abstract_unit.rb +101 -0
  130. data/test/autoscaling_test.rb +109 -0
  131. data/test/codedeploy_test.rb +117 -0
  132. data/test/datapipeline_test.rb +142 -0
  133. data/test/dynamodb_test.rb +184 -0
  134. data/test/ec2_test.rb +286 -0
  135. data/test/ecs_test.rb +135 -0
  136. data/test/elasticbeanstalk_test.rb +56 -0
  137. data/test/elb_test.rb +147 -0
  138. data/test/emr_test.rb +193 -0
  139. data/test/events_test.rb +22 -0
  140. data/test/helper_test.rb +547 -0
  141. data/test/iam_test.rb +93 -0
  142. data/test/lambda_test.rb +41 -0
  143. data/test/s3_test.rb +195 -0
  144. data/test/sns_test.rb +27 -0
  145. data/test/template/autoscaling-group_test.rb +177 -0
  146. data/test/template/autoscaling-launch-configuration_test.rb +117 -0
  147. data/test/template/autoscaling-lifecycle-hook_test.rb +33 -0
  148. data/test/template/autoscaling-scaling-policy_test.rb +26 -0
  149. data/test/template/autoscaling-scheduled-action_test.rb +26 -0
  150. data/test/template/cloudtrail_test.rb +55 -0
  151. data/test/template/cloudwatch-alarm_test.rb +38 -0
  152. data/test/template/codedeploy-application_test.rb +21 -0
  153. data/test/template/codedeploy-deployment-config_test.rb +26 -0
  154. data/test/template/codedeploy-deployment-group_test.rb +48 -0
  155. data/test/template/datapipeline-pipeline_test.rb +358 -0
  156. data/test/template/dynamodb-table_test.rb +94 -0
  157. data/test/template/ec2-eip-association_test.rb +22 -0
  158. data/test/template/ec2-eip_test.rb +21 -0
  159. data/test/template/ec2-instance_test.rb +95 -0
  160. data/test/template/ec2-internet-gateway_test.rb +48 -0
  161. data/test/template/ec2-nat-gateway_test.rb +22 -0
  162. data/test/template/ec2-network-acl-entry_test.rb +61 -0
  163. data/test/template/ec2-network-acl_test.rb +51 -0
  164. data/test/template/ec2-route-table_test.rb +49 -0
  165. data/test/template/ec2-route_test.rb +21 -0
  166. data/test/template/ec2-security-group_test.rb +50 -0
  167. data/test/template/ec2-subnet-netwokr-acl-association_test.rb +26 -0
  168. data/test/template/ec2-subnet-route-table-association_test.rb +22 -0
  169. data/test/template/ec2-subnet_test.rb +51 -0
  170. data/test/template/ec2-volume-attachment_test.rb +24 -0
  171. data/test/template/ec2-volume_test.rb +52 -0
  172. data/test/template/ec2-vpc-gateway-attachment_test.rb +23 -0
  173. data/test/template/ec2-vpc_test.rb +102 -0
  174. data/test/template/ecs-cluster_test.rb +18 -0
  175. data/test/template/ecs-service_test.rb +29 -0
  176. data/test/template/ecs-task-definition_test.rb +143 -0
  177. data/test/template/elasticache-cache-cluster_test.rb +77 -0
  178. data/test/template/elasticache-parameter-group_test.rb +25 -0
  179. data/test/template/elasticache-replication-group_test.rb +45 -0
  180. data/test/template/elasticache-subnet-group_test.rb +26 -0
  181. data/test/template/elasticbeanstalk-application-version_test.rb +27 -0
  182. data/test/template/elasticbeanstalk-application_test.rb +21 -0
  183. data/test/template/elasticbeanstalk-configuration-template_test.rb +23 -0
  184. data/test/template/elasticbeanstalk-environment_test.rb +56 -0
  185. data/test/template/elasticbeanstalk-template_test.rb +33 -0
  186. data/test/template/elb-loadbalancer_test.rb +94 -0
  187. data/test/template/emr-cluster_test.rb +147 -0
  188. data/test/template/emr-instance-group-config_test.rb +65 -0
  189. data/test/template/emr-step_test.rb +82 -0
  190. data/test/template/events-rule_test.rb +34 -0
  191. data/test/template/iam-access-key_test.rb +22 -0
  192. data/test/template/iam-group_test.rb +21 -0
  193. data/test/template/iam-instance-profile_test.rb +24 -0
  194. data/test/template/iam-managed-policy_test.rb +35 -0
  195. data/test/template/iam-policy_test.rb +52 -0
  196. data/test/template/iam-role_test.rb +37 -0
  197. data/test/template/iam-user-to-group-addition_test.rb +24 -0
  198. data/test/template/iam-user_test.rb +21 -0
  199. data/test/template/lambda-alias_test.rb +46 -0
  200. data/test/template/lambda-event-source-mapping_test.rb +36 -0
  201. data/test/template/lambda-function_test.rb +34 -0
  202. data/test/template/lambda-permission_test.rb +32 -0
  203. data/test/template/lambda-version_test.rb +27 -0
  204. data/test/template/mappings-ec2_test.rb +92 -0
  205. data/test/template/output-access-key_test.rb +30 -0
  206. data/test/template/output-arn_test.rb +30 -0
  207. data/test/template/output-autoscaling_test.rb +27 -0
  208. data/test/template/output-az_test.rb +31 -0
  209. data/test/template/output-dynamodb_test.rb +21 -0
  210. data/test/template/output-ec2_test.rb +82 -0
  211. data/test/template/output-elasticache_test.rb +107 -0
  212. data/test/template/output-elb_test.rb +48 -0
  213. data/test/template/output-emr_test.rb +30 -0
  214. data/test/template/output-rds_test.rb +39 -0
  215. data/test/template/output-redshift_test.rb +39 -0
  216. data/test/template/output-s3_test.rb +52 -0
  217. data/test/template/output-security-group_test.rb +21 -0
  218. data/test/template/output-sqs_test.rb +21 -0
  219. data/test/template/output-topic_test.rb +30 -0
  220. data/test/template/output-vpc_test.rb +48 -0
  221. data/test/template/output_test.rb +87 -0
  222. data/test/template/parameter-ec2_test.rb +44 -0
  223. data/test/template/parameter-elasticache_test.rb +30 -0
  224. data/test/template/parameter-rds_test.rb +30 -0
  225. data/test/template/parameter-redshift_test.rb +30 -0
  226. data/test/template/parameter_test.rb +40 -0
  227. data/test/template/rds-db-cluster-parameter-group_test.rb +53 -0
  228. data/test/template/rds-db-cluster_test.rb +84 -0
  229. data/test/template/rds-db-instance_test.rb +93 -0
  230. data/test/template/rds-db-parameter-group_test.rb +53 -0
  231. data/test/template/rds-db-subnet-group.rb +54 -0
  232. data/test/template/rds-event-subscription_test.rb +48 -0
  233. data/test/template/rds-option-group_test.rb +56 -0
  234. data/test/template/redshift-cluster-parameter-group_test.rb +28 -0
  235. data/test/template/redshift-cluster-subnet-group_test.rb +26 -0
  236. data/test/template/redshift-cluster_test.rb +47 -0
  237. data/test/template/s3-bucket-policy_test.rb +40 -0
  238. data/test/template/s3-bucket_test.rb +127 -0
  239. data/test/template/sns-topic_test.rb +42 -0
  240. data/test/template/sqs-queue_test.rb +25 -0
  241. metadata +468 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 056c8272cb187eaf7acaa979185624c8ef948045
4
+ data.tar.gz: d8aef0a59b410e795f64a0203a46becc3417ca0f
5
+ SHA512:
6
+ metadata.gz: ec8c46f7979ec60a47c749a6459f5e048ae7bffda361d3fb042e00753b6d7f4139d2fd9da458f66fe004267a9b088601322f78b27323c961d24be6b44e969757
7
+ data.tar.gz: 4650ad9220daffc1366402e7a96603f63a91b3e97539ebc253d86bf51d397a5a8354616705891615ac1dce7d4ace11999995e098af652db3baa4d7f1f571c459
data/.gitignore ADDED
@@ -0,0 +1,54 @@
1
+ ### https://raw.github.com/github/gitignore/b27b46b656d026ac295b3a47cf43e8af192472e2/ruby.gitignore
2
+
3
+ *.gem
4
+ *.rbc
5
+ /.config
6
+ /coverage/
7
+ /InstalledFiles
8
+ /pkg/
9
+ /spec/reports/
10
+ /spec/examples.txt
11
+ /test/tmp/
12
+ /test/version_tmp/
13
+ /tmp/
14
+
15
+ # Used by dotenv library to load environment variables.
16
+ # .env
17
+
18
+ ## Specific to RubyMotion:
19
+ .dat*
20
+ .repl_history
21
+ build/
22
+ *.bridgesupport
23
+ build-iPhoneOS/
24
+ build-iPhoneSimulator/
25
+
26
+ ## Specific to RubyMotion (use of CocoaPods):
27
+ #
28
+ # We recommend against adding the Pods directory to your .gitignore. However
29
+ # you should judge for yourself, the pros and cons are mentioned at:
30
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
31
+ #
32
+ # vendor/Pods/
33
+
34
+ ## Documentation cache and generated files:
35
+ /.yardoc/
36
+ /_yardoc/
37
+ /doc/
38
+ /rdoc/
39
+
40
+ ## Environment normalization:
41
+ /.bundle/
42
+ /vendor/bundle
43
+ /lib/bundler/man/
44
+
45
+ # for a library or gem, you might want to ignore these files since the code is
46
+ # intended to run in multiple environments; otherwise, check them in:
47
+ # Gemfile.lock
48
+ # .ruby-version
49
+ # .ruby-gemset
50
+
51
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
52
+ .rvmrc
53
+
54
+
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ sudo: false
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.3.1
6
+ script:
7
+ - bundle install
8
+ - bundle exec rake
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in kumogata.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,75 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ kumogata-template (0.0.1)
5
+ aws-sdk (~> 2)
6
+ kumogata (= 0.5.8)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ aws-sdk (2.2.27)
12
+ aws-sdk-resources (= 2.2.27)
13
+ aws-sdk-core (2.2.27)
14
+ jmespath (~> 1.0)
15
+ aws-sdk-resources (2.2.27)
16
+ aws-sdk-core (= 2.2.27)
17
+ aws-sdk-v1 (1.66.0)
18
+ json (~> 1.4)
19
+ nokogiri (>= 1.4.4)
20
+ coderay (1.1.1)
21
+ coffee-script (2.4.1)
22
+ coffee-script-source
23
+ execjs
24
+ coffee-script-source (1.10.0)
25
+ diffy (3.1.0)
26
+ dslh (0.2.7)
27
+ execjs (2.6.0)
28
+ hashie (3.4.3)
29
+ highline (1.7.8)
30
+ jmespath (1.1.3)
31
+ json (1.8.3)
32
+ json5 (0.0.1)
33
+ kumogata (0.5.8)
34
+ aws-sdk-v1
35
+ coderay
36
+ coffee-script
37
+ diffy
38
+ dslh (>= 0.2.7)
39
+ hashie
40
+ highline
41
+ json
42
+ json5
43
+ net-ssh
44
+ retryable (~> 2.0.0)
45
+ term-ansicolor
46
+ therubyracer
47
+ uuidtools
48
+ libv8 (3.16.14.15)
49
+ mini_portile2 (2.0.0)
50
+ minitest (5.8.4)
51
+ net-ssh (3.0.2)
52
+ nokogiri (1.6.7.2)
53
+ mini_portile2 (~> 2.0.0.rc2)
54
+ rake (11.1.1)
55
+ ref (2.0.0)
56
+ retryable (2.0.3)
57
+ term-ansicolor (1.3.2)
58
+ tins (~> 1.0)
59
+ therubyracer (0.12.2)
60
+ libv8 (~> 3.16.14.0)
61
+ ref
62
+ tins (1.9.0)
63
+ uuidtools (2.1.5)
64
+
65
+ PLATFORMS
66
+ ruby
67
+
68
+ DEPENDENCIES
69
+ bundler (~> 1.11)
70
+ kumogata-template!
71
+ minitest (~> 5.8)
72
+ rake (~> 11.1)
73
+
74
+ BUNDLED WITH
75
+ 1.12.4
data/README.md ADDED
@@ -0,0 +1,204 @@
1
+ # kumogata-template
2
+
3
+ [![Build Status](https://travis-ci.org/n0ts/kumogata-template.svg?branch=master)](https://travis-ci.org/n0ts/kumogata-template)
4
+
5
+ ## About
6
+
7
+ - `kumogate-template` is a template sets for `[kumogata](https://github.com/winebarrel/kumogata).`
8
+
9
+ ## Installation
10
+
11
+ Add
12
+
13
+
14
+ Add this line to your application's Gemfile:
15
+
16
+ ```ruby
17
+ gem 'kumogata-template'
18
+ ```
19
+
20
+ And then execute:
21
+
22
+ $ bundle
23
+
24
+ Or install it yourself as:
25
+
26
+ $ gem install kumogata-template
27
+
28
+
29
+ ## Usage
30
+
31
+ ```
32
+ Usage: kumogate-template <command> [args] [options]
33
+
34
+ Commands:
35
+ init STACK_NAME Initialize template
36
+ * Other command same as kumogata's commands
37
+
38
+ Options:
39
+ * Options is same as the kumogata's options
40
+ ```
41
+
42
+ - Initialize a sample template
43
+
44
+ ```
45
+ $ bundle exec kumogata-template init sample
46
+ Saved template to sample.rb
47
+
48
+ $ cat sample.rb
49
+
50
+ AWSTemplateFormatVersion "2010-09-09"
51
+
52
+ Description (<<-EOS).undent
53
+ Kumogata Template - sample stack
54
+ EOS
55
+
56
+ Parameters do
57
+ _parameter "name", default: "sample",
58
+ description: "name of this stack"
59
+ _parameter "service", default: "service",
60
+ description: "sample service"
61
+ _parameter "version", default: "1.0.0",
62
+ description: "sample version"
63
+ end
64
+
65
+ Mappings do
66
+ end
67
+
68
+ Resources do
69
+ _s3_bucket "sample"
70
+ end
71
+
72
+ Outputs do
73
+ _output_s3 "sample"
74
+ end
75
+ ```
76
+
77
+ - Below sample template is create a s3 bucket.
78
+
79
+
80
+ ## What is difference `kumogata-template` and `kumogata`
81
+
82
+ - For example launch EC2 instance.
83
+
84
+ ### kumogata
85
+
86
+ ```
87
+ myEC2Instance do
88
+ Type "AWS::EC2::Instance"
89
+ Properties do
90
+ ImageId "ami-XXXXXXXX"
91
+ InstanceType { Ref "InstanceType" }
92
+ KeyName "your_key_name"
93
+
94
+ UserData do
95
+ Fn__Base64 (<<-EOS).undent
96
+ #!/bin/bash
97
+ yum install -y httpd
98
+ service httpd start
99
+ EOS
100
+ end
101
+ end
102
+ end
103
+ ```
104
+
105
+
106
+ ### kumogata-template
107
+
108
+ - More simply write cloudformation stack.
109
+
110
+ ```
111
+ user_data =<<EOS
112
+ yum install -y httpd
113
+ service httpd start
114
+ EOS
115
+
116
+ _ec2_instance "my",
117
+ image_id: "ami-XXXXXXXX",
118
+ ref_instance_type: "my",
119
+ key_name: "your_key_name",
120
+ user_data: user_data
121
+ ```
122
+
123
+ - more example see [test code](test/template)
124
+
125
+
126
+ ## Support AWS Resource Types
127
+
128
+ - AWS::AutoScaling::AutoScalingGroup
129
+ - AWS::AutoScaling::LaunchConfiguration
130
+ - AWS::AutoScaling::LifecycleHook
131
+ - AWS::AutoScaling::ScalingPolicy
132
+ - AWS::AutoScaling::ScheduledAction
133
+ - AWS::CloudTrail::Trail
134
+ - AWS::CodeDeploy::Application
135
+ - AWS::CodeDeploy::DeploymentConfig
136
+ - AWS::CodeDeploy::DeploymentGroup
137
+ - AWS::DataPipeline::Pipeline
138
+ - AWS::DynamoDB::Table
139
+ - AWS::EC2::EIPAssociation
140
+ - AWS::EC2::EIP
141
+ - AWS::EC2::Instance
142
+ - AWS::EC2::InternetGateway
143
+ - AWS::EC2::NatGateway
144
+ - AWS::EC2::NetworkAclEntry
145
+ - AWS::EC2::NetworkAcl
146
+ - AWS::EC2::RouteTable
147
+ - AWS::EC2::Route
148
+ - AWS::EC2::SecurityGroup
149
+ - AWS::EC2::SubnetNetworkAclAssociation
150
+ - AWS::EC2::SubnetRouteTableAssociation
151
+ - AWS::EC2::Subnet
152
+ - AWS::EC2::VolumeAttachment
153
+ - AWS::EC2::VPCEndpoint
154
+ - AWS::EC2::VPCGatewayAttachment
155
+ - AWS::EC2::VPC
156
+ - AWS::ECS::Cluster
157
+ - AWS::ECS::Service
158
+ - AWS::ECS::TaskDefinition
159
+ - AWS::ElastiCache::CacheCluster
160
+ - AWS::ElastiCache::ParameterGroup
161
+ - AWS::ElastiCache::ReplicationGroup
162
+ - AWS::ElastiCache::SubnetGroup
163
+ - AWS::ElasticBeanstalk::ApplicationVersion
164
+ - AWS::ElasticBeanstalk::Application
165
+ - AWS::ElasticBeanstalk::ConfigurationTemplate
166
+ - AWS::ElasticBeanstalk::Environment
167
+ - AWS::ElasticLoadBalancing::LoadBalancer
168
+ - AWS::EMR::Cluster
169
+ - AWS::EMR::InstanceGroupConfig
170
+ - AWS::EMR::Step
171
+ - AWS::Events::Rule
172
+ - AWS::IAM::AccessKey
173
+ - AWS::IAM::Group
174
+ - AWS::IAM::InstanceProfile
175
+ - AWS::IAM::ManagedPolicy
176
+ - AWS::IAM::Policy
177
+ - AWS::IAM::Role
178
+ - AWS::IAM::UserToGroupAddition
179
+ - AWS::IAM::User
180
+ - AWS::Lambda::Alias
181
+ - AWS::Lambda::EventSourceMapping
182
+ - AWS::Lambda::Function
183
+ - AWS::Lambda::Permission
184
+ - AWS::Lambda::Version
185
+ - AWS::RDS::DBClusterParameterGroup
186
+ - AWS::RDS::DBCluster
187
+ - AWS::RDS::DBInstance
188
+ - AWS::RDS::DBParameterGroup
189
+ - AWS::RDS::DBSubnetGroup
190
+ - AWS::RDS::EventSubscription
191
+ - AWS::RDS::OptionGroup
192
+ - AWS::Redshift::ClusterParameterGroup
193
+ - AWS::Redshift::ClusterSubnetGroup
194
+ - AWS::Redshift::Cluster
195
+ - AWS::S3::BucketPolicy
196
+ - AWS::S3::Bucket
197
+ - AWS::SNS::Topic
198
+ - AWS::SQS::Queue
199
+
200
+
201
+ ## TODO
202
+
203
+ - Support [Kumogata2](https://github.com/winebarrel/kumogata2)
204
+ - Useful kumogate-template snippets
data/Rakefile ADDED
@@ -0,0 +1,23 @@
1
+ require 'rake/testtask'
2
+
3
+ task :default => :test
4
+
5
+ task :package
6
+ task "package:clean"
7
+
8
+ Rake::TestTask.new do |t|
9
+ t.libs << 'test'
10
+ t.pattern = 'test/**/*_test.rb'
11
+ # disable output - warning: assigned but unused variable
12
+ t.warning = false
13
+ t.verbose = false
14
+ t.ruby_opts = ["--dev"] if defined?(JRUBY_VERSION)
15
+ end
16
+
17
+ namespace :test do
18
+ task :isolated do
19
+ Dir.glob("test/**/*_test.rb").all? do |file|
20
+ sh(Gem.ruby, '-w', '-Ilib:test', file)
21
+ end or raise "Failures"
22
+ end
23
+ end
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ $: << File.expand_path("#{File.dirname __FILE__}/../lib")
3
+ require 'rubygems'
4
+ require 'kumogata/template/ext/kumogata'
5
+ require 'kumogata/template/ext/argument_parser'
6
+ require 'kumogata/template'
7
+
8
+
9
+ load Gem.bin_path('kumogata', 'kumogata')
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'kumogata/template/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'kumogata-template'
8
+ spec.version = KUMOGATA_TEMPLATE_VERSION
9
+ spec.authors = ['Naoya Nakazawa']
10
+ spec.email = ['me@n0ts.org']
11
+ spec.summary = %q{Template for Kumogata.}
12
+ spec.description = %q{Template for Kumogata. Kumogata is a tool for AWS CloudFormation. It can define a template in Ruby DSL.}
13
+ spec.homepage = 'https://github.com/n0ts/kumogata-template'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_dependency 'aws-sdk', '~> 2'
22
+ spec.add_dependency 'kumogata', '0.5.8'
23
+ spec.add_development_dependency 'bundler', '~> 1.11'
24
+ spec.add_development_dependency 'rake', '~> 11.1'
25
+ spec.add_development_dependency 'minitest', '~> 5.8'
26
+ end
@@ -0,0 +1,17 @@
1
+ require 'kumogata/template/autoscaling'
2
+ require 'kumogata/template/cloudwatch'
3
+ require 'kumogata/template/codedeploy'
4
+ require 'kumogata/template/const'
5
+ require 'kumogata/template/datapipeline'
6
+ require 'kumogata/template/dynamodb'
7
+ require 'kumogata/template/ec2'
8
+ require 'kumogata/template/ecs'
9
+ require 'kumogata/template/elasticbeanstalk'
10
+ require 'kumogata/template/elb'
11
+ require 'kumogata/template/emr'
12
+ require 'kumogata/template/helper'
13
+ require 'kumogata/template/iam'
14
+ require 'kumogata/template/lambda'
15
+ require 'kumogata/template/s3'
16
+ require 'kumogata/template/sns'
17
+ require 'kumogata/template/version'
@@ -0,0 +1,77 @@
1
+ #
2
+ # Helper - AutoScaling
3
+ #
4
+ require 'kumogata/template/helper'
5
+
6
+ def _autoscaling_metrics
7
+ _{
8
+ Granularity "1Minute"
9
+ Metrics %w( GroupMinSize
10
+ GroupMaxSize
11
+ GroupDesiredCapacity
12
+ GroupInServiceInstances
13
+ GroupPendingInstances
14
+ GroupStandbyInstances
15
+ GroupTerminatingInstances
16
+ GroupTotalInstances )
17
+ }
18
+ end
19
+
20
+ def _autoscaling_notification(args)
21
+ types = args[:types] || []
22
+ %w(
23
+ EC2_INSTANCE_LAUNCH
24
+ EC2_INSTANCE_LAUNCH_ERROR
25
+ EC2_INSTANCE_TERMINATE
26
+ EC2_INSTANCE_TERMINATE_ERROR
27
+ TEST_NOTIFICATION
28
+ ).collect{|v| types << "autoscaling:#{v}" } if types.empty?
29
+
30
+ topic = _ref_attr_string("topic", "Arn", args, "topic")
31
+ topic = _ref_string("topic_arn", args) if topic.empty?
32
+
33
+ _{
34
+ NotificationTypes types
35
+ TopicARN topic
36
+ }
37
+ end
38
+
39
+ def _autoscaling_step(args)
40
+ lower = args[:lower] || ""
41
+ upper = args[:upper] || ""
42
+ scaling = args[:scaling] || 1
43
+
44
+ _{
45
+ MetricIntervalLowerBound lower unless lower.empty?
46
+ MetricIntervalUpperBound upper unless upper.empty?
47
+ ScalingAdjustment scaling
48
+ }
49
+ end
50
+
51
+ def _autoscaling_tags(args)
52
+ tags = [
53
+ _{
54
+ Key "Name"
55
+ Value _tag_name(args[:tag_name] || args[:name])
56
+ PropagateAtLaunch _bool("tag_name_launch", args, true)
57
+ },
58
+ _{
59
+ Key "Service"
60
+ Value { Ref _resource_name("service") }
61
+ PropagateAtLaunch _bool("tag_service_launch", args, true)
62
+ },
63
+ _{
64
+ Key "Version"
65
+ Value { Ref _resource_name("version") }
66
+ PropagateAtLaunch _bool("tag_version_launch", args, true)
67
+ },
68
+ ]
69
+ if args.key? :tags_append
70
+ args[:tags_append].each do|key, value|
71
+ tag = _tag({ key: key, value: value })
72
+ tag["PropagateAtLaunch"] = _bool("tag_#{key}_launch", args, true)
73
+ tags << tag
74
+ end
75
+ end
76
+ tags
77
+ end